pseudobulk {cellpypes}R Documentation

Form pseudobulks from single cells.

Description

Sum up cells in count matrix raw for bulk RNA methods such as DESeq2.

Usage

pseudobulk(raw, pseudobulk_id)

Arguments

raw

A matrix with raw UMI counts, cells in columns.

pseudobulk_id

A factor that identifies which cells should go to which pseudobulk. Generate pseudobulk_ids with the pseudobulk_id function!

Value

A matrix where each column is a pseudobulk and each row a gene.

Examples

# Create pseudobulk counts and coldata for DESeq2: 
coldata <- data.frame(
  celltype = rep(c("X+Y-", "X+Y+", "X-Y+", "X-Y-"),
                 each = nrow(simulated_umis$embed)/4), # 4 cell types
  patient  = c("3", "500.", "*5", "/")
)
coldata$pseudobulk_id <- pseudobulk_id(coldata)
counts <- pseudobulk(simulated_umis$raw, coldata$pseudobulk_id)
# Use counts/coldata as input for DESeqDataSetFromMatrix (DESeq2).


[Package cellpypes version 0.3.0 Index]