Commit 1337e208 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Fix QC filtering

parent c07f465f
...@@ -160,14 +160,13 @@ scQC <- function(sc10x,sub=FALSE,sp="hu"){ ...@@ -160,14 +160,13 @@ scQC <- function(sc10x,sub=FALSE,sp="hu"){
threshPlot <- list() threshPlot <- list()
cell.remove <- NULL cell.remove <- NULL
Idents(object=sc10x) <- "samples" Idents(object=sc10x) <- "samples"
sc10x.sub <- sc10x
for (i in c("nFeature_RNA","percent.mito")){ for (i in c("nFeature_RNA","percent.mito")){
if (i %in% c("nCount_RNA","nFeature_RNA")){ if (i %in% c("nCount_RNA","nFeature_RNA")){
thresh <- scThresh(sc10x.sub,feature=i,direction="b",name=i) thresh <- scThresh(sc10x,feature=i,direction="b",name=i)
} else { } else {
thresh <- scThresh(sc10x.sub,feature=i,direction="h",name=i) thresh <- scThresh(sc10x,feature=i,direction="h",name=i)
} }
data <- FetchData(sc10x.sub,vars=i) data <- FetchData(sc10x,vars=i)
if (i %in% c("nCount_RNA","nFeature_RNA")){ if (i %in% c("nCount_RNA","nFeature_RNA")){
cell.remove <- c(cell.remove,rownames(data)[data[,1] < thresh[[2]] | data[,1] > thresh[[1]]]) cell.remove <- c(cell.remove,rownames(data)[data[,1] < thresh[[2]] | data[,1] > thresh[[1]]])
} else { } else {
...@@ -177,6 +176,7 @@ scQC <- function(sc10x,sub=FALSE,sp="hu"){ ...@@ -177,6 +176,7 @@ scQC <- function(sc10x,sub=FALSE,sp="hu"){
plot(thresh[[3]]) plot(thresh[[3]])
dev.off() dev.off()
} }
sc10x.sub <- subset(sc10x,cells=WhichCells(sc10x,cells=cell.remove,invert=TRUE))
# threshPlot <- list() # threshPlot <- list()
# cell.remove <- NULL # cell.remove <- NULL
......
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