Size: 3361
Comment:
|
Size: 6608
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 41: | Line 41: |
Validation method I is taken care by the program ''trendtest1.py. ''The program reads in three files: File305_POPBRD (a control file sent by ITBC, see APPENDIX Ia) File300_POPBRD (alias file01x, see APPENDIX Ib) and file300FL_POPBRD (a new file following the same format as file300 but pertaining to first lactations only, see APPENDIX Ib). In order to make the file format transition as smooth as possible, the program ''ttconvert1.py'' will take care to convert the legacy file format 01x into the new file format300 | Validation method I is taken care by the program ''trendtest1.py. ''The program reads in three files: File305_POPBRD (a control file sent by ITBC, see APPENDIX Ia) File300_POPBRD (alias file01x, see APPENDIX Ib) and file300FL_POPBRD (a new file following the same format as file300 but pertaining to first lactations only, see APPENDIX Ib). In order to make the file format transition as smooth as possible, the program ''ttconvert1.py'' will take care to convert the legacy file format 01x into the new file format300_POPBRD. === TTCONVERT1.PY === The program is located in the ''programs'' directory. Typing . '''python26 ttconvert1.py --help''' will give you a small summary of the program usage: {{{ usage: ttconvert1.py [-h] [-v] [-s SUFFIX] [-e ENCODING] [-o OUTDIR] brd pop datadir positional arguments: brd evaluation breed code (BSW/GUE/JER/HOL/RDC/SIM) pop population code (same as country code except for CHR/DEA/DFS/FRR/FRM) datadir absolute or relative path to data files optional arguments: -h, --help show this help message and exit -v, --verbose increase output verbosity -s SUFFIX, --suffix SUFFIX suffix to add to all input file names, eg. ".usa" if file names are like file010.usa (default=none) -e ENCODING, --encoding ENCODING input file encoding (default=utf-8; try also iso-8859-1 or other values listed at http://docs.python.org/2/library/codecs.html#standard- encodings) -o OUTDIR, --outdir OUTDIR directory for output files (default=DATADIR) }}} '''Warning''': * FILE NAME: file01x.cou (for all lactations) and file01xFL.cou (for first lactation), for example: file010.can and file010FL.can, any other names will make the program to crash. * ENCODING: the files are expected to be in utf-8 * OLD FILE FORMAT: the file format for the file01x.cou and file01xFL.cou needs to follow exactly the format reported in our webpage http://interbull2.slu.se/www/v1/index.php?option=com_content&view=article&id=55&Itemid=161 '''How to run the program:''' Go to the ''programs'' directory and type: . python26 ttconvert1.py -v -s'.abc' hol abc ../testing/abc1401 In this example * python version used is 2.6 * s'.abc' = the suffix of the population 'abc' is added to input files * breed of evaluation is HOL * population is ABC * input/output files are located in directory ../testing/abc1401 === TRENDTEST1.PY === Typing . '''python26 ttconvert1.py --help''' within the ''programs'' directory will give you a small summary of the program usage: {{{ usage: trendtest1.py [-h] [-v] [-c CONTROLFILE] [-m] [-M MERGEDIR] brd pop datadir positional arguments: brd evaluation breed code (BSW/GUE/JER/HOL/RDC/SIM) pop population code (same as country code except for CHR/DEA/DFS/FRR/FRM) datadir absolute or relative path to data files optional arguments: -h, --help show this help message and exit -v, --verbose increase output verbosity -c CONTROLFILE, --controlfile CONTROLFILE path/name of the control file (default=DATADIR/file305_POPBRD) -m, --mergefiles write merged data files (for independent data checks) -M MERGEDIR, --mergedir MERGEDIR absolute or relative path for merged data files (default=DATADIR/merged1) }}} |
TrendTest Software
The trend validation procedures are described in the Interbull Code of Practice, https://wiki.interbull.org/public/CoPAppendixIII?action=print.
Contents
This software consists of two programs to convert legacy file formats to new formats (ttconvert1/3.py), three programs to perform trend validation by methods 1 - 3 (trendtest1-3.py), a program to combine the results across methods and prepare a zip file ready for submission to the Interbull Center (ttzip.py), and utility module used by those programs (ibutils.py). The conversion programs will process sets of legacy files (file01x and file04x) for all trait groups for a single breed and population of evalution and create a single set of files in a trait independent format. The remaining programs will perform the trend validation tests for all traits for one breed and population and then create a zip file with the input and output files, ready for submission to the Interbull Centre.
Note: In the future, organizations may prefer to prepare the data for the trendtest1-3.py programs directly, bypassing the creation of the legacy file formats and the use of the ttconvert1/3.py programs.
Installation and testing
The programs have been tested under Python 2.6, 2.7, 3.2 and 3.3. As a minimum you will need to have these extra python modules installed on your system: NumPy and, just for Python 2.6, argparse.
Download the attached trendtest20131017.zip file.
Create a working directory and unzip the zip file in that directory. Two subdirectories will be created, programs and sample_data. Typing, for example,
python26 trendtest1.py --help
from a command line prompt, from within the programs directory, should print a brief help message if the installation has been successful.
Some sample data for breed HOL and population ABC are available in the sample_data directory. The two programs for method 1 can be run from the programs directory as follows:
python ttconvert1.py -v -s'.abc' hol abc ../sample_data python trendtest1.py -v -m hol abc ../sample_data
In this example data, parameters and output are all in the sample_data directory. Files can be read from other locations and output written to other locations as well. Please see the following sections for further information.
The outputs should match those in the source zip file.
Detailed descriptions of the single programs are given in the following sections.
Validation Method I
Definition: Comparison of genetic trends estimated using only first lactation versus all lactations in the routine national genetic evaluations.
Validation method I is taken care by the program trendtest1.py. The program reads in three files: File305_POPBRD (a control file sent by ITBC, see APPENDIX Ia) File300_POPBRD (alias file01x, see APPENDIX Ib) and file300FL_POPBRD (a new file following the same format as file300 but pertaining to first lactations only, see APPENDIX Ib). In order to make the file format transition as smooth as possible, the program ttconvert1.py will take care to convert the legacy file format 01x into the new file format300_POPBRD.
TTCONVERT1.PY
The program is located in the programs directory. Typing
python26 ttconvert1.py --help
will give you a small summary of the program usage:
usage: ttconvert1.py [-h] [-v] [-s SUFFIX] [-e ENCODING] [-o OUTDIR] brd pop datadir positional arguments: brd evaluation breed code (BSW/GUE/JER/HOL/RDC/SIM) pop population code (same as country code except for CHR/DEA/DFS/FRR/FRM) datadir absolute or relative path to data files optional arguments: -h, --help show this help message and exit -v, --verbose increase output verbosity -s SUFFIX, --suffix SUFFIX suffix to add to all input file names, eg. ".usa" if file names are like file010.usa (default=none) -e ENCODING, --encoding ENCODING input file encoding (default=utf-8; try also iso-8859-1 or other values listed at http://docs.python.org/2/library/codecs.html#standard- encodings) -o OUTDIR, --outdir OUTDIR directory for output files (default=DATADIR)
Warning:
- FILE NAME: file01x.cou (for all lactations) and file01xFL.cou (for first lactation), for example: file010.can and file010FL.can, any other names will make the program to crash.
- ENCODING: the files are expected to be in utf-8
OLD FILE FORMAT: the file format for the file01x.cou and file01xFL.cou needs to follow exactly the format reported in our webpage http://interbull2.slu.se/www/v1/index.php?option=com_content&view=article&id=55&Itemid=161
How to run the program:
Go to the programs directory and type:
- python26 ttconvert1.py -v -s'.abc' hol abc ../testing/abc1401
In this example
- python version used is 2.6
- s'.abc' = the suffix of the population 'abc' is added to input files
- breed of evaluation is HOL
- population is ABC
- input/output files are located in directory ../testing/abc1401
TRENDTEST1.PY
Typing
python26 ttconvert1.py --help
within the programs directory will give you a small summary of the program usage:
usage: trendtest1.py [-h] [-v] [-c CONTROLFILE] [-m] [-M MERGEDIR] brd pop datadir positional arguments: brd evaluation breed code (BSW/GUE/JER/HOL/RDC/SIM) pop population code (same as country code except for CHR/DEA/DFS/FRR/FRM) datadir absolute or relative path to data files optional arguments: -h, --help show this help message and exit -v, --verbose increase output verbosity -c CONTROLFILE, --controlfile CONTROLFILE path/name of the control file (default=DATADIR/file305_POPBRD) -m, --mergefiles write merged data files (for independent data checks) -M MERGEDIR, --mergedir MERGEDIR absolute or relative path for merged data files (default=DATADIR/merged1)