diff --git a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pb.R b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pb.R index 4a79f530c4e8a8bbdd9c93905b3252b384428770..c58ffda0622a396162a94d65c36222cce1474fb7 100644 --- a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pb.R +++ b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pb.R @@ -114,9 +114,9 @@ opt=parse_args(OptionParser(option_list=option_list)) rm(option_list) if (opt$lm==0){opt$lm=-Inf} -sc10x <- scLoad("Pb",sub="Pb) +sc10x <- scLoad("Pb",sub="Pb") -sc10x <- scSubset(sc10x,i="Glandular",g="Glandular") +#sc10x <- scSubset(sc10x,i="Glandular",g="Glandular") if (opt$cc==TRUE){ results <- scCellCycle(sc10x) @@ -145,9 +145,9 @@ if (opt$cc==TRUE){ } gc() -sc10x.B327 <- scSubset(sc10x,"samples","BPH327PrGF_Via") -sc10x.B340 <- scSubset(sc10x,"samples","BPH340PrSF_Via") -sc10x.B342 <- scSubset(sc10x,"samples","BPH342PrF_Via") +sc10x.B327 <- scSubset(sc10x,"B327","B327") +sc10x.B340 <- scSubset(sc10x,"B340","B340") +sc10x.B342 <- scSubset(sc10x,"B342","B342") results <- sc3CCA(sc10x.B327,sc10x.B340,sc10x.B342,"B327","B340","B342",cc=opt$cc,cca=opt$cca,acca=opt$acca,lx=opt$lx,hx=opt$hx,ly=opt$ly) sc10x <- results[[1]] diff --git a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pc.R b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pc.R index 563db10d469b7a801719d664a015ca66e246c139..abcc1fda0b98a03f87fb9b6fecc8668c0a318ddc 100644 --- a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pc.R +++ b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pc.R @@ -171,4 +171,4 @@ if (opt$st==TRUE){ } sc10x.Pc <- sc10x -save(sc10x,file="./analysis/sc10x.Pc.Rda") +save(sc10x.Pc,file="./analysis/sc10x.Pc.Rda") diff --git a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pd.R b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pd.R index 065e8aab7df26418a999bc5ba69eee19987739b8..9465c96a25f10e9050784b1e99fe20849b3b7194 100644 --- a/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pd.R +++ b/r.scripts/sc-TissueMapper_RUN.PdPbPc.Pd.R @@ -169,4 +169,4 @@ if (opt$st==TRUE){ } sc10x.Pd <- sc10x -save(sc10x,file="./analysis/sc10x.Pd.Rda") +save(sc10x.Pd,file="./analysis/sc10x.Pd.Rda") diff --git a/r.scripts/sc-TissueMapper_RUN.PdPbPc.R b/r.scripts/sc-TissueMapper_RUN.PdPbPc.R index ab650eed6d7046f7e3e476f1961341c69223b88c..24eeb91a0a54e00bd2cfcc4e8b5edf1df1cd2288 100755 --- a/r.scripts/sc-TissueMapper_RUN.PdPbPc.R +++ b/r.scripts/sc-TissueMapper_RUN.PdPbPc.R @@ -111,7 +111,7 @@ option_list=list( make_option("--st",action="store",default=TRUE,type='logical',help="Remove stressed cells?"), make_option("--stg",action="store",default="dws",type='character',help="Geneset to use for stress ID"), make_option("--cut.stress",action="store",default=0.9,type='numeric',help="Cutoff for stress score"), - make_option("--res.poststress",action="store",default=0.5,type='numeric',help="Resolution to cluster, post-stress"), + make_option("--res.poststress",action="store",default=0.75,type='numeric',help="Resolution to cluster, post-stress"), make_option("--cut.ne",action="store",default=0.999,type='numeric',help="Cutoff for NE score") ) opt=parse_args(OptionParser(option_list=option_list)) @@ -141,7 +141,7 @@ for (i in c("Pb","Pc","Pd")){ sc10x <- get(paste0("sc10x.",i)) - sc10x <- scCluster(sc10x,pc.use=opt$acca,res.use=0.5,folder=paste0("post.stress/",i),red="cca.aligned") + sc10x <- scCluster(sc10x,pc.use=opt$acca,res.use=opt$res.poststress,folder=paste0("post.stress/",i),red="cca.aligned") gene.set1 <- read_delim("./genesets/DEG_Epi_5FC.txt","\t",escape_double=FALSE,trim_ws=TRUE,col_names=FALSE) gene.set1 <- as.list(gene.set1) @@ -154,7 +154,7 @@ for (i in c("Pb","Pc","Pd")){ rm(gene.set1) gc() min.all <- min(table(sc10x@meta.data[,paste0("res",0.5)])) - results <- scQuSAGE(sc10x,gs=gene.set,res.use=opt$res.poststress,ds=min.all,nm="Lin",folder=paste0("lin/",i)) + results <- scQuSAGE(sc10x,gs=gene.set,res.use=opt$res.poststress,ds=0,nm="Lin",folder=paste0("lin/",i)) sc10x <- results[[1]] results.cor.Lin <- results[[2]] results.clust.Lin.id <- results[[3]] @@ -213,7 +213,7 @@ for (i in c("Pb","Pc","Pd")){ rm(gene.set1) gc() min.epi <- min(table(sc10x.Epi@meta.data[,paste0("res",opt$res.poststress)])) - results <- scQuSAGE(sc10x.Epi,gs=gene.set,res.use=opt$res.poststress,ds=min.epi,nm="Epi.dws.sc",folder=paste0("epi/",i)) + results <- scQuSAGE(sc10x.Epi,gs=gene.set,res.use=opt$res.poststress,ds=0,nm="Epi.dws.sc",folder=paste0("epi/",i)) sc10x.Epi <- results[[1]] results.cor.Epi <- results[[2]] results.clust.Epi.id <- results[[3]] @@ -271,7 +271,7 @@ for (i in c("Pb","Pc","Pd")){ rm(gene.set1) gc() min.st <- min(table(sc10x.St@meta.data[,paste0("res",opt$res.poststress)])) - results <- scQuSAGE(sc10x.St,gs=gene.set,res.use=opt$res.poststress,ds=min.st,nm="St.dws.sc",folder=paste0("st/",i)) + results <- scQuSAGE(sc10x.St,gs=gene.set,res.use=opt$res.poststress,ds=0,nm="St.dws.sc",folder=paste0("st/",i)) sc10x.St <- results[[1]] results.cor.St <- results[[2]] results.clust.St.id <- results[[3]] @@ -309,6 +309,23 @@ for (i in c("Pb","Pc","Pd")){ sctSNE3CustCol(sc10x.sub,i="Merge",bl=c("BE","LE","Hillock","Club"),rd=c("Fib","SM","Endo"),gn=c("B-cells","T-cells","Macrophages","Mast cells"),file=paste0(i,".",substr(j[1],6,7))) } rm(sc10x.sub) + } else if (i=="Pb"){ + sc10x.sub <- scSubset(sc10x,"Glandular","Glandular") + sc10x.sub <- SetAllIdent(object=sc10x.sub,id="Merge") + sc10x.sub@ident <- factor(sc10x.sub@ident,levels=c("BE","LE","Hillock","Club","Fib","SM","Endo","B-cells","T-cells","Macrophages","Mast cells")) + sctSNE3CustCol(sc10x.sub,i="Merge",bl=c("BE","LE","Hillock","Club"),rd=c("Fib","SM","Endo"),gn=c("B-cells","T-cells","Macrophages","Mast cells"),file=paste0(i,".Glandular")) + + sc10x.sub <- scSubset(sc10x,"Stromal","Stromal") + sc10x.sub <- SetAllIdent(object=sc10x.sub,id="Merge") + sc10x.sub@ident <- factor(sc10x.sub@ident,levels=c("BE","LE","Hillock","Club","Fib","SM","Endo","B-cells","T-cells","Macrophages","Mast cells")) + sctSNE3CustCol(sc10x.sub,i="Merge",bl=c("BE","LE","Hillock","Club"),rd=c("Fib","SM","Endo"),gn=c("B-cells","T-cells","Macrophages","Mast cells"),file=paste0(i,".Stromal")) + + for (j in c("BPH327PrGF_Via","BPH327PrSF_Via")){ + sc10x.sub <- scSubset(sc10x,"samples",j) + sc10x.sub <- SetAllIdent(object=sc10x.sub,id="Merge") + sc10x.sub@ident <- factor(sc10x.sub@ident,levels=c("BE","LE","Hillock","Club","Fib","SM","Endo","B-cells","T-cells","Macrophages","Mast cells")) + sctSNE3CustCol(sc10x.sub,i="Merge",bl=c("BE","LE","Hillock","Club"),rd=c("Fib","SM","Endo"),gn=c("B-cells","T-cells","Macrophages","Mast cells"),file=paste0(i,".",substr(j,4,6),substr(j,9,9))) + } } write.table(table(sc10x@meta.data[,"samples"],sc10x@meta.data[,"Merge"]),file=paste0("./analysis/table/Table_samples_Merge",i,".csv"),row.names=TRUE,col.names=NA,append=FALSE,sep=",")