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).

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(myped, filetag='_pickled_', ainv='') [#]

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

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.

a_matrix_from_file(inputfile) ⇒ matrix [#]

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

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

a_matrix_from_text_file() [#]

a_matrix_from_text_file() is a placeholder. The a_matrix() procedure currently writes A to a text file after A is formed and before the function returns. It would be handy to have a nice procedure to suck that back into an object.

a_matrix_to_file(myped, filetag='_pickled_', a='') [#]

a_matrix_to_file() uses the Python pickle system for persistent objects to write a relationship matrix to a file. This works well for small pedigrees, not so well for large pedigrees; large pedigrees will eat some serious disc space.

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.
save
Flag to indicate whether or not the relationship matrix is written to a file.

dissertation_pedigree_to_file(myped, filetag='_diss') [#]

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

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.

dissertation_pedigree_to_pedig_format(myped, filetag='_diss') [#]

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.

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.

dissertation_pedigree_to_pedig_format_mask(myped, filetag='_diss_mask') [#]

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.

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.

dissertation_pedigree_to_pedig_interest_format(myped, filetag='_diss') [#]

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.

myped
A PyPedal pedigree object.
filetag
A descriptor prepended to output file names.

id_map_from_file(inputfile) ⇒ dictionary [#]

id_map_from_file() reads an ID map from the file generated by pyp_utils/renumber() into a dictionary. There is a VERY similar function, pyp_utils/load_id_map(), that is preferred because it is more robust that this procedure.

inputfile
The name of the file from which the ID map should be read.
Returns:
A dictionary whose keys are renumbered IDs and whose values are original IDs.