Codes in paper

10X Single Cell Sequencing Cell Classification

Introduction

In this paper, single-cell 10X RNA sequencing was performed on a mixture of a variety of known cell lines to study the interaction mode between polyclones. Here we introduce the single-cell sequencing gene expression cell classification operation. However, the article uses the known inherent SNP for classification, and the gene expression classification is used for comparison with the SNP classification.

代码讲解

Read in the seurat obj that have passed the QC, and see the previous blog for the filtering code , see the previous blog for the filtering codehttp://www.thecodesearch.com/2021/01/28/%e5%8d%95%e7%bb%86%e8%83%9erna%e6%b5%8b%e5%ba%8fqc%e5%b7%b2%e7%9f%a5%e6%a0%b7%e6%9c%acsnp/

Set the parameters according to the number of sequenced cell lines, n_pcs is the number of principal components in principal component analysis, and clust_res is the resolution parameter of running FindCluster function

n_cls <- nlevels(seuObj)
n_pcs <- 2*n_cls
if(n_cls > 25-param_range & n_cls < 25+param_range) {
  clust_res <- 1
} else if(n_cls > 50-param_range & n_cls < 50+param_range) {
  clust_res <- 2
} else if(n_cls > 100-param_range & n_cls < 100+param_range) {
  clust_res <- 4
} else {
  stop('Not implemented')
}

Select the cells that have been quality-controlled according to the markers in the previous QC

#use just good singlets
cq <- Seurat::FetchData(seuObj, vars = c('cell_quality'))
seuObj <- seuObj[, which(cq$cell_quality == 'normal')]

Perform cell sorting

seuObj <- Seurat::ScaleData(object = seuObj, vars.to.regress = vtr)
seuObj <- Seurat::FindVariableFeatures(object = seuObj,
                                       nfeatures = 1e5,
                                       selection.method = 'vst')
seuObj <- Seurat::RunPCA(object = seuObj,
                         features = Seurat::VariableFeatures(seuObj),
                         seed.use = 1,
                         npcs = n_pcs,
                         verbose = FALSE)

seuObj <- Seurat::RunTSNE(object = seuObj,
                          dims = 1:n_pcs,
                          check_duplicates = FALSE,
                          seed.use = 1,
                          perplexity = 30,
                          verbose = FALSE) 

#cluster cells
seuObj <- Seurat::FindNeighbors(seuObj, reduction = 'pca',
                                dims = 1:n_pcs,
                                k.param = 10, 
                                force.recalc = TRUE,
                                verbose = FALSE)
seuObj <- Seurat::FindClusters(seuObj, resolution = clust_res, verbose = FALSE)

References

Kinker G S , Greenwald A C , Tal R , et al. Pan-cancer single-cell RNA-seq identifies recurring programs of cellular heterogeneity[J]. Nature Genetics, 2020, 52(11):1208-1218.

Original code

https://github.com/broadinstitute/single_cell_classification

Leave a Reply

Your email address will not be published. Required fields are marked *