View source: R/xCell2Analysis.R
xCell2Analysis | R Documentation |
This function estimate the relative enrichment of cell types in a bulk gene expression mixture.
The analysis leverages gene signatures from a pre-trained xCell2Object
to compute enrichment scores for each cell type.
It also applies linear transformation and spillover correction to refine the enrichment scores.
xCell2Analysis(
mix,
xcell2object,
minSharedGenes = 0.9,
rawScores = FALSE,
spillover = TRUE,
spilloverAlpha = 0.5,
BPPARAM = BiocParallel::SerialParam()
)
mix |
A bulk mixture of gene expression matrix (genes in rows, samples in columns). The input should use the same gene annotation system as the reference object. |
xcell2object |
A pre-trained reference object of class |
minSharedGenes |
Minimum fraction of shared genes required between the mixture and the reference object (default: |
rawScores |
A Boolean indicating whether to return raw enrichment scores (default: |
spillover |
A Boolean to enable spillover correction on the enrichment scores (default: |
spilloverAlpha |
A numeric value controlling the strength of spillover correction (default: |
BPPARAM |
A BiocParallelParam instance that determines the parallelization strategy (more in "Details").
Default is |
The xCell2Analysis
function performs cell type enrichment analysis by leveraging gene signatures
from a pre-trained xCell2Object
. It computes enrichment scores for each cell type in the provided
bulk gene expression mixture (mix
), applies linear transformations, and corrects for spillover.
Spillover correction addresses the overlap of gene expression patterns between closely related cell types,
improving the specificity of the enrichment scores.
## Parallelization with BPPARAM
To achieve faster processing by running computations in parallel, xCell2Analysis
supports parallelization through the BPPARAM
parameter. Users can define a parallelization strategy using BiocParallelParam
from the BiocParallel
package.
For example, MulticoreParam
is suitable for multi-core processing on Linux and macOS, while
SnowParam
or SerialParam
are better suited for Windows systems.
Refer to the BiocParallel documentation
for further guidance on parallelization strategies.
## Relationship with Other Function(s)
The pre-trained xCell2Object
used in xCell2Analysis
is created via the xCell2Train
function.
A data frame containing the cell type enrichment for each sample in the input matrix, as estimated by xCell2. Each row corresponds to a cell type, and each column corresponds to a sample.
Almog Angel and Dvir Aran
xCell2Train
, for generating the reference object used in this analysis.
# For detailed example read xCell2 vignette.
library(xCell2)
# Load "ready to use" xCell2 reference object or generate a new one using `xCell2Train`
data(DICE_demo.xCell2Ref, package = "xCell2")
# Load demo bulk RNA-Seq gene expression mixture
data(mix_demo, package = "xCell2")
# Run xCell2 cell type enrichment analysis
xcell2_res <- xCell2::xCell2Analysis(mix = mix_demo, xcell2object = DICE_demo.xCell2Ref)
# Example using parallel processing with MulticoreParam
library(BiocParallel)
parallel_param <- MulticoreParam(workers = 2) # Adjust workers as needed
xcell2_res_parallel <- xCell2::xCell2Analysis(
mix = mix_demo,
xcell2object = DICE_demo.xCell2Ref,
BPPARAM = parallel_param
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.