Filter cells

filterCells(object, ...)

# S4 method for SingleCellExperiment
filterCells(object, minCounts = 1L,
  maxCounts = Inf, minFeatures = 1L, maxFeatures = Inf,
  minNovelty = 0L, maxMitoRatio = 1L, minCellsPerFeature = 1L,
  nCells = Inf, countsCol = "nCount", featuresCol = "nFeature",
  noveltyCol = "log10FeaturesPerCount", mitoRatioCol = "mitoRatio")

Arguments

object

Object.

minCounts, maxCounts

integer(1). Minimum/maximum number of counts per cell. Applies to UMI disambiguated counts for droplet scRNA-seq. Matches nUMI then nCount column in colData() internally. Previously named minUMIs/maxUMIs in bcbioSingleCell.

minFeatures, maxFeatures

integer(1). Minimum/maximum number of features (i.e. genes) detected. Matches nFeaturein colData() internally. Previously named minGenes/maxGenes in bcbioSingleCell.

minNovelty

integer(1) (0-1). Minimum novelty score (log10 features per UMI). Matches log10FeaturesPerCount then log10FeaturesPerUMI (legacy) colData() internally.

maxMitoRatio

integer(1) (0-1). Maximum relative mitochondrial abundance.

minCellsPerFeature

integer(1). Include genes with non-zero expression in at least this many cells. Previously named minCellsPerGene in bcbioSingleCell.

nCells

integer(1). Expected number of cells per sample. Don't set this by default, unless you're confident of your capture.

countsCol, featuresCol, noveltyCol, mitoRatioCol

character(1). Column mapping name.

...

Additional arguments.

Value

SingleCellExperiment.

Details

Apply feature (i.e. gene/transcript) detection, novelty score, and mitochondrial abundance cutoffs to cellular barcodes. By default we recommend applying the same filtering cutoff to all samples. The filtering parameters now support per-sample cutoffs, defined using a named numeric vector. When matching per sample, be sure to use the sampleNames() return values (i.e. the sampleName column in sampleData()).

Filtering information gets slotted into metadata() as filterCells metadata.

Note

Updated 2019-11-06.

Examples

data(SingleCellExperiment, package = "acidtest") ## SingleCellExperiment ==== object <- SingleCellExperiment x <- filterCells(object)
#> Calculating 100 sample metrics.
#> 497 coding features detected.
#> 0 mitochondrial features detected.
#> Pre-filter: #> - 100 cells #> - 500 features
#> Post-filter: #> - 100 cells (100%) #> - 485 features (97.0%)
#> Per argument: #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 100 100 100 100 100
#> Per sample, per argument: #> $sample1 #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 49 49 49 49 49 #> #> $sample2 #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 51 51 51 51 51
#> class: SingleCellExperiment #> dim: 485 100 #> metadata(3): date filterCells subset #> assays(1): counts #> rownames(485): gene001 gene002 ... gene498 gene499 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(100): cell001 cell002 ... cell099 cell100 #> colData names(7): sampleID nCount ... log10FeaturesPerCount mitoRatio #> reducedDimNames(0): #> spikeNames(0): #> altExpNames(0):
## Per sample cutoffs. sampleNames(object)
#> sample1 sample2 #> "sample1" "sample2"
x <- filterCells( object = object, minCounts = c(sample1 = 100L) )
#> Calculating 100 sample metrics.
#> 497 coding features detected.
#> 0 mitochondrial features detected.
#> Pre-filter: #> - 100 cells #> - 500 features
#> Post-filter: #> - 100 cells (100%) #> - 485 features (97.0%)
#> Per argument: #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 100 100 100 100 100
#> Per sample, per argument: #> $sample1 #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 49 49 49 49 49 #> #> $sample2 #> minCounts maxCounts minFeatures maxFeatures minNovelty #> 51 51 51 51 51
#> class: SingleCellExperiment #> dim: 485 100 #> metadata(3): date filterCells subset #> assays(1): counts #> rownames(485): gene001 gene002 ... gene498 gene499 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(100): cell001 cell002 ... cell099 cell100 #> colData names(7): sampleID nCount ... log10FeaturesPerCount mitoRatio #> reducedDimNames(0): #> spikeNames(0): #> altExpNames(0):