View source: R/adegenet_DT2genX.R
adegenet_DT2genX | R Documentation |
For a data table with samples and loci as rows (long-format data table),
create a genind/genlight object, as per the adegenet
package
(Jombart 2011 Bioinformatics). Data must be biallelic SNPs.
adegenet_DT2genX(
dat,
genX,
sampCol = "SAMPLE",
locusCol = "LOCUS",
genoCol = "GT",
popCol = NULL
)
dat |
Data.table: Contains samples and loci in rows, with a
separate column endcoding genotypes, where each allele is separated
by a '/', or as a count of ref alleles (0, 1 or 2). Assumes biallelic loci.
Code missing data as './.' for characters, and |
genX |
Character: One of |
sampCol |
Character: Column with sample information. Default = |
locusCol |
Character: Column with locus information. Default = |
genoCol |
Character: Column with genotype information. Default = |
popCol |
Character: Column with population information. Optional. Default is NULL. |
A genind
object, with the slot pop
slot filled if argumnet
popCol
is specified.
Jombart (2008) adegenet 1.3-1: new tools for the analysis of genome-wide SNP data. Bioinformatics.
library(genomalicious)
data(data_Genos)
data_Genos
# Genind without and with populations
adegenet_DT2genX(data_Genos, genX='genind')
adegenet_DT2genX(data_Genos, genX='genind', popCol='POP')
# Genlight without and with populations
adegenet_DT2genX(data_Genos, genX='genlight')
adegenet_DT2genX(data_Genos, genX='genlight', popCol='POP')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.