Commit 733905bf authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Fix QuSAGE save ID for large datasets

parent 4701401d
......@@ -361,7 +361,7 @@ scCluster <- function(sc10x,res=0.1,red="pca",dim,print="tsne",folder=FALSE){
plot2 <- DimPlot(sc10x,reduction="tsne",group.by="samples")
plot3 <- DimPlot(sc10x,reduction="umap",group.by="samples")
legend <- cowplot::get_legend(plot1)
if (print=="tsne"){
postscript(paste0("./analysis/vis/",sub,"tSNE_samples.eps"))
grid.arrange(plot2,legend,ncol=1)
......@@ -579,23 +579,21 @@ scQuSAGE <- function(sc10x,gs,save=FALSE,type,id,ds=0,nm="pops",print="tsne"){
if (max(qs$path.PDF)>max.y.rg){
max.y.rg <- max(qs$path.PDF)
}}
#Plot correlation plots by geneset
for (i in 1:length(gs)){
postscript(paste0("./analysis/cor/",nm,"/geneset/QuSAGE_",nm,".",names(gs)[i],".eps"))
for (j in groups){
qs <- get(paste0("results.",j))
if (j==groups[1]){
plotDensityCurves(qs,path.index=i,col=col[match(j,groups)],main=names(gs)[i],xlim=c(min.x.rg-0.05,max.x.rg+0.05),ylim=c(0,50*ceiling(max.y.rg/50)),xlab="Gene Set Activation",lwd=5,cex.main=2.5,cex.axis=1.5,cex.lab=2)
} else {
plotDensityCurves(qs,path.index=i,add=TRUE,col=col[match(j,groups)],lwd=5)
}}
legend("topright",col=col,legend=groups,lty=1,lwd=5,cex=2,ncol=1,bty="n",pt.cex=2)
box(lwd=5)
dev.off()
}
if (type=="sm"){
#Plot correlation plots by geneset
for (i in 1:length(gs)){
postscript(paste0("./analysis/cor/",nm,"/geneset/QuSAGE_",nm,".",names(gs)[i],".eps"))
for (j in groups){
qs <- get(paste0("results.",j))
if (j==groups[1]){
plotDensityCurves(qs,path.index=i,col=col[match(j,groups)],main=names(gs)[i],xlim=c(min.x.rg-0.05,max.x.rg+0.05),ylim=c(0,50*ceiling(max.y.rg/50)),xlab="Gene Set Activation",lwd=5,cex.main=2.5,cex.axis=1.5,cex.lab=2)
} else {
plotDensityCurves(qs,path.index=i,add=TRUE,col=col[match(j,groups)],lwd=5)
}}
legend("topright",col=col,legend=groups,lty=1,lwd=5,cex=2,ncol=1,bty="n",pt.cex=2)
box(lwd=5)
dev.off()
}
#Plot correlation plots by cluster
for (i in groups){
qs <- get(paste0("results.",i))
......@@ -621,7 +619,7 @@ scQuSAGE <- function(sc10x,gs,save=FALSE,type,id,ds=0,nm="pops",print="tsne"){
merge.cluster <- NULL
for (i in groups){
if (max(qsTable(get(paste0("results.",i)),number=length(gs))[qsTable(get(paste0("results.",i)),number=length(gs))[,4]<=0.05,][,2],na.rm=TRUE)>=0){
sc10x<-eval(parse(text=paste0("RenameIdents(object=sc10x,'",sub("Cluster_","",i),"' = '",qsTable(get(paste0("results.",i)),number=length(gs))[qsTable(get(paste0("results.",i)),number=length(gs))[2]==max(qsTable(get(paste0("results.",i)),number=length(gs))[qsTable(get(paste0("results.",i)),number=length(gs))[,4]<=0.05,][,2])][1],"')")))
sc10x<-eval(parse(text=paste0("RenameIdents(object=sc10x,'",sub("Cluster_","",i),"' = '",qsTable(get(paste0("results.",i)),number=length(gs))[qsTable(get(paste0("results.",i)),number=length(gs))[2]==max(qsTable(get(paste0("results.",i)),number=length(gs))[qsTable(get(paste0("results.",i)),number=length(gs))[,4]<=0.05,][,2],na.rm=TRUE)][1],"')")))
} else {
sc10x<-eval(parse(text=paste0("RenameIdents(object=sc10x,'",sub("Cluster_","",i),"' = 'Unknown')")))
}}
......
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