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

Fix stress/sample

parent 7536f089
......@@ -56,15 +56,15 @@ rm(results)
#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]]
#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]]
rm(results)
sc10x <- lapply(sc10x,function(x) subset(x,subset= nCount_RNA>2500))
counts.cell.filtered.3gene <- lapply(sc10x,ncol)
counts.gene.filtered.3gene <- lapply(sc10x,nrow)
#sc10x <- lapply(sc10x,function(x) subset(x,subset= nCount_RNA>2500))
#counts.cell.filtered.3gene <- lapply(sc10x,ncol)
#counts.gene.filtered.3gene <- lapply(sc10x,nrow)
counts.cell.filtered <- counts.cell.filtered.3gene
counts.gene.filtered <- counts.gene.filtered.3gene
......@@ -73,29 +73,49 @@ save.image(file="./analysis/sc10x.raw_filtered.RData")
sc10x <- sc10x[as.character(unlist(sc10x.groups[sc10x.groups$Keep==1,1]))]
# 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")
# 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="umap",assay="SCT")
# sc10x.temp <- results[[1]]
# pc.use.prestress.temp <- results[[2]]
# rm(results)
# sc10x.temp <- scCluster(sc10x.temp,res=0.5,red="pca",dim=pc.use.prestress.temp,print="umap",folder=paste0("preStress/",i),assay="SCT")
# 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)
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")
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="umap",assay="SCT")
sc10x.temp <- results[[1]]
pc.use.prestress.temp <- results[[2]]
rm(results)
sc10x.temp <- scCluster(sc10x.temp,res=0.5,red="pca",dim=pc.use.prestress.temp,print="umap",folder=paste0("preStress/",i),assay="SCT")
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)
merges <- NULL
if (opt$s == "hu"){
genes.stress <- read_delim("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/stress/genes.deg.Stress.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
genes.stress <- genes.stress[1]
colnames(genes.stress) <- "scDWS.Stress"
anchor <- c("EGR1","FOS","JUN")
} else if (opt$s == "mu"){
genes.stress <- read_delim("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/stress/van.den.Brink1.txt",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
genes.stress <- genes.stress[1]
colnames(genes.stress) <- "van.den.Brink1.Stress"
anchor <- c("Egr1","Fos","Jun")
}
results <- scScore(sc10x,score="Stress",geneset=as.list(genes.stress),cut.pt="triangle",anchor=anchor)
#sc10x.preStress <- results[[1]]
sc10x <- results[[2]]
rm(results)
counts.cell.destress <- lapply(sc10x,ncol)
rm(anchor)
# merges <- NULL
# for (i in names(counts.cell.destress[as.character(unlist(sc10x.groups[sc10x.groups$Keep==1,1]))])){
# if (counts.cell.destress[[i]]<750){
# merges <- c(merges,i)
......@@ -145,42 +165,30 @@ gc()
save.image(file="./analysis/sc10x.raw_aligned.RData")
if (ncol(sc10x) > 100) {
pc.calc <- 100
} else if (ncol(sc10x) <= 100) {
pc.calc <- ncol(sc10x)-1
}
results <- scPC(sc10x,pc=pc.calc,hpc=0.9,file=paste0("pre.stress"),print="umap",assay="integrated")
sc10x <- results[[1]]
pc.use.prestress <- results[[2]]
rm(results)
sc10x <- scCluster(sc10x,res=0.5,red="pca",dim=pc.use.prestress,print="umap",folder=paste0("preStress"),assay="integrated")
rm(pc.calc)
if (opt$s == "hu"){
genes.stress <- read_delim("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/stress/genes.deg.Stress.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
genes.stress <- genes.stress[1]
colnames(genes.stress) <- "scDWS.Stress"
anchor <- c("EGR1","FOS","JUN")
} else if (opt$s == "mu"){
genes.stress <- read_delim("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/stress/van.den.Brink1.txt",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
genes.stress <- genes.stress[1]
colnames(genes.stress) <- "van.den.Brink1.Stress"
anchor <- c("Egr1","Fos","Jun")
}
results <- scScore(list(ALL=sc10x),score="Stress",geneset=as.list(genes.stress),cut.pt="triangle",anchor=anchor)
#sc10x.preStress <- results[[1]]$ALL
sc10x <- results[[2]]$ALL
#sc10x <- results[[1]]$ALL
rm(results)
#counts.cell.destress <- lapply(sc10x,ncol)
counts.cell.destress <- ncol(sc10x)
rm(anchor)
#sc10x <- SCTransform(sc10x,vars.to.regress=c("nFeature_RNA","percent.mito","Stress1"),verbose=FALSE,return.only.var.genes=FALSE,assay="RNA")
save.image(file="./analysis/sc10x.raw_destress.RData")
# if (ncol(sc10x) > 100) {
# pc.calc <- 100
# } else if (ncol(sc10x) <= 100) {
# pc.calc <- ncol(sc10x)-1
# }
# results <- scPC(sc10x,pc=pc.calc,hpc=0.9,file=paste0("pre.stress"),print="umap",assay="integrated")
# sc10x <- results[[1]]
# pc.use.prestress <- results[[2]]
# rm(results)
# sc10x <- scCluster(sc10x,res=0.5,red="pca",dim=pc.use.prestress,print="umap",folder=paste0("preStress"),assay="integrated")
# rm(pc.calc)
#
# results <- scScore(list(ALL=sc10x),score="Stress",geneset=as.list(genes.stress),cut.pt="triangle",anchor=anchor)
# #sc10x.preStress <- results[[1]]$ALL
# sc10x <- results[[2]]$ALL
# #sc10x <- results[[1]]$ALL
# rm(results)
# #counts.cell.destress <- lapply(sc10x,ncol)
# counts.cell.destress <- ncol(sc10x)
# rm(anchor)
#
# #sc10x <- SCTransform(sc10x,vars.to.regress=c("nFeature_RNA","percent.mito","Stress1"),verbose=FALSE,return.only.var.genes=FALSE,assay="RNA")
#
# save.image(file="./analysis/sc10x.raw_destress.RData")
if (ncol(sc10x) > 1000) {
pc.calc <- 1000
......
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