seqUnitFilterCond: Filter unit variants

Description Usage Arguments Value Author(s) See Also Examples

View source: R/UnitList.R

Description

Filters out the unit variants according to MAF, MAC and missing rates.

Usage

1
2
seqUnitFilterCond(gdsfile, units, maf=NaN, mac=1L, missing.rate=NaN,
    minsize=1L, parallel=seqGetParallel(), verbose=TRUE)

Arguments

gdsfile

a SeqVarGDSClass object

units

a list of units of selected variants, with S3 class SeqUnitListClass

maf

minimum minor reference allele frequency, or a range of MAF maf[1] <= ... < maf[2]

mac

minimum minor reference allele count, or a range of MAC mac[1] <= ... < mac[2]

missing.rate

maximum missing genotype rate

minsize

the minimum of unit size

parallel

FALSE (serial processing), TRUE (multicore processing), numeric value or other value; parallel is passed to the argument cl in seqParallel, see seqParallel for more details.

verbose

if TRUE, show information

Value

A S3 object with the class name "SeqUnitListClass" and two components (desp and index): the first is a data.frame with columns "chr", "start" and "end", and the second is list of integer vectors (the variant indices).

Author(s)

Xiuwen Zheng

See Also

seqUnitApply, seqUnitFilterCond

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# open the GDS file
gdsfile <- seqOpen(seqExampleFileName("gds"))

unit1 <- seqUnitSlidingWindows(gdsfile)
unit1 # "desp"  "index"

# only rare variants
newunit <- seqUnitFilterCond(gdsfile, unit1, maf=c(0, 0.01))
newunit


# excluded variants
exvar <- setdiff(unique(unlist(unit1$index)), unique(unlist(newunit$index)))

seqSetFilter(gdsfile, variant.sel=exvar)
maf <- seqAlleleFreq(gdsfile, minor=TRUE)
table(maf > 0)
summary(maf[maf > 0])  # > 0.01


# close the GDS file
seqClose(gdsfile)

SeqArray documentation built on Nov. 8, 2020, 5:08 p.m.