pyp_newclasses contains the new class structure that will be a part of PyPedal 2.0.0Final. It includes a master class to which most of the computational routines will be bound as methods, a NewAnimal() class, and a PedigreeMetadata() class.
NewAMatrix provides an instance of a numerator relationship matrix as a Numarray array of floats with some convenience methods.
For more information about this class, see The NewAMatrix Class.
The NewAnimal() class is holds animals records read from a pedigree file.
For more information about this class, see The NewAnimal Class.
The NewPedigree class is the main data structure for PyP 2.0.0Final.
For more information about this class, see The NewPedigree Class.
The PedigreeMetadata() class stores metadata about pedigrees.
For more information about this class, see The PedigreeMetadata Class.
NewAMatrix provides an instance of a numerator relationship matrix as a Numarray array of floats with some convenience methods. The idea here is to provide a wrapper around a NRM so that it is easier to work with. For large pedigrees it can take a long time to compute the elements of A, so there is real value in providing an easy way to save and retrieve a NRM once it has been formed.
__init__() initializes a NewAMatrix object.
form_a_matrix() calls pyp_nrm/fast_a_matrix() or pyp_nrm/fast_a_matrix_r() to form a NRM from a pedigree.
info() uses the info() method of Numarray arrays to dump some information about the NRM. This is of use predominantly for debugging.
load() uses the Numarray Array Function "fromfile()" to load an array from a binary file. If the load is successful, self.nrm contains the matrix.
printme() prints the NRM to the screen.
save() uses the Numarray method "tofile()" to save an array to a binary file.
The NewAnimal() class is holds animals records read from a pedigree file.
__init__() initializes a NewAnimal() object.
pad_id() takes an Animal ID, pads it to fifteen digits, and prepends the birthyear (or 1950 if the birth year is unknown). The order of elements is: birthyear, animalID, count of zeros, zeros.
printme() prints a summary of the data stored in the Animal() object.
string_to_int() takes an Animal/Sire/Dam ID as a string and returns a string that can be represented as an integer by replacing each character in the string with its corresponding ASCII table value.
stringme() returns a summary of the data stored in the Animal() object as a string.
trap() checks for common errors in Animal() objects
The NewPedigree class is the main data structure for PyP 2.0.0Final.
__init__() initializes a NewPedigree object.
load() wraps several processes useful for loading and preparing a pedigree for use in an analysis, including reading the animals into a list of animal objects, forming lists of sires and dams, checking for common errors, setting ancestor flags, and renumbering the pedigree.
preprocess() processes a pedigree file, which includes reading the animals into a list of animal objects, forming lists of sires and dams, and checking for common errors.
printoptions() prints the contents of the options dictionary.
renumber() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.
save() writes a PyPedal pedigree to a user-specified file. The saved pedigree includes all fields recognized by PyPedal, not just the original fields read from the input pedigree file.
updateidmap() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.
The PedigreeMetadata() class stores metadata about pedigrees. Hopefully this will help improve performance in some procedures, as well as provide some useful summary data.
__init__() initializes a PedigreeMetadata object.
fileme() writes the metada stored in the Pedigree() object to disc.
nud() returns the number of unique dams in the pedigree along with a list of the dams
nuf() returns the number of unique founders in the pedigree along with a list of the founders
nug() returns the number of unique generations in the pedigree along with a list of the generations
nuherds() returns the number of unique herds in the pedigree along with a list of the herds.
nus() returns the number of unique sires in the pedigree along with a list of the sires
nuy() returns the number of unique birthyears in the pedigree along with a list of the birthyears
printme() prints a summary of the metadata stored in the Pedigree() object.
stringme() returns a summary of the metadata stored in the pedigree as a string.