Adds pairs of rows of a matrix to convert a haplotype matrix to a genotype matrix. For example, rows 1 and 2 are added to create row 1 of the output matrix. Rows 3 and 4 are added to create row 2 of the output matrix, and so on.
haps_to_gen(H)
H | An array with an even length in the first dimension. |
---|
An array of the same dimension as H, with the first dimension half as long.
This function can also handle general arrays. It assumes that the first dimension indexes the haplotypes.