allele_uniq_DT: Generate a data table of unique alleles per locus

View source: R/allele_uniq_DT.R

allele_uniq_DTR Documentation

Generate a data table of unique alleles per locus

Description

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.

Usage

allele_uniq_DT(
  dat,
  chromCol = "CHROM",
  posCol = "POS",
  locusCol = "LOCUS",
  refCol = "REF",
  altCol = "ALT"
)

Arguments

dat

Data.table: Long-format data table of variants, e.g., as read in with genomalicious::vcf2DT.

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".

Value

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.

Examples


library(genomalicious)

data(data_Genos)

allele_uniq_DT(data_Genos)


j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.