Given the genotype matrix
bim table (as they are parsed by
read_plink(), this outputs a matrix of the same dimensions as
X but with the numeric codes (all values in 0, 1, 2) translated to human-readable character codes (such as 'A/A', 'A/G', 'G/G', depending on which are the two alleles at the locus as given in the
bim table, see return value).
The genotype matrix.
It must have values only in 0, 1, 2, and
The variant table.
It is required to have the same number of rows as
The genotype matrix reencoded as strings.
At one locus, if the two alleles (ref and alt) are 'A' and 'B', then the genotypes in the input are encoded as characters as: 0 -> 'B/B', 1 -> 'B/A', and 2 -> 'A/A'.
Thus, the numeric encoding counts the reference allele dosage.
NA values in input
NA in the output.
If the input genotype matrix had row and column names, these are inherited by the output matrix.
1 2 3 4 5 6 7 8 9 10
# a numeric/dosage genotype matrix with two loci (rows) # and three individuals (columns) X <- rbind( 0:2, c(0, NA, 2) ) # corresponding variant table (minimal case with just two required columns) library(tibble) bim <- tibble( ref = c('A', 'G'), alt = c('C', 'GT') ) # genotype matrix translated as characters X_char <- geno_to_char( X, bim ) X_char
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.