nexprs {scater} | R Documentation

## Count the number of expressed genes per cell

### Description

An efficient internal function that avoids the need to construct 'is_exprs_mat' by counting the number of expressed genes per cell on the fly.

### Usage

    nexprs(object, lowerDetectionLimit = 0, exprs_values = "counts",
      byrow = FALSE, subset_row = NULL, subset_col = NULL)

### Arguments

`object` | a `SingleCellExperiment` object
`lowerDetectionLimit` | numeric scalar providing the value above which observations are deemed to be expressed. Defaults to `object@lowerDetectionLimit`.
`exprs_values` | character scalar indicating whether the count data (`"counts"`), the log-transformed count data (`"logcounts"`), transcript-per-million (`"tpm"`), counts-per-million (`"cpm"`) or FPKM (`"fpkm"`) should be used to define if an observation is expressed or not. Defaults to the first available value of those options in the order shown. However, if `is_exprs(object)` is present, it will be used directly; `exprs_values` and `lowerDetectionLimit` are ignored.
`byrow` | logical scalar indicating if `TRUE` to count expressing cells per feature (i.e. gene) and if `FALSE` to count expressing features (i.e. genes) per cell.
`subset_row` | logical, integeror character vector indicating which rows (i.e. features/genes) to use when calculating the number of expressed features in each cell, when `byrow=FALSE`.
`subset_col` | logical, integer or character vector indicating which columns (i.e., cells) to use to calculate the number of cells expressing each gene when `byrow=TRUE`.

### Value

a numeric vector of the same length as the number of features if `byrow` argument is `TRUE` and the same length as the number of cells if `byrow` is `FALSE`

### Examples

    data("sc_example_counts")
    data("sc_example_cell_info")
    example_sce <- SingleCellExperiment(
    assays = list(counts = sc_example_counts), colData = sc_example_cell_info)
    nexprs(example_sce)[1:10]
    nexprs(example_sce, byrow = TRUE)[1:10]

[Package scater version 1.6.3 Index]