Skip to contents

Adds, for every feature of the assay, the posterior mean of rho, its credible interval and the call from denmark_scan() to the feature metadata (object[[assay]][[]]). Features that were not scanned get NA.

Usage

denmark_annotate(object, scan, assay = NULL, prefix = "denmark_")

Arguments

object

A Seurat object.

scan

Data frame returned by denmark_scan().

assay

Assay whose feature metadata receive the results (default: the default assay).

prefix

Prefix of the new columns: rho, rho_lower, rho_upper and class.

Value

The Seurat object with the new feature metadata.

Examples

counts <- Matrix::Matrix(matrix(rpois(30, 2), 3, 10,
                                dimnames = list(c("geneA", "geneB", "geneC"), NULL)),
                         sparse = TRUE)
colnames(counts) <- paste0("cell", 1:10)
obj <- SeuratObject::CreateSeuratObject(counts = counts)
scan <- data.frame(gene = c("geneA", "geneC"), rho_mean = c(0.6, -0.6),
                   rho_lower = c(0.3, -0.8), rho_upper = c(0.8, -0.3),
                   class = c("PCG", "NCG"))
obj <- denmark_annotate(obj, scan)
obj[["RNA"]][[]]
#>       denmark_rho denmark_rho_lower denmark_rho_upper denmark_class
#> geneA         0.6               0.3               0.8           PCG
#> geneB          NA                NA                NA          <NA>
#> geneC        -0.6              -0.8              -0.3           NCG