Pramod Mathur
Canadian Centre for Swine Improvement (CCSI)
This document briefly describes the procedure for estimating connectedness as used for the Canadian Swine Improvement Program and described by Mathur et. al. . The procedure described here starts with the mixed model equations (MME) e.g. for an animal model that includes fixed effects of herds or contemporary groups you are interested in. The equations also include several other fixed or random effects including the animal genetic effects. These need to be created with the program you commonly use for the genetic evaluations. There are two main steps: a) calculating inverse elements of the rows and columns corresponding to the herd effects from the mixed model equations and b) calculating connectedness rating (CR) using these inverse elements.
What you need to do:
1. Click here to download a zip file containing the executables. This also contains some of the commonly used UNIX utilities such as 'head', 'tail', 'paste' etc. that are also required to run these programs.
2. Unzip the contents of the zip file in a directory E.g.: c:\connectedness
3. Open a Command prompt window (Start ->Programs->Accessories->Command prompt)
4. Change to the directory where you have the downloaded programs: (e.g. cd c:\connectedness)
5. Create the necessary files in an ASCII text format (E.g. mme.txt
). This is a very small example of a SPARSE matrix file that describes
the rows, columns and the non zero elements of the matrix. If the original
matrix is not in the SPARSE format you may convert a file from the original
format to this sparse matrix file using the program d2s by using the
following command:.
d2s mme_org.txt mme.txt
6. Create a file indicating the sequential number of rows corresponding to the herd effects you are interested. For example if the herd effects are in rows 2,3, and 5 of the mixed model equations the file should contain these row numbers (E.g. rows.txt ).
7. Enter the name of the program to get the syntax. For example, the
program for computing the inverse elements of a block of a large matrix
is called (E.g. binv). If you enter binv at the command prompt, it
will give you the following syntax:
binv (matrix file) (rows file) (output file) (number of
iterations)
A word of caution: The program uses an iterative procedure and can take a long time depending upon the number of herds, number of iterations and size of the matrix of mixed model equations. First try with a small example similar to one given here that would run is few seconds and then try large set. You might need a lot of patience while it is running also depending upon the speed of your computer. For example, it may take up to 10 minutes for each herd if you had about 400,000 equations and you use 1000 rounds of iterations on a Pentium III computer..
8. Run the program using the appropriate syntax.
For example: binv mme.txt rows.txt binv_out.txt 1000
You will get :
binv_out.txt : A matrix file containing
the inverse elements of the desired block
8. Now you need to run the program calculate_cr using the output file from binv. The syntax is:
calculate_cr (file of inverse elements) (file of group ids) (output file)
For example: calculate_cr binv_out.txt rows.txt cr_out.txt
You will get a file containing the connectedness rating of each herd
with all others. E. g. cr_out.txt
You may also use a file of corresponding herd identifications e.g. herds.txt:
For example: calculate_cr binv_out.txt herds.txt cr_out.txt
You will get a file containing the connectedness rating of each herd
with all others with the herd numbers. E. g. cr_out_herd.txt
More programs for similar matrix operations are available at: http://www.ccsi.ca/abtk/
The information and documentation of the programs is not complete. However, the programs that we complied for our own use are made available for those who are interested. So, use them at your own risk and have fun...!
If you need more help contact pramod@ccsi.ca