This function may be used to convert phased genotype data for diplod organisms into a sparse matrix.
genos2sparseMatrix(genotypes)
A dataframe or matrix of genotypes. The columns of genotypes
are assumed to be individuals (i.e. a diploid human) and the rows are assumed to be mutations. See details.
A sparseMatrix. Note that the rows and columns of the returned matrix have been transposed so that individual haplotypes are rows, and each column represents an SNV.
The columns of genotypes
are assumed to be individuals (i.e. a diploid human) and the rows are assumed to be mutations. Thus, the (i,j)th entry of genotypes
is the genotype of the jth person at the ith SNV site. Please note that genotypes
should not contain missing values. Additionally, genotypes may take one of the following three forms:
"0|0" if the individual is homozygous for the reference allele,
"0|1" or "0|1" if the individual is heterozygous for the alternate allele,
"1|1" if the individual is homozygous for the alternate allele.