Legofit
infers population history from nucleotide site patterns.
resid

Print site pattern frequencies or residuals.

Author
Alan R. Rogers

<tt>resid</tt>: print site pattern frequencies or residuals

This program reads a list of data files (containing site pattern frequencies) and (optionally) another list of .legofit files (containing estimates as generated by legofit). The .legofit files, if any, should be listed in the same order as the data files, so that the i'th .legofit file describes the output generated from the i'th data file. If there are no .legofit files, resid prints a table of site pattern frequencies, in which the i'th row refers to the i'th site pattern, and the j'th column to the j'th data set. If .legofit files are provided, the program prints residuals, calculated by subtracting fitted frequencies from observed ones. If .legofit files are provided, columns are labeled with their names, after stripping suffixes and leading pathnames. Otherwise, column labels are based on the names of data files.

Optionally, the user can specify a colon-separated list of population labels to delete from the output:

resid data.opf -D x:y

In addition, the user can specify one or more remappings, each of which tells resid to collapse several populations into a single population. For example,

resid data.opf -L data.legofit -M n=a:v r=n:x

would calculate residuals assuming that data.opf contains observed pattern frequencies, and data.legofit contains fitted values, as produced by legofit. Before producing output, it would apply two remappings. First, populations "a" and "v" would be collapsed into a single population called "n". Then, "n" and "x" would be pooled into "r". The labels "n" and "r" must not be present in the original data.

Note that the second remapping remaps "n", which was defined in the first. This is legal, but it would not work if the two remappings had been listed in opposite order. The labels listed on the right side of a remapping must be defined previously, either in the original data or in a previous remapping.

Deletions are applied before remappings, so it is illegal to remap labels that have been deleted using -D.

It is also possible to list multiple sets of data and .legofit files. For example,

resid data.opf boot/boot*.opf -L b2.legofit b2boot*.legofit

This would generate a column for each pair of .opf/.legofit files.