filterBySharedRegions {BiSeq} | R Documentation

## Reduces a `BSraw` or `BSrel` object to regions (or single CpGs) shared by a fraction of samples

### Description

This method determines the regions which are covered in a given fraction of samples and reduces the `BSraw` or `BSrel` object to these regions.

### Usage

    filterBySharedRegions(object, groups, perc.samples, no.samples, minCov)

### Arguments

`object` | A `BSraw` or `BSrel` object.
`groups` | OPTIONAL. A factor specifying two or more groups within the given object. See Details.
`perc.samples` | A numeric vector with elements between 0 and 1 of length 1 or of the same length as levels in group. Default is 1.
`no.samples` | Alternative to `perc.samples`. An integer vector of length 1 or of the same length as levels in group.
`minCov` | A numeric: If `object` is a `BSraw` object the minimum coverage may be set. Default is 1.

### Details

If argument `group` is given `perc.samples` or `no.samples` are applied for all group levels.

### Value

An object of the same class as `object` storing methylation information solely for regions or single CpGs covered in at least `round(perc.samples*ncol(object))` samples, if `perc.samples` is given. Alternatively, the number of samples can be given directly by using `no.samples`.

### Author(s)

Katja Hebestreit

### See Also

`filterByCov`

### Examples

    data(rrbs)
    rrbs.reduced <- filterBySharedRegions(object = rrbs, perc.samples = 1)

    # Or filter CpG sites where at least 50% of cancer and 50% of normal samples have coverage:
    rrbs.reduced <- filterBySharedRegions(object=rrbs, groups = colData(rrbs)$group,
                                          perc.samples = 0.5)

[Package BiSeq version 1.26.0 Index]