安裝還算簡單,有幾個依賴包需要下載.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
再次重新安裝之后跑完流程,非常快
