filter_depth | R Documentation |
Parses a data table of genotypes/allele frequencies and returns a list of loci that conform to a desired read depth threshold.
filter_depth(dat, minDP = NULL, maxDP = NULL, locusCol = "LOCUS", dpCol = "DP")
dat |
Data table: The sequencing read information, must contain the columns:
|
minDP |
Integer: The minimum sequencing depth. Loci below this value are flagged
as 'bad' loci. Default is |
maxDP |
Integer: The maximum sequencing depth. Loci above this value are flagged
as 'bad' loci. Default is |
locusCol |
Character: The column name with the locus information. Default = |
dpCol |
Character: The column with read depth information. Default = |
Returns a character vector of locus names in dat[[locusCol]]
that conform to the read depth threshold (>= value of minDP
and <= value
of maxDP
).
library(genomalicious)
data(data_Genos)
# Exclude loci with coverage < 10 reads
min10 <- filter_depth(data_Genos, minDP=10)
min10
data_Genos[LOCUS %in% min10]$DP %>% summary
# Exclude loci with coverage < 10 and > 100 reads
min10max100 <- filter_depth(data_Genos, minDP=10, maxDP=100)
min10max100
data_Genos[LOCUS %in% min10max100]$DP %>% summary
# Alternatively, subset data.table to only contain the
# bad loci with coverage < 10 reads
data_Genos[!(LOCUS %in% min10)]$DP %>% summary
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.