安装还算简单,有几个依赖包需要下载.tar手动安装,注意报错提示里的版本号即可。
首先:几个主要模块(按照旧版来看):3个
The workflow of scCancer
mainly consists of three modules: scStatistics
, scAnnotation
, and scCombination
.
- The
scStatistics
performs basic statistical analyses of raw data and quality control.
注:计算、可视化的过滤指标,有处理过的数据集(矩阵或 Seurat 对象),您可以单独使用细胞亚型注释和恶性细胞识别模块。
scStatistics,并且不需要。
The
scAnnotation
performs functional data analyses and visualizations, such as low dimensional representation, clustering, cell type classification, cell malignancy estimation, cellular phenotype analyses, gene signature analyses, cell-cell interaction analyses, etc.The
scCombination
perform multiple samples data integration, batch effect correction and analyses visualization.
注:2,3在新版不同 变成 cellSubtypeAnno.Rmd和 malignantCellIden.Rmd
cellranger后的数据直接跳过 scStatistics, 两个都挺重要,先从注释开始。
首先是输入数据:不管下载新版本还是旧版本(参考下面),都是没有/data 这个子目录的,但没事,大致能确定需要的目录只是cellranger处理后的目录,即:#[1] "barcodes.tsv.gz"features.tsv.gz"matrix.mtx.gz" 所在目录
-
经cellranger处理得到的10X单细胞表达数据。
sampleFolder
即为代表单个样本。raw_feature_bc_matrix
与filtered_feature_bc_matrix
分别代表处过滤empty
droplet前后的单细胞表达数据。image
list.files("./data",recursive = T)
#[1] "sample1/filtered_feature_bc_matrix/barcodes.tsv.gz"
#[2] "sample1/filtered_feature_bc_matrix/features.tsv.gz"
#[3] "sample1/filtered_feature_bc_matrix/matrix.mtx.gz"
#[4] "sample1/raw_feature_bc_matrix/barcodes.tsv.gz"
#[5] "sample1/raw_feature_bc_matrix/features.tsv.gz"
#[6] "sample1/raw_feature_bc_matrix/matrix.mtx.gz"
list.files("./results",recursive = T,include.dirs = T)
#[1] "sample1"
下面我把测试成功的最简代码贴出来
参考的官方流程,但是只截取最重要的,避免干扰
官方:scCancer/vignettes/scCancer2.Rmd at master · czythu/scCancer · GitHub
'''
scStatistics
##最核心的 数据类型和位置:就是我说的"barcodes.tsv.gz"features.tsv.gz"matrix.mtx.gz" 所在目录的前两层,注意不是所在目录
path <- "/dssg/home/acct-medwshuai/medwshuai/2025-3-11-xujy_MusPAAD/DZOE2025011103/Cellranger/"
dataPath <- file.path(path, "F_KPC290")
# A path containing the scStatistics results
statPath <- file.path(path, "result")
# The sample name
sampleName <- "F_KPC290-example"
# The author name or a string used to mark the report.
authorName <- "Shen-Lab@SJTU"
# A path used to save the results files
savePath <- file.path(path, "result")
# Run scStatistics
stat.results <- runScStatistics(
dataPath = dataPath,
savePath = savePath,
sampleName = sampleName,
authorName = authorName,
bool.runSoupx = F,
genReport = T
)
'''

注意,必须有这步才能进行后续的
'''
# Run scAnnotation
anno.results <- runScAnnotation(
dataPath = dataPath,
statPath = statPath,
savePath = savePath,
authorName = authorName,
sampleName = sampleName,
geneSet.method = "average",
# vars.to.regress = c("nCount_RNA", "mito.percent"),
bool.runDiffExpr = T,
bool.runCellClassify = T,
bool.runCellSubtypeClassify = T,
subtypeClassifyMethod = "Scoring",
celltype.list = NULL,
ct.templates = NULL,
submodel.path = NULL,
markers.path = NULL,
unknown.cutoff = 0.3,
subtype.umap = T,
bool.runMalignancy = T,
malignancy.method = "both", # "xgboost", "inferCNV", "both", recommend "both" for sample < 10000 cells
bool.intraTumor = T,
bool.runCellCycle = T,
bool.runStemness = T,
bool.runGeneSets = T,
bool.runExprProgram = T,
bool.runInteraction = T,
genReport = T
)
'''
跑完发现好像不是小鼠的,
而且有个提示
'''
For a (much!) faster implementation of the Wilcoxon Rank Sum Test,
(default method for FindMarkers) please install the presto package
--------------------------------------------
install.packages('devtools')
devtools::install_github('immunogenomics/presto')
--------------------------------------------
After installation of presto, Seurat will automatically use the more
efficient implementation (no further action necessary).
This message will be shown once per session
'''
听从建议安装

报错
重新换成小鼠的,仍然报错

When using repel, set xnudge and ynudge to 0 for optimal results
Error in `[.data.frame`(coor.df, , coor.names[1]) :
undefined columns selected
降级版本

分析的内容很丰富,可以为初步探索节省时间

下面是恶性细胞识别
[scCancer/vignettes/malignantCellIden.Rmd at master · czythu/scCancer · GitHub](https://kkgithub.com/czythu/scCancer/blob/master/vignettes/malignantCellIden.Rmd)
重新降级了seurat以后还是不行
可能是我光降级没重新加载sccancer包
重新进入,加载发现
Seurat v4 was just loaded with SeuratObject v5; disabling v5 assays and
validation routines, and ensuring assays work in strict v3/v4
compatibility mode
再次重新安装之后跑完流程,非常快
