PyPedal::pyp_newclasses::NewPedigree Class Reference

The NewPedigree class is the main data structure for PyP 2.0.0Final. More...

Collaboration diagram for PyPedal::pyp_newclasses::NewPedigree:

Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
 __init__() initializes a NewPedigree object.
def load
 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.
def save
 save() writes a PyPedal pedigree to a user-specified file.
def savegraph
 savegraph() save a pedigree to a file as an adjacency list.
def savegedcom
 savegedcom() save a pedigree to a file in GEDCOM 5.5 format.
def savedb
 savedb() saves a pedigree to a database table in ASDx format for NewAnimals and LightAnimals.
def preprocess
 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.
def fromgraph
 fromgraph() loads the animals to populate the pedigree from an XDiGraph object.
def tostream
 tostream() creates a text stream from a pedigree.
def renumber
 renumber() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.
def addanimal
 addanimal() adds a new animal of class NewAnimal to the pedigree.
def delanimal
 delanimal() deletes an animal from the pedigree.
def updateidmap
 updateidmap() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.
def printoptions
 printoptions() prints the contents of the options dictionary.
def simulate
 simulate() simulates an arbitrary pedigree of size n with g generations starting from n_s base sires and n_d base dams.

Public Attributes

 kw
 pedigree
 metadata
 idmap
 backmap
 namemap
 nrm
 namebackmap

Static Public Attributes

string format = '%(asctime)s %(levelname)-8s %(message)s'
string datefmt = '%a, %d %b %Y %H:%M:%S'
list filename = self.kw['logfile']
string filemode = 'w'


Detailed Description

The NewPedigree class is the main data structure for PyP 2.0.0Final.

Definition at line 39 of file pyp_newclasses.py.


Member Function Documentation

def PyPedal::pyp_newclasses::NewPedigree::__init__ (   self,
  kw = {},
  kwfile = 'pypedal.ini' 
)

__init__() initializes a NewPedigree object.

Parameters:
self Reference to the current NewPedigree() object
kw A dictionary of options.
kwfile An optionsl configuration file name
Returns:
An instance of a NewPedigree() object object
__init__() initializes a NewPedigree object.

Definition at line 47 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::load (   self,
  pedsource = 'file',
  pedgraph = 0,
  pedstream = '' 
)

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.

Parameters:
pedsource Source of the pedigree ('file'|'graph'|'graphfile'|'db').
pedgraph XDiGraph from which to load the pedigree.
Returns:
None None
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.

Definition at line 239 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::save (   self,
  filename = '',
  outformat = 'o',
  idformat = 'o' 
)

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.

Parameters:
filename The file to which the pedigree should be written.
outformat The format in which the pedigree should be written: 'o' for original (as read) and 'l' for long version (all available variables).
idformat Write 'o' (original) or 'r' (renumbered) animal, sire, and dam IDs.
Returns:
A save status indicator (0: failed, 1: success) integer
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.

Definition at line 436 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::savegraph (   self,
  pedoutfile = 0,
  pedgraph = 0 
)

savegraph() save a pedigree to a file as an adjacency list.

Parameters:
pedoutfile Name of the file to which the graph is written
pedgraph Graph object
Returns:
None None
Preprocess a pedigree file, which includes reading the animals into a list, forming lists of sires and dams, and checking for common errors.

Definition at line 534 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::savegedcom (   self,
  pedoutfile = 0 
)

savegedcom() save a pedigree to a file in GEDCOM 5.5 format.

Parameters:
pedoutfile Name of the file to which the graph is written
Returns:
None None
Preprocess a pedigree file, which includes reading the animals into a list, forming lists of sires and dams, and checking for common errors.

Definition at line 557 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::savedb (   self,
  drop = False 
)

savedb() saves a pedigree to a database table in ASDx format for NewAnimals and LightAnimals.

Parameters:
drop Boolean indicating if existing data should be kept (False) or deleted (True); the default is False.
Returns:
_savedb_status Boolean indicating if the pedigree was successfully saved Boolean
savedb() saves a pedigree to a database table in ASDx format
for NewAnimals and LightAnimals.

Definition at line 575 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::preprocess (   self,
  textstream = '',
  dbstream = '' 
)

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.

Parameters:
textstream String containing animal records
dbstream List of tuples of animal records
Returns:
None None
Preprocess a pedigree file, which includes reading the animals into a list, forming lists of sires and dams, and checking for common errors.

Definition at line 649 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::fromgraph (   self,
  pedgraph 
)

fromgraph() loads the animals to populate the pedigree from an XDiGraph object.

Parameters:
pedgraph 
Returns:
None None
fromgraph() loads the animals to populate the pedigree from an
XDiGraph object.

Definition at line 1032 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::tostream (   self  ) 

tostream() creates a text stream from a pedigree.

XDiGraph object.

Parameters:
pedgraph 
Returns:
None None
tostream() creates a text stream from a pedigree.

Definition at line 1066 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::renumber (   self  ) 

renumber() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.

Parameters:
None 
Returns:
None None
renumber() updates the ID map after a pedigree has been renumbered so that all
references are to renumbered rather than original IDs.

Definition at line 1096 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::addanimal (   self,
  animalID,
  sireID,
  damID 
)

addanimal() adds a new animal of class NewAnimal to the pedigree.

Parameters:
@return 1 on success, 0 on failure integer

Definition at line 1131 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::delanimal (   self,
  animalID 
)

delanimal() deletes an animal from the pedigree.

Note that this method DOES not update the metadata attached to the pedigree and should only be used if that is not important. As of 04/10/2006 delanimal() is intended for use by pyp_metrics/mating_coi() rather than directly by users.

Parameters:
animalID ID of the animal to be deleted
Returns:
1 on success, 0 on failure integer

Definition at line 1207 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::updateidmap (   self  ) 

updateidmap() updates the ID map after a pedigree has been renumbered so that all references are to renumbered rather than original IDs.

Parameters:
None 
Returns:
None None
updateidmap() updates the ID map after a pedigree has been renumbered so that
all references are to renumbered rather than original IDs.

Definition at line 1229 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::printoptions (   self  ) 

printoptions() prints the contents of the options dictionary.

Parameters:
None 
Returns:
None None
printoptions() prints the contents of the options dictionary.

Definition at line 1262 of file pyp_newclasses.py.

def PyPedal::pyp_newclasses::NewPedigree::simulate (   self  ) 

simulate() simulates an arbitrary pedigree of size n with g generations starting from n_s base sires and n_d base dams.

This method is based on the concepts and algorithms in the Pedigree::sample method from Matvec 1.1a. The arguments are read from the pedigree object's options dictionary.

Parameters:
None 
Returns:
None None
Simulate simulates an arbitrary pedigree of size n with g generations
starting from n_s base sires and n_d base dams.  This method is based
on the concepts and algorithms in the Pedigree::sample method from
Matvec 1.1a (src/classes/pedigree.cpp), although all of the code in
this implementation was written from scratch.

Definition at line 1282 of file pyp_newclasses.py.


The documentation for this class was generated from the following file:

Generated on Thu May 1 12:33:44 2008 for PyPedal by  doxygen 1.5.5