add_expression: Add count and normalised expression values to a dataset

View source: R/wrap_add_expression.R

add_expressionR Documentation

Add count and normalised expression values to a dataset

Description

Add count and normalised expression values to a dataset

Usage

add_expression(
  dataset,
  counts,
  expression,
  feature_info = NULL,
  expression_future = NULL,
  ...
)

is_wrapper_with_expression(dataset)

get_expression(dataset, expression_source = "expression")

Arguments

dataset

A dataset created by wrap_data() or wrap_expression()

counts

The counts values of genes (columns) within cells (rows). This can be both a dense and sparse matrix.

expression

The normalised expression values of genes (columns) within cells (rows). This can be both a dense and sparse matrix.

feature_info

Optional meta-information of the features, a dataframe with at least feature_id as column

expression_future

Projected expression using RNA velocity of genes (columns) within cells (rows). This can be both a dense and sparse matrix.

...

extra information to be stored in the dataset

expression_source

The source of expression, can be "counts", "expression", an expression matrix, or another dataset which contains expression

Value

A dynwrap object with the expression added.

Examples

cell_ids <- c("A", "B", "C")
counts <- matrix(sample(0:10, 3*10, replace = TRUE), nrow = 3)
rownames(counts) <- cell_ids
colnames(counts) <- letters[1:10]
expression <- log2(counts + 1)

dataset <- wrap_data(id = "my_awesome_dataset", cell_ids = cell_ids)
dataset <- add_expression(dataset, counts = counts, expression = expression)

str(dataset$expression)
str(dataset$counts)


dynwrap documentation built on July 26, 2023, 5:15 p.m.