Commit e4c882e5 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Add lower % ribo filter

parent 7a5d958b
......@@ -49,14 +49,20 @@ counts.cell.filtered.2mito <- results[[4]]
counts.gene.filtered.2mito <- results[[5]]
rm(results)
results <- scQC(sc10x,sp=opt$s,feature="percent.ribo")
sc10x <- results[[1]]
counts.cell.filtered.3ribo <- results[[4]]
counts.gene.filtered.3ribo <- results[[5]]
rm(results)
results <- scQC(sc10x,sp=opt$s,feature="nCount_RNA")
sc10x <- results[[1]]
counts.cell.filtered.3gene <- results[[4]]
counts.gene.filtered.3gene <- results[[5]]
counts.cell.filtered.4gene <- results[[4]]
counts.gene.filtered.4gene <- results[[5]]
rm(results)
counts.cell.filtered <- counts.cell.filtered.3gene
counts.gene.filtered <- counts.gene.filtered.3gene
counts.cell.filtered <- counts.cell.filtered.4gene
counts.gene.filtered <- counts.gene.filtered.4gene
sc10x <- sc10x[as.character(unlist(sc10x.groups[sc10x.groups$Keep==1,1]))]
......
......@@ -211,7 +211,17 @@ scQC <- function(sc10x,sp="hu",feature="nFeature_RNA"){
thresh[[i]] <- scThresh(sc10x.temp,feature=i,sub="higher")
}
if (i == "percent.ribo"){
thresh[[i]] <- scThresh(sc10x,feature=i,sub="all")
sc10x.temp <- list()
for (j in names(sc10x)){
h <- NULL
cutoff.temp <- NULL
cells.remove <- NULL
h <- hist(data.frame(sc10x[[j]][[i]])$percent.ribo,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]][["percent.ribo"]])[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")
}
if (i == "nCount_RNA"){
sc10x.temp <- list()
......@@ -278,8 +288,8 @@ scQC <- function(sc10x,sp="hu",feature="nFeature_RNA"){
cutoff.h <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="Triangle"]
cutoff.l <- 0
} else if (i == "percent.ribo") {
cutoff.h <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
cutoff.l <- 0
cutoff.h <- max(sc10x[[j]][[i]])
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
} else if (i == "nCount_RNA") {
cutoff.h <- max(sc10x[[j]][[i]])
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
......
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