chris-mcginnis-ucsf / DoubletFinder

R package for detecting doublets in single-cell RNA sequencing data
411 stars 109 forks source link

Only one doublet found #31

Closed yuwenjiesail closed 5 years ago

yuwenjiesail commented 5 years ago

Hi there,

Thank you for sharing this. I tried to use the code provided to analysis my own data and got just one doublet. I am not sure if I have done something wrong but I am not confident about the result. Let me describe my scRNAseq data before hand: About 9000 cells from a type of gland were processed in 10x. Since the tissue is not easy to dissociate, it is expected to have doublets in single-cell samples. I process the scRNAseq data in Seurat v3 (no filtering for potential doublets), and then use the codes below to find doublets sweep.res.list_Gland <- paramSweep_v3(Gland, PCs = 1:10) sweep.stats_Gland <- summarizeSweep(sweep.res.list_Gland, GT = FALSE) bcmvn_Gland <- find.pK(sweep.stats_Gland) annotations <- Gland@meta.data$RNA_snn_res.0.6 homotypic.prop <- modelHomotypic(annotations) nExp_poi <- round(0.075*length(Gland)) nExp_poi.adj <- round(nExp_poi*(1-homotypic.prop)) Gland <- doubletFinder_v3(Gland, PCs = 1:10, pN = 0.25, pK = 0.09, nExp = nExp_poi, reuse.pANN = FALSE) Gland <- doubletFinder_v3(Gland, PCs = 1:10, pN = 0.25, pK = 0.09, nExp = nExp_poi.adj, reuse.pANN = "pANN_0.25_0.09_0") Gland@meta.data[,"DF_hi.lo"] <- Gland@meta.data$DF.classifications_0.25_0.09_0 Gland@meta.data$DF_hi.lo[which(Gland@meta.data$DF_hi.lo == "Doublet" & Gland@meta.data$DF.classifications_0.25_0.09_0 == "Singlet")] <- "Doublet_lo" Gland@meta.data$DF_hi.lo[which(Gland@meta.data$DF_hi.lo == "Doublet")] <- "Doublet_hi" TSNEPlot(Gland, group.by="DF_hi.lo", plot.order=c("Doublet_hi","Doublet_lo","Singlet"), colors.use=c("black","gold","red")) Here is some output from the code above:

bcmvn_NonCF <- find.pK(sweep.stats_NonCF) NULL nExp_poi value: 0 nExp_poi.adj value: 0 Doublet found: 1

Thanks a lot!

chris-mcginnis-ucsf commented 5 years ago

Hello,

Looks to me like the issue arises at this step:

nExp_poi <- round(0.075*length(Gland))

Assuming that 'Gland' is a Seurat object (which it needs to be for the previous commands to work), the length of a Seurat object will be 1. Note in the tutorial I use length(seu_kidney@cell.names), which is the same thing as the total number of cells in the Seurat object. For objects processed using Seurat V3, you'll want to use nrow(Gland@meta.data), since the cell.names slot is no longer used in this package version.

One more note: I use 0.075 to define the expected number of doublets from Poisson statistics (i.e., nExp_poi) because the cell loading density used when creating the kidney data corresponded to a 7.5% doublet formation rate. You will need to adjust this according to the specifics for your dataset.

Let me know if this works, and if it does, please close the issue!

Chris

yuwenjiesail commented 5 years ago

Chris,

Thank you. It is working now.

On Tue, Apr 30, 2019, 12:00 PM Chris McGinnis notifications@github.com wrote:

Hello,

Looks to me like the issue arises at this step:

nExp_poi <- round(0.075*length(Gland))

Assuming that 'Gland' is a Seurat object (which it needs to be for the previous commands to work), the length of a Seurat object will be 1. Note in the tutorial I use length(seu_kidney@cell.names), which is the same thing as the total number of cells in the Seurat object. For objects processed using Seurat V3, you'll want to use nrow(Gland@meta.data), since the cell.names slot is no longer used in this package version.

One more note: I use 0.075 to define the expected number of doublets from Poisson statistics (i.e., nExp_poi) because the cell loading density used when creating the kidney data corresponded to a 7.5% doublet formation rate. You will need to adjust this according to the specifics for your dataset.

Let me know if this works, and if it does, please close the issue!

Chris

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chris-mcginnis-ucsf/DoubletFinder/issues/31#issuecomment-488032291, or mute the thread https://github.com/notifications/unsubscribe-auth/AK5VV5SNV3M34MG3BAN433DPTB3J5ANCNFSM4HJOGBZQ .

hridiva commented 2 months ago

can i use doubletfinder before clustering; or even before scaling the seurat object? if yes how would my "homotypic.prop <- modelHomotypic(annotations)" looks like?