View source: R/allele_uniq_DT.R
allele_uniq_DT | R Documentation |
Takes a data.table of variants in long-format and converts to a wide-format data.table of unique alleles. Can be used for multiallelic datasets.
allele_uniq_DT(
dat,
chromCol = "CHROM",
posCol = "POS",
locusCol = "LOCUS",
refCol = "REF",
altCol = "ALT"
)
dat |
Data.table: Long-format data table of variants, e.g., as read in
with |
chromCol |
Character: The column with chromosome information. Default is "CHROM". |
posCol |
Character: The column with position information. Default is "POS". |
locusCol |
Character: The column with locus ID information. Default is "LOCUS". |
refCol |
Character: The column with reference allele information. Default is "REF". |
altCol |
Character: The column with alternate allele information. Default is "ALT". |
Returns a wide-format data table with columns $CHROM
, $POS
,
and $LOCUS
, and multiple $ALLELE.X
columns, where 'X' is the
i-th allele at a locus. The maximum number of allele columns will depend on
whichever locus has the most alleles. Columns with NA indicate absence of an
i-th allele, otherwise, the allele sequence will fill the cell. The reference
allele is $ALLELE.0
, with subsequent columns representing alternate
alleles, e.g., $ALLELE.1
, $ALLELE.2
, etc.
library(genomalicious)
data(data_Genos)
allele_uniq_DT(data_Genos)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.