3.4 Options

Many aspects of PyPedal's operation can be controlled using a series of options. A complete list of these options, their defaults, and a brief desription of their purpose is presented in Table 3.1. Options are stored in a Python dictionary that you must create in your programs. You must specify values for the pedfile and pedformat options; all others are optional. pedfile is a string containing the name of the file from which your pedigree will be read. pedformat is a string containing a pedigree format code (see section 3.5.1) for each column in the datafile in the order in which those columns occur. The following code fragement demonstrates how options are specified.
options = {}
options['messages'] = 'verbose'
options['renumber'] = 0
options['counter'] = 5
options['pedfile'] = 'new_lacy.ped'
options['pedformat'] = 'asd'
options['pedname'] = 'Lacy Pedigree'
example = pyp_newclasses.loadPedigree(options)
First, a dictionary named options is created; you may use any name you like as long as it is a valid Python variable name. Next, values are assigned to several options. Finally, options is passed to pyp_newclasses.loadPedigree(), which requires that you pass it either a dictionary of options or a configuration file name. If you do not provide one of these, PyPedal will halt with an error.

A single PyPedal program may be used to read one or more pedigrees. Each pedigree that you read must be passed its own dictionary of options. The easiest way to do this is by creating a dictionary with global options. You can then customize the dictionary for each pedigree you want to read. Once you have created a PyPedal pedigree by calling pyp_newclasses.NewPedigree(options) you can change the options dictionary without affecting that pedigree because it has a separate copy of those options stored in its kw attribute. The following code fragment demonstrates how to read two pedigree files using the same dictionary of options.

options = {}
options['messages'] = 'verbose'
options['renumber'] = 0
options['counter'] = 5

if __name__ == '__main__':
#   Read the first pedigree
    options['pedfile'] = 'new_lacy.ped'
    options['pedformat'] = 'asd'
    options['pedname'] = 'Lacy Pedigree'
    example1 = pyp_newclasses.loadPedigree(options)
#   Read the second pedigree
    options['pedfile'] = 'new_boichard.ped'
    options['pedformat'] = 'asdg'
    options['pedname'] = 'Boichard Pedigree'
    example2 = pyp_newclasses.loadPedigree(options)
Note that pedformat only needs to be changed if the two pedigrees have different formats. Only pedfile has to be changed at all.

All pedigree options other than pedfile and pedformat have default values. If you provide a value that is invalid the option will revert to the default. In most cases, a message to that effect will also be placed in the log file.

Options for controlling PyPedal. Option & Default & Note(s)

\begin{xtabular}
% latex2html id marker 674
{l\vert l\vert p{4in}}
alleles\_sep...
...! Careless use of this option can lead to erroneous results. \\
\end{xtabular}



Subsections
See About this document... for information on suggesting changes.