gene: Returns the expression values of a gene for all cells/samples

Description Usage Arguments Value Author(s) Examples

View source: R/gene-getters.R

Description

Returns the expression values of a gene for all cells/samples

Usage

1
2
3
4
5
6
7
8
gene(
  gene,
  object,
  assay = .default_assay(object),
  slot = .default_slot(object),
  adjustment = NULL,
  adj.fxn = NULL
)

Arguments

gene

quoted "gene" name = REQUIRED. the gene whose expression data should be retrieved.

object

A Seurat, SingleCellExperiment, or SummarizedExperiment object.

assay, slot

single strings or integer that set which data to use. Seurat and SingleCellExperiments deal with these differently, so be sure to check the documentation for whichever object you are using. When not provided, these typical defaults for the provided object class are used:

  • SingleCellExperiment (single-cell or bulk data): assay = "logcounts", "normcounts", "counts", or the first element of assays(object), slot not used

  • Seurat-v3: assay = DefaultAssay(object), slot = "data"

  • Seurat-v2: assay not used, slot = "data"

adjustment

Should expression data be used directly (default) or should it be adjusted to be

  • "z-score": scaled with the scale() function to produce a relative-to-mean z-score representation

  • "relative.to.max": divided by the maximum expression value to give percent of max values between [0,1]

adj.fxn

A function which takes a vector (of metadata values) and returns a vector of the same length.

For example, function(x) {log2(x)} or as.factor

Value

Returns the expression values of a gene for all cells/samples.

Author(s)

Daniel Bunis

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
example(importDittoBulk, echo = FALSE)
gene("gene1", object = myRNA, assay = "counts")

# z-scored
gene("gene1", object = myRNA, assay = "counts",
    adjustment = "z-score")

# Log2'd
gene("gene1", object = myRNA, assay = "counts",
    adj.fxn = function(x) {log2(x)})

# To see expression of the gene for the default assay that dittoSeq would use
# leave out the assay input
# (For this object, the default assay is the logcounts assay)
gene("gene1", myRNA)

# Seurat (raw counts)
if (!requireNamespace("Seurat")) {
    gene("CD14", object = Seurat::pbmc, assay = "RNA", slot = "counts")
}

dittoSeq documentation built on April 17, 2021, 6:01 p.m.