Commit 94067e3e authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Fix nCount lower threshold

parent 3d251e18
......@@ -242,7 +242,7 @@ scQC <- function(sc10x,sp="hu",feature="nFeature_RNA"){
cells.remove <- NULL
h <- hist(data.frame(sc10x[[j]][[i]])$nCount_RNA,breaks=100,plot=FALSE)
cutoff.temp <- mean(c(h$mids[which.max(h$counts)],h$mids[-which.max(h$counts)][which.max(h$counts[-which.max(h$counts)])]))
cells.remove <- c(cells.remove,rownames(sc10x[[j]][["nCount_RNA"]])[sc10x[[j]][[i]][,1] < cutoff.temp])
cells.remove <- c(cells.remove,rownames(sc10x[[j]][["nCount_RNA"]])[sc10x[[j]][[i]][,1] > cutoff.temp])
sc10x.temp[[j]] <- subset(sc10x[[j]],cells=cells.remove,invert=TRUE)
}
thresh[[i]] <- scThresh(sc10x.temp,feature=i,sub="lower")
......@@ -303,7 +303,7 @@ scQC <- function(sc10x,sp="hu",feature="nFeature_RNA"){
cutoff.l <- 0
} else if (i == "nCount_RNA") {
cutoff.h <- max(sc10x[[j]][[i]])
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="MinErrorI"]
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
}
plots.v[[j]] <- plots.v[[j]]+geom_hline(yintercept=cutoff.l,size=0.5,color="red")+geom_hline(yintercept=cutoff.h,size=0.5,color="red")
if (i != "nCount_RNA"){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment