C. GENES File Handling

PyPedal is capable of importing from, and exporting to, the dBase III file format used by Robert Lacy's GENES 1.20 program (http://www.vortex9.org/genes.html). The code that does the actual conversion is a modified version of "Recipe 362715: DBF reader and writer (Python)" (http://code.activestate.com/recipes/362715/) by Raymond Hettinger. The changes I've made were mostly mappings between GENES and PyPedal variables, as well as some code to catch potential errors on the inputs and outputs. It is my understanding that the PSF under which Hettinger's code was released is compatible with the GPL, under which PyPedal is licensed.

As one might expect, PyPedal supports only a subset of the data contained in a GENES studbook file. That is because some of the metrics calculated by GENES do not have corresponding quantities in PyPedal. (Table C.1). It's important to note that PyPedal's GENES import and export is lossy! This means that information in a GENES file is lost when importing the file, and data from PyPedal pedigrees are lost when exporting.

GENES 1.20 data records and tags exported by PyPedal. Data Field & PyPedal Variable & DescriptionC.1

\begin{xtabular}{l\vert p{1in}\vert p{3in}}
STUD ID & animalID & Alphanumeric a...
...a & Coefficient of inbreeding \\
AGE & age & Age of animal \\
\end{xtabular}
Some tags have slightly different connotatios in PyPedal than in GENES. For example, GENES distinguished between animals that are known to be founders (parents are "WILD") and those with unknown parents that are assumed to be from the current population (parents are "UNK"). PyPedal does not make such a distinction, and treats all animals with unknown parents as founders. The default birthdate (01011900) used by PyPedal also may not make particular sense to GENES users.

Importation is done by reading the GENES file and mapping the supported fields to their corresponding PyPedal attributes. Those individual records are then written to a file, the pedigree format string and pedfile variables are updated for the new file, and that file is then loaded automatically. The downside is that you end up with two copies of each pedigree file, but disc space is cheap. I won't add an option for automatic deletion of the original GENES file because of the lossiness of the import procedure.

The export process is uncoupled from the import process. You can export any pedigree that PyPedal can read as a GENES file, regardless of the original source. Claire Raisin (Durrell Institute of Conservation and Ecology, University of Kent) asked for this feature quite a long time ago, and I finally got around to adding it. I hope that late is better than never.



Footnotes

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