eventsFilter: Filter the RangedSummarizedExperiment objects

View source: R/eventsFilter.R

eventsFilterR Documentation

Filter the RangedSummarizedExperiment objects

Description

A helper function to subset the counts object outputed by count5ends.

Usage

eventsFilter(se, filter)

Arguments

se

An RangedSummarizedExperiment object. Outputs of count5ends.

filter

An expression which, when evaluated in the context of assays(se), is a logical vector indicating elements or rows to keep. The expression results for each assay will be combined and use 'or' operator to filter the counts assays.

Value

A RangedSummarizedExperiment object with assays of count matrix with bindingSites, proximalRegion and distalRegion as column names and bindingSites GRanges object as rowRanges.

Author(s)

Jianhong Ou

Examples

bam <- system.file("extdata",
                   "KD.shift.rep1.bam",
                   package="ATACseqTFEA")
bsl <- system.file("extdata", "bindingSites.rds",
                   package="ATACseqTFEA")
bindingSites <- readRDS(bsl)
## get the count regions
bsEx <- expandBindingSites(bindingSites)
## count reads by 5'ends
res <- count5ends(bam, bindingSites=bindingSites,
                  bindingSitesWithGap=bsEx$bindingSitesWithGap,
                  bindingSitesWithProximal=bsEx$bindingSitesWithProximal,
                  bindingSitesWithProximalAndGap=
                      bsEx$bindingSitesWithProximalAndGap,
                  bindingSitesWithDistal=bsEx$bindingSitesWithDistal)
eventsFilter(res, proximalRegion>0)
eventsFilter(res, seqnames(res)=="chr1")
eventsFilter(res, sample(c(TRUE, FALSE), length(res), replace=TRUE))
eventsFilter(res, "proximalRegion>0")
filter <- "proximalRegion>0"
eventsFilter(res, filter)
filter <- sample(c(TRUE, FALSE), length(res), replace=TRUE)
eventsFilter(res, filter)

jianhong/ATACseqTFEA documentation built on May 8, 2024, 2:06 a.m.