scCancer2

安裝還算簡單,有幾個依賴包需要下載.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" 所在目錄

  • 示例數據:http://lifeome.net/software/sccancer/KC-example.tar.gz

  • 經cellranger處理得到的10X單細胞表達數據。sampleFolder即為代表單個樣本。raw_feature_bc_matrixfiltered_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
)
'''
![image.png](https://upload-images.jianshu.io/upload_images/18429961-d4fbb7861c9c39b3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

注意,必須有這步才能進行后續的
'''
# 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

'''
聽從建議安裝
![image.png](https://upload-images.jianshu.io/upload_images/18429961-2dd1200dfeb84784.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
報錯
重新換成小鼠的,仍然報錯
![image.png](https://upload-images.jianshu.io/upload_images/18429961-d6481a2691490451.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
When using repel, set xnudge and ynudge to 0 for optimal results
Error in `[.data.frame`(coor.df, , coor.names[1]) : 
  undefined columns selected

降級版本
![image.png](https://upload-images.jianshu.io/upload_images/18429961-7d2303d7c9e0d1db.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
分析的內容很豐富,可以為初步探索節省時間
![image.png](https://upload-images.jianshu.io/upload_images/18429961-7ac958278eaf90f4.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)


下面是惡性細胞識別
[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
再次重新安裝之后跑完流程,非常快
![image.png](https://upload-images.jianshu.io/upload_images/18429961-cbb177ad77e00db3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)





?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容