View source: R/supercell_2_Seurat.R
supercell_2_Seurat | R Documentation |
This function transforms super-cell gene expression and super-cell partition into Seurat object
supercell_2_Seurat(
SC.GE,
SC,
fields = c(),
var.genes = NULL,
do.preproc = TRUE,
is.log.normalized = TRUE,
do.center = TRUE,
do.scale = TRUE,
N.comp = NULL,
output.assay.version = "v4"
)
SC.GE |
gene expression matrix with genes as rows and cells as columns |
SC |
super-cell (output of SCimplify function) |
fields |
which fields of |
var.genes |
set of genes used as a set of variable features of Seurat (by default is the set of genes used to generate super-cells), ignored if |
do.preproc |
whether to do prepocessing, including data normalization, scaling, HVG, PCA, nearest neighbors, |
is.log.normalized |
whether |
do.center |
whether to center gene expression matrix to compute PCA, ignored if |
do.scale |
whether to scale gene expression matrix to compute PCA, ignored if |
N.comp |
number of principal components to use for construction of single-cell kNN network, ignored if |
output.assay.version |
version of the seurat assay in output, |
Since the input of CreateSeuratObject should be unnormalized count matrix (UMIs or TPMs, see CreateSeuratObject).
Thus, we manually set field `assays$RNA@data`
to SC.GE
if is.log.normalized == TRUE
.
Avoid running NormalizeData for the obtained Seurat object, otherwise this will overwrite field `assays$RNA@data`
.
If you have run NormalizeData, then make sure to replace `assays$RNA@data`
with correct matrix by running
`your_seurat@assays$RNA@data <- your_seurat@assays$RNA@counts`
.
Since super-cells have different size (consist of different number of single cells), we use sample-weighted algorithms for all
possible steps of the downstream analysis, including scaling and dimensionality reduction. Thus, generated Seurat object comes
with the results of sample-wighted scaling (available as `your_seurat@assays$RNA@scale.data`
or
`your_seurat@assays$RNA@misc[["scale.data.weighted"]]`
to reproduce if the first one has been overwritten) and PCA (available as
`your_seurat@reductions$pca`
or `your_seurat@reductions$pca_weighted`
to reproduce if the first one has been overwritten).
Seurat object
data(cell_lines)
SC <- SCimplify(X=cell_lines$GE, gamma = 20)
SC$ident <- supercell_assign(clusters = cell_lines$meta, supercell_membership = SC$membership)
SC.GE <- supercell_GE(cell_lines$GE, SC$membership)
m.seurat <- supercell_2_Seurat(SC.GE = SC.GE, SC = SC, fields = c("ident"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.