seqUnitFilterCond {SeqArray} | R Documentation

## Filter unit variants

### Description

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

### Usage

    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

    # 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)

[Package SeqArray version 1.28.1 Index]