今天的学习内容:
今天学习作者 对双细胞进行过滤使用的软件 DoubletDecon:

DoubletDecon 算法预测双细胞
这个软件于 2019 年 12 月 5 日 发表在 Cell Reports(IF=7.5),文献标题为:《DoubletDecon: Deconvoluting Doublets from SingleCell RNA-Sequencing Data》:

DePasquale等人引入了一种名为 DoubletDecon 的方法,用于识别潜在的双细胞(doublets),并考虑过渡状态和祖细胞中独特的基因表达。
- DoubletDecon通过去卷积的方法来识别并去除单细胞RNA测序(scRNA-seq)数据中的双细胞(doublets)。
- 保留双细胞(doublets)可能会干扰数据分析和细胞亚群的识别。
- DoubletDecon可以识别过渡细胞和祖细胞避免被错误去除。
- 该算法能够识别出与其他方法相比独特的双细胞(doublets)。
原理示意图如下:

代码学习
首先安装一下下这个包:
if(!require(devtools)){
install.packages("devtools") # If not already installed
}
devtools::install_github('EDePasquale/DoubletDecon')
软件的详细说明在预印本上:https://www./content/10.1101/2020.04.23.058156v1.full.pdf
该软件发表时使用的 Seurat 版本为3以上的,后面在2020年年底更新后就停止了更新,目前可以支持 Seurat v3、v4版本,就是不兼容 Seurat v5版本。
但是!我们可以修改一下源码让它支持。
去github上面下载源码:https://github.com/EDePasquale/DoubletDecon
unzip DoubletDecon-master.zip
改动 包中 DoubletDecon-master/R/Improved_Seurat_Pre_Process.R 函数的取值方式:

重新安装:
# bash终端操作
conda activate R4.4
tar -zcvf DoubletDecon-master.tar.gz DoubletDecon-master
# 安装
R CMD INSTALL -l /usr/local/software/miniconda3/envs/R4.4/lib/R/library DoubletDecon-master.tar.gz
安装成功:

读取上次保存的数据:
rm(list=ls())
library(scater)
library(dplyr)
library(Seurat)
library(patchwork)
library(SingleCellExperiment)
library(scater)
library(ComplexHeatmap)
library(ConsensusClusterPlus)
library(msigdbr)
library(fgsea)
library(dplyr)
library(tibble)
library(DoubletFinder)
library(Signac)
library(ggplot2)
library(stringr)
library(SingleR)
library(GEOquery)
## 读取上次保存的数据
# saveRDS(rna,"./rna_predoublet_PassedPC1Checks.rds")
rna <- readRDS("./02-scRNA_Res/rna_predoublet_PassedPC1Checks.rds")
rna
然后运行:
# # Doublet Decon
# # Add if else statement to regress out nCount RNA if needed before running DoubletDecon
library(DoubletDecon)
packageVersion("DoubletDecon")
seuratObject <- rna
newFiles <- Improved_Seurat_Pre_Process(seuratObject, num_genes=50, write_files=F)
# Patient_1_3533EL_RNA GSM5276933
SAMPLE.ID <- "endo_3533EL"
rawDataFile <- newFiles$newExpressionFile
class(rawDataFile)
groupsFile <- newFiles$newGroupsFile
head(groupsFile)
groupsFile <- cbind(rownames(groupsFile),groupsFile)
groupsFile <- data.frame(groupsFile)
head(groupsFile)
table(groupsFile$X3)
class(groupsFile)
row.names(rawDataFile)[1]
colnames(rawDataFile)[1]
results <- Main_Doublet_Decon(rawDataFile=newFiles$newExpressionFile,
#groupsFile=newFiles$newGroupsFile,
groupsFile=groupsFile,
filename=SAMPLE.ID,
location="./DoubletDecon",
fullDataFile=NULL,
removeCC=FALSE,
species="hsa",
rhop=1.1,
write=T,
PMF=TRUE,
useFull=FALSE,
heatmap=FALSE,
centroids=TRUE,
num_doubs=100,
only50=FALSE,
min_uniq=4,
nCores=4
)
一开始我以为只是版本的问题,解决了 第一步的报错 这句代码:newFiles <- Improved_Seurat_Pre_Process(seuratObject, num_genes=50, write_files=F)
,接着往下运行的时候,我遇到了更多的报错,尝试改了几个源码后,又有新的报错!!!
我还是:too yong too simple!
载入需要的程辑包:iterators
载入需要的程辑包:parallel
Reading data...
WARNING: if using ICGS2 file input, please import 'rawDataFile' and 'groupsFile' as path/location instead of an R object.
Processing raw data...
Combining similar clusters...
Error in if (cormedoids[rrow, ccol] > cutoff) { :
需要TRUE/FALSE值的地方不可以用缺少值
然后我去github上的issues看了,上面的bug我已经踩了4个了,看到还有那么多其他人的报错,内心到这里:我要是继续用这个软件,可能得花费好多精力去改他的源码,太不值了!趁早放弃好了,他的代码维护不应该让我来!!!

作者已经放弃更新了!
我搜了一下还有很多其他的过滤双细胞的软件,有一篇综述:《Benchmarking Computational Doublet-DetectionMethods for Single-Cell RNA Sequencing Data》,家人们这里介绍了9个软件呢!遇到了错误的软件不要紧,趁年轻早放弃、学习其他还在更新的软件!