Commit 8ee45ed4 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Change ribo lower cutoff to 10% and change thresh scale to 0-255

parent 36f0c834
......@@ -289,7 +289,7 @@ scQC <- function(sc10x,sp="hu",feature="nFeature_RNA"){
cutoff.l <- 0
} else if (i == "percent.ribo") {
cutoff.h <- max(sc10x[[j]][[i]])
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
cutoff.l <- 10
} else if (i == "nCount_RNA") {
cutoff.h <- max(sc10x[[j]][[i]])
cutoff.l <- thresh[[i]][[j]]$threshold[thresh[[i]][[j]]$method=="RenyiEntropy"]
......@@ -425,12 +425,12 @@ scThresh <- function(sc10x,feature,sub=FALSE){
scale[[i]] <- data.frame(Score=sc10x[[i]][[feature]])
colnames(scale[[i]]) <- "Score"
scale[[i]] <- data.frame(Score=scale[[i]]$Score[!is.na(scale[[i]]$Score)])
scale.scaled[[i]] <- as.integer((scale[[i]]$Score-min(scale[[i]]$Score))/(max(scale[[i]]$Score)-min(scale[[i]]$Score))*360)
scale.scaled[[i]] <- as.integer((scale[[i]]$Score-min(scale[[i]]$Score))/(max(scale[[i]]$Score)-min(scale[[i]]$Score))*255)
#scale.scaled[[i]] <- as.integer(scales::rescale(scale[[i]]$Score,to=c(0,1))*360)
h[[i]] <- hist(scale[[i]]$Score,breaks=100,plot=FALSE)
thresh[[i]] <- purrr::map_chr(thresh_methods,~auto_thresh(scale.scaled[[i]],.)) %>% tibble(method = thresh_methods, threshold = .)
thresh[[i]]$threshold <- as.numeric(thresh[[i]]$threshold)
thresh[[i]]$threshold <- ((thresh[[i]]$threshold/360)*(max(scale[[i]]$Score)-min(scale[[i]]$Score)))+min(scale[[i]]$Score)
thresh[[i]]$threshold <- ((thresh[[i]]$threshold/255)*(max(scale[[i]]$Score)-min(scale[[i]]$Score)))+min(scale[[i]]$Score)
#thresh[[i]] <- thresh[[i]] %>% mutate(threshold=(scales::rescale(as.numeric(threshold)/360,to=range(scale[[i]]$Score))))
postscript(paste0(folder,"Hist_qc.",i,".",feature,".eps"))
plot(h[[i]],main=paste0("Histogram of ",feature," of sample ",i),xlab=feature)
......
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