Skip to contents

[Stable]

This filters a AnyHermesData object using the default QC flags and required annotations.

Usage

filter(object, ...)

# S4 method for AnyHermesData
filter(object, what = c("genes", "samples"), annotation_required = "size")

# S4 method for data.frame
filter(object, ...)

# S4 method for ts
filter(object, ...)

Arguments

object

(AnyHermesData)
object to filter.

...

additional arguments.

what

(character)
specify whether to apply the filter on genes and / or samples.

annotation_required

(character)
names of required annotation columns for genes. Only used when genes are filtered.

Value

The filtered AnyHermesData object.

Details

  • Only genes without low expression (low_expression_flag) and samples without low depth (low_depth_flag) or technical failure (tech_failure_flag) remain in the returned filtered object.

  • Also required gene annotation columns can be specified, so that genes which are not complete for these columns are filtered out. By default this is the size column, which is needed for default normalization of the object.

Note

The internal implementation cannot use the subset() method since that requires non-standard evaluation of arguments.

Examples

a <- hermes_data
dim(a)
#> [1] 5085   20

# Filter genes and samples on default QC flags.
result <- filter(a)
dim(result)
#> [1] 2064   18

# Filter only genes without low expression.
result <- filter(a, what = "genes")

# Filter only samples with low depth and technical failure.
result <- filter(a, what = "samples")

# Filter only genes, and require certain annotations to be present.
result <- filter(a, what = "genes", annotation_required = c("size"))