The pyp_io Module

pyp_io contains several procedures for writing structures to and reading them from disc (e.g. using pickle() to store and retrieve A and A-inverse). It also includes a set of functions used to render strings as HTML or plaintext for use in generating output files.

Module Contents

a_inverse_from_file(inputfile) ⇒ matrix [#]

a_inverse_from_file() uses the Python pickle system for persistent objects to read the inverse of a relationship matrix from a file.

inputfile
The name of the input file.
Returns:
The inverse of a numerator relationship matrix.

a_inverse_to_file(pedobj, ainv='') ⇒ integer [#]

a_inverse_to_file() uses the Python pickle system for persistent objects to write the inverse of a relationship matrix to a file.

pedobj
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.
Returns:
True (1) on success, false (0) on failure

dissertation_pedigree_to_file(pedobj) ⇒ integer [#]

dissertation_pedigree_to_file() takes a pedigree in 'asdxfg' format and writes is to a file.

pedobj
A PyPedal pedigree object.
Returns:
True (1) on success, false (0) on failure

dissertation_pedigree_to_pedig_format(pedobj) ⇒ integer [#]

dissertation_pedigree_to_pedig_format() takes a pedigree in 'asdbxfg' format, formats it into the form used by Didier Boichard's 'pedig' suite of programs, and writes it to a file.

pedobj
A PyPedal pedigree object.
Returns:
True (1) on success, false (0) on failure

dissertation_pedigree_to_pedig_format_mask(pedobj) ⇒ integer [#]

dissertation_pedigree_to_pedig_format_mask() Takes a pedigree in 'asdbxfg' format, formats it into the form used by Didier Boichard's 'pedig' suite of programs, and writes it to a file. THIS FUNCTION MASKS THE GENERATION ID WITH A FAKE BIRTH YEAR AND WRITES THE FAKE BIRTH YEAR TO THE FILE INSTEAD OF THE TRUE BIRTH YEAR. THIS IS AN ATTEMPT TO FOOL PEDIG TO GET f_e, f_a et al. BY GENERATION.

pedobj
A PyPedal pedigree object.
Returns:
True (1) on success, false (0) on failure

dissertation_pedigree_to_pedig_interest_format(pedobj) ⇒ integer [#]

dissertation_pedigree_to_pedig_interest_format() takes a pedigree in 'asdbxfg' format, formats it into the form used by Didier Boichard's parente program for the studied individuals file.

pedobj
A PyPedal pedigree object.
Returns:
True (1) on success, false (0) on failure

pickle_pedigree(pedobj, filename='') ⇒ integer [#]

pickle_pedigree() pickles a pedigree.

pedobj
An instance of a PyPedal pedigree object.
filename
The name of the file to which the pedigree object should be pickled (optional).
Returns:
A 1 on success, a 0 otherwise.

pyp_file_footer(ofhandle, caller="Unknown PyPedal routine") [#]

pyp_file_footer() writes a footer to a page of PyPedal output.

ofhandle
A Python file handle.
caller
A string indicating the name of the calling routine.
Returns:
None

pyp_file_header(ofhandle, caller="Unknown PyPedal routine") [#]

pyp_file_header() writes a header to a page of PyPedal output.

ofhandle
A Python file handle.
caller
A string indicating the name of the calling routine.
Returns:
None

renderBodyText(text_string) [#]

renderBodyText() renders page contents (produces HTML output by default).

renderTitle(title_string, title_level="1") [#]

renderTitle() renders page titles (produces HTML output by default).

save_ijk(pedobj, nrm_filename) ⇒ integer [#]

save_ijk() saves an NRM to a file in the form "animal A" "animal B" "rAB".

nrm_filename
The file to which the matrix should be written.
Returns:
A save status indicator (0: failed, 1: success).

summary_inbreeding(f_metadata) ⇒ string [#]

summary_inbreeding() returns a string representation of the data contained in the 'metadata' dictionary contained in the output dictionary returned by pyp_nrm/pyp_inbreeding().

f_metadata
Dictionary of inbreeding metadata.
Returns:
A string on success, a 0 otherwise.

unpickle_pedigree(filename='') ⇒ object [#]

unpickle_pedigree() reads a pickled pedigree in from a file and returns the unpacked pedigree object.

filename
The name of the pickle file.
Returns:
An instance of a NewPedigree object on success, a 0 otherwise.