View source: R/filter_missing_units.R
filter_missing_units | R Documentation |
Parses a data table of genotypes/allele frequencies and returns a list of units (sampled individuals or populations) that conform to a desired missing data threshold.
filter_missing_units(
dat,
missing,
type = "genos",
method = "samples",
sampCol = "SAMPLE",
locusCol = "LOCUS",
popCol = "POP",
genoCol = "GT",
freqCol = "FREQ"
)
dat |
Data table: The must contain the columns:
|
missing |
Numeric: The proportion of missing data a locus, a value between 0 and 1. |
type |
Character: Is |
method |
Character: The method by which missingness filtering is performed.
Only valid when filtering is performed on genotypes ( |
sampCol |
Character: The column name with the sampled individual information.
Default = |
locusCol |
Character: The column name with the locus information.
Default = |
popCol |
Character: The column name with population information.
Default = |
genoCol |
Character: The column name with the genotype information.
Missing genotypes are encoded with an |
freqCol |
Character: The column name with the allele frequency information.
Missing frequencies are encoded with an |
Note, it is assumed that missing data values have already been put is as
an NA
. If this is not done in advance, this function will not produce
the expected results.
If type=='genos'
, then your output will depend on how you
specify the method
argument. If type=='freqs'
, then there is
just one output, those populations with missing data less than the missing
threshold.
Returns a character vector of samples names in dat[[sampCol]]
or
populations in dat[[popCol]]
that conforms to missingness threshold
(<= to the value of missing
).
library(genomalicious)
simMiss <- data_Genos %>% copy()
simMiss$GT[sample(1:nrow(simMiss), 0.1*nrow(simMiss), replace=FALSE)] <- NA
filter_missing_units(simMiss, missing=0.10)
filter_missing_units(simMiss, missing=0.10, method='pops')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.