runCIBERSORT: Runs CIBERSORT for decomposing bulk RNA-seq samples using a...

Description Usage Arguments Value Examples

View source: R/CIBERSORT.R

Description

This is a custom implementation of the algorithm described by Newman et al (Nautre Methods 12:453-457). CIBERSORT is an algorithm for estimating the cell type composition of a bulk sample, given a gene expression profile of the sample and a known gene expression profile for each cell type potentially contributing to the sample.

Usage

1
2
3
4
runCIBERSORT(exprs, base, design,
  markergenes = intersect(rownames(mean_by_cluster), rownames(exprs)),
  transform = function(x) x, nu = c(0.25, 0.5, 0.75), optim.nu = F,
  mc.cores = 3, ...)

Arguments

exprs

A data frame or matrix of raw read counts of \epmhbulk RNA-seq samples. Column names correspond to sample names, row names to genes.

base

A matrix of read counts representing the gene expression profiles of all cell types that might contribute to the bulk samples. See examples below for how to generate this object from an object of class seurat.

design

A named vector assigning sample names to sample class, see examples below.

markergenes

A vector of genes to be included in the analysis, defaults to intersect( rownames(mean_by_cluster), rownames(exprs) )

nu

Different values of nu to evaluate support vector regression at, see [e1071]svm. Nu defines how many support vectors (i.e. genes) to use in regression.

optim.nu

In the original CIBERSORT implementation, SVR is evaluated at several values of nu and the value with the best RSME is chosen. This can lead to overfitting. If optim.nu is set to TRUE, the value for nu is chosen by cross validation, which leads to longer runtimes.

mc.cores

Number of cores used, e.g. for the parallel evaluation at different balues of nu.

...

Parameters passed to svm

Value

A data frame in long format suitable for plotting with ggplot2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
#See also package vignette CIBERORT.Rmd
#1. identify marker genes from a seurat object
NicheMarkers10x <- FindAllMarkers(NicheData10x, test.use = "roc")
usegenes <- unique(NicheMarkers10x$gene[(NicheMarkers10x$myAUC > 0.8 |NicheMarkers10x$myAUC < 0.2) ])

#2. compute mean expression per cell type
mean_by_cluster <- do.call(cbind, lapply(unique(NicheData10x@ident), function(x) {
apply(NicheData10x@raw.data[usegenes,NicheData10x@cell.names][,NicheData10x@ident == x], 1,mean )
}))
colnames(mean_by_cluster) <- unique(NicheData10x@ident)

#3. Create a vector that maps samples to biological class
LCM_design <- NicheMetaDataLCM$biological.class
names(LCM_design) <- NicheMetaDataLCM$id

4. Run CIBERSORT
CIBER <- runCIBERSORT(NicheDataLCM, mean_by_cluster,usegenes, LCM_design, mc.cores=3)

## End(Not run)

veltenlab/rnamagnet documentation built on June 24, 2021, 6:19 p.m.