Flip alleles in a minor-allele dosage matrix
flip_alleles(genmat, snps = "rows")
A numeric matrix of SNPs x individuals, with SNPs encoded as 0, 1, 2. Can be in either orientation (SNPs x individuals or individuals x SNPs)
Either "rows" to indicate that SNPs are in rows and individuals are in columns, or "cols" to indicate the SNPs are in columns and individuals are in rows
SNP data is often stored in numeric matrices in minor-allele dosage format, where 0 indicates no copies of the minor allele (i.e. homozygous for the major allele), 1 indicates 1 copy of the minor allele (i.e. heterozygous), and 2 indicates 2 copies of the minor allele (i.e. homozygous for the minor allele). However, there are situations in which the alleles get "flipped" between major vs. minor (e.g. when subsetting or filtering genotypic data). In addition, SNPs may be numerically encoded in various ways, e.g. by encoding the allele in the reference genome as 0, and the alternate allele as 2. flip_alleles() is intended to selectively "flip" SNPs into the proper minor-allele dosage orientation.
List containing the following elements:
dosmat - NumericSNP matrix in minor-allele dosage format
flipped_loci - Vector listing markers for which alleles were flipped
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.