Commit 42ab2961 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Add dynamic component calculation based on cell number (RAW)

parent f83b35f5
......@@ -70,7 +70,12 @@ pc.use.prestress <- list()
for (i in names(sc10x)){
sc10x.temp <- sc10x[[i]]
sc10x.temp <- SCTransform(sc10x.temp,vars.to.regress=c("nFeature_RNA","percent.mito"),verbose=FALSE,assay="RNA")
results <- scPC(sc10x.temp,pc=100,hpc=0.9,file=paste0(i,".pre.stress"),print="2",assay="SCT")
if (ncol(sc10x.temp) > 100) {
pc.calc <- 100
} else if (ncol(sc10x.temp) <= 100) {
pc.calc <- ncol(sc10x.temp)-1
}
results <- scPC(sc10x.temp,pc=pc.calc,hpc=0.9,file=paste0(i,".pre.stress"),print="2",assay="SCT")
sc10x.temp <- results[[1]]
pc.use.prestress.temp <- results[[2]]
rm(results)
......@@ -78,6 +83,7 @@ for (i in names(sc10x)){
sc10x[i] <- sc10x.temp
pc.use.prestress[i] <- pc.use.prestress.temp
rm(sc10x.temp)
rm(pc.calc)
rm(pc.use.prestress.temp)
}
rm(i)
......@@ -129,10 +135,18 @@ if (length(sc10x)>1){
}
gc()
results <- scPC(sc10x,pc=1000,hpc=0.9,file="ALL",print="2")
if (ncol(sc10x) > 1000) {
pc.calc <- 1000
} else if (ncol(sc10x) > 500) {
pc.calc <- 500
} else if (ncol(sc10x) > 100) {
pc.calc <- ncol(sc10x)-1
}
results <- scPC(sc10x,pc=pc.calc,hpc=0.9,file="ALL",print="2")
sc10x <- results[[1]]
pc.use.poststress <- results[[2]]
rm(results)
rm(pc.calc)
res <- c(seq(0.1,0.5,0.1),0.75,seq(1,5,1))
......
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