Description Usage Arguments Value Examples
View source: R/genotype_coding.R
recode_snps
recodes the elements of a SNP-matrix
1 2 | recode_snps(x, major, minor, major_coding, minor_coding, het_coding,
missing_value, na_coding)
|
x |
A matrix. Genotype names are stored in rows whereas marker names are stored in columns. |
major |
Character vector with names of major genotype at each locus. |
minor |
Character vector with names of minor genotype at each locus. |
major_coding |
Scalar specifying how to recode the major genotype. |
minor_coding |
Scalar specifying how to recode the minor genotype. |
het_coding |
Scalar specifying how to recode heterozygous loci. |
missing_value |
Scalar specifying how missing values are encoded in |
na_coding |
Scalar specifying how to recode missing values. |
A matrix with the same dimensions as x
but with recoded SNP
genotypes.
1 2 3 4 5 6 7 8 9 10 11 | # First, determine the major and minor allele at each locus of SNP-genotypes
geno_lst <- compute_maf(marker_character, output = "geno_list",
missing_value = "??", maf_threshold = 0)
major <- geno_lst[["major_genotype"]]
minor <- geno_lst[["minor_genotype"]]
# Recode the major allele as '2', the minor allele as '0' and heterozygotes
# as '0'.
recode_snps(marker_character, major = major, minor = minor,
major_coding = 2, minor_coding = 0, het_coding = 1,
missing_value = "??", na_coding = NA_real_)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.