比inferCNV更快的恶性细胞鉴定工具:fastCNV,来看看!

最近在生信技能树的群里总看到有人喊inferCNV运行时间很久,苦不堪言。然后我就搜到了一个神器!fastCNV工具,于2025年10月22号发表在预印本上面,文献标题为《fastCNV: Fast and accurate copy number variation prediction from High-Definition Spatial Transcriptomics and scRNA-Seq Data》。来看看究竟有多快!

软件简单了解

github链接

https://github.com/must-bioinfo/fastCNV

fastCNV流程概览:

(a) fastCNV() 函数接收一个 Seurat 对象(或 Seurat 对象列表)作为输入,并对其进行处理以预测拷贝数变异。该函数将返回一个带有相应 CNV 结果的 Seurat 对象(或对象列表)。用户也可选择生成图形化输出(泛基因组热图)。

(b) CNVTree() 函数接收包含 CNV 结果的 Seurat 对象作为输入,并返回一个带注释的克隆进化树及其图形化表示。

软件安装:

教程:https://must-bioinfo./fastCNV/articles/fastCNV_sc.html

github不行可以试试本地安装。

## 使用西湖大学的 Bioconductor镜像
options(BioC_mirror="https://mirrors./bioconductor")
options("repos"=c(CRAN="https://mirrors./CRAN/"))
remotes::install_github("must-bioinfo/fastCNV")
remotes::install_github("must-bioinfo/fastCNVdata")

library(fastCNV)
library(fastCNVdata)
library(ggplot2)
library(Seurat)
library(scales)

示例数据

加载 scColon1、scColon2、scColon3 和 scColon4(来自 Pelka 等人研究中结直肠肿瘤的单细胞 RNA 测序数据)

## 1.加载数据
utils::data(scColon1)
utils::data(scColon2)
utils::data(scColon3)
utils::data(scColon4)
scColon1
scColon2
scColon3
scColon4

这几个数据都是seurat对象,细胞数如上。

注释信息如下:

# 细胞的注释信息
table(scColon1[["annot"]])
table(scColon2[["annot"]])
table(scColon3[["annot"]])
table(scColon4[["annot"]])
head([email protected])
head([email protected])
head([email protected])
head([email protected])

运行fastCNV

fastCNV() 将依次执行以下功能:

1)prepareCountsForCNVAnalysis:运行 Seurat 标准聚类算法,将观测值(细胞或位点)聚合成"元位点",每个元位点包含的计数上限由参数 aggregFactor(默认值为 15,000)定义。此外,若保留默认参数 aggregateByVar = TRUE 并指定 referenceVar 参数,观测值可基于其 Seurat 聚类结果与细胞类型信息进行双重聚合。如果 Seurat 对象已预先完成聚类,则将基于 SCT 转换后的数据,使用 10 个主成分并以默认参数运行 FindNeighbors 和 FindClusters 重新聚类。可通过设置 reClusterSeurat = FALSE 跳过此步骤。

2)CNVAnalysis:计算拷贝数变异。若 Seurat 对象包含注释信息,可通过参数 referenceVar 和 referenceLabel 指定参考信息。

3)CNVPerChromosome:计算各染色体臂的 CNV 结果,并存储到 Seurat 对象的元数据中。可通过设置 getCNVPerChromosome = FALSE 跳过此步骤。

4)CNVCluster:对从 Seurat 对象提取的基因组评分矩阵进行层次聚类分析。

5)plotCNVResults:可视化结果(存储在 Seurat 对象的 assays 槽中)。默认情况下,参数 downsizePlot 设为 FALSE,此时将生成高精度图谱,但渲染耗时较长。若需要缩短时间,可将该参数设为 TRUE,此时将在元细胞层面(而非单细胞层面)绘制图谱,从而降低图谱分辨率以加快渲染速度。

选择一个样本运行看看,参考细胞选择:c("TNKILC", "Myeloid", "B", "Mast", "Plasma")。

## 2.运行fastCNV
scColon1 <- fastCNV(seuratObj = scColon1, 
                    sampleName = "scColon1"
                    referenceVar ="annot"
                    referenceLabel = c("TNKILC""Myeloid""B""Mast""Plasma"), 
                    printPlot = T
                    )

运行速度真的很快,不到2分钟就运行完了

当前目录会生成一个热图:heatmap.fastCNV_scColon1.png

生成的结果

上面运行得到的结果保存在seurat的meta数据中:

## 3.结果可视化
head([email protected])
#umap可视化需要跑一下umap
scColon1 <- RunUMAP(scColon1, dims = 1:10)

common_theme <- theme(
  plot.title = element_text(size = 10),
  legend.text = element_text(size = 8),
  legend.title = element_text(size = 8),
  axis.title = element_text(size = 8),
  axis.text = element_text(size = 6)
)

FeaturePlot(scColon1, features = "cnv_fraction", reduction = "umap" ) & common_theme |
  DimPlot(scColon1, reduction = "umap", group.by =  "annot") & common_theme

umap上的cnv打分:

小提琴展示打分

ggplot(FetchData(scColon1, vars = c("annot""cnv_fraction")), 
       aes(annot, cnv_fraction, fill = annot)) +
  geom_boxplot() +
  theme(axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1, color = "black"))

上皮类的打分比其他参考亚群都高。

每条染色体上的打分

还可以绘制某条染色体的cnv打分:

library(scales)

FeaturePlot(scColon1, features = "20.p_CNV")  +
  scale_color_distiller(palette = "RdBu", direction = -1, limits = c(-1, 1), 
                       rescaler = function(x, to = c(0, 1), from = NULL) {
                         rescale_mid(x, to = to, mid = 0)
                       }) +
  common_theme |
FeaturePlot(scColon1, features = "X.q_CNV") +
  scale_color_distiller(palette = "RdBu", direction = -1, limits = c(-1, 1), 
                       rescaler = function(x, to = c(0, 1), from = NULL) {
                         rescale_mid(x, to = to, mid = 0)
                       }) +
  common_theme

看起来很棒啊,快去试试看!

使用这些数据集:

GSE163558_胃癌文献复现

2024-GSE263733--胰腺癌-转移-克隆进化

2023-GSE205013-胰腺癌-化疗27个患者

2022-GSE188955-CCI-食管癌

今天分享到这里~