Skip to content
Snippets Groups Projects
Commit 24243f74 authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Add DIY visualizations for D27 (merge duplicated pops, re-make merge.ID, SubClust, Highlights)

parent a68dc49e
No related merge requests found
library(methods)
library(Seurat)
library(RColorBrewer)
setwd("../")
if (!dir.exists("./analysis/DIY")){
dir.create("./analysis/DIY")
}
load("~/R-Analysis/SingleCell/PIPELINE/RUN/D27PrF/sc-TissueMapper_Pr/analysis/sc10x.D27PrF.ALL.cluster.NOStress.IDepi+st+ne.Merge.Rda")
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="SubClust.ID")
BE.cell <- names(sc10x.Group@ident[sc10x.Group@ident=="BE1"])
BE.cell <- c(BE.cell,names(sc10x.Group@ident[sc10x.Group@ident=="BE2"]))
Fib.cell <- names(sc10x.Group@ident[sc10x.Group@ident=="Fib1"])
Fib.cell <- c(Fib.cell,names(sc10x.Group@ident[sc10x.Group@ident=="Fib2"]))
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=BE.cell,ident.use="BE")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Fib.cell,ident.use="Fib")
sc10x.Group@ident <- factor(sc10x.Group@ident,levels=c(
unique(as.character(sc10x.Group@ident)[grep("^Epi",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^BE",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^BC",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^LE",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^AT2",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^OE",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^CGC",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^NE",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^St",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^Fib",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^ProlFib",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^MatFib",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^SM",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^MyoFibSM",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^Endo",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^Peri",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^Leu",as.character(sc10x.Group@ident))]),
unique(as.character(sc10x.Group@ident)[grep("^MylImm",as.character(sc10x.Group@ident))])))
sc10x.Group <- StashIdent(object=sc10x.Group,save.name="ID")
postscript(paste0("./analysis/DIY/tSNE_Global.Merge.ID.merge.eps"))
plot <- TSNEPlot(object=sc10x.Group,pt.size=5,do.label=TRUE,label.size=10,do.return=TRUE,vector.friendly=FALSE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
postscript(paste0("./analysis/DIY/tSNE_Global.Merge.ID.merge.CustCol.eps"))
plot <- TSNEPlot(object=sc10x.Group,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c(brewer.pal(5,"Blues")[2:5],brewer.pal(5,"Reds")[2:5]))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
load("~/R-Analysis/SingleCell/PIPELINE/RUN/D27PrF/sc-TissueMapper_Pr/analysis/sc10x.D27PrF.ALL.EpiSubcluster.NOStress.IDepi.Rda")
sc10x.Group.Epi <- SetAllIdent(object=sc10x.Group.Epi,id="Epi.sub.sc")
BE.cell <- names(sc10x.Group.Epi@ident[sc10x.Group.Epi@ident=="BE1"])
BE.cell <- c(BE.cell,names(sc10x.Group.Epi@ident[sc10x.Group.Epi@ident=="BE2"]))
sc10x.Group.Epi <- SetIdent(object=sc10x.Group.Epi,cells.use=BE.cell,ident.use="BE")
sc10x.Group.Epi@ident <- factor(sc10x.Group.Epi@ident,levels=c(
unique(as.character(sc10x.Group.Epi@ident)[grep("^Epi",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^BE",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^BC",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^LE",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^AT2",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^OE",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^CGC",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^NE",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^St",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^Fib",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^ProlFib",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^MatFib",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^SM",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^MyoFibSM",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^Endo",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^Peri",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^Leu",as.character(sc10x.Group.Epi@ident))]),
unique(as.character(sc10x.Group.Epi@ident)[grep("^MylImm",as.character(sc10x.Group.Epi@ident))])))
sc10x.Group.Epi <- StashIdent(object=sc10x.Group.Epi,save.name="ID")
postscript(paste0("./analysis/DIY/tSNE_SubClust.Epi.sub.sc.merge.eps"))
plot <- TSNEPlot(object=sc10x.Group.Epi,pt.size=5,do.label=TRUE,label.size=10,do.return=TRUE,vector.friendly=FALSE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
postscript(paste0("./analysis/DIY/tSNE_SubClust.Epi.sub.sc.merge.CustCol.eps"))
plot <- TSNEPlot(object=sc10x.Group.Epi,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=brewer.pal(5,"Blues")[2:5])
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
load("~/R-Analysis/SingleCell/PIPELINE/RUN/D27PrF/sc-TissueMapper_Pr/analysis/sc10x.D27PrF.ALL.StSubcluster.NOStress.IDst.Rda")
sc10x.Group.St <- SetAllIdent(object=sc10x.Group.St,id="St.sub.sc")
Fib.cell <- names(sc10x.Group.St@ident[sc10x.Group.St@ident=="Fib1"])
Fib.cell <- c(Fib.cell,names(sc10x.Group.St@ident[sc10x.Group.St@ident=="Fib2"]))
sc10x.Group.St <- SetIdent(object=sc10x.Group.St,cells.use=Fib.cell,ident.use="Fib")
sc10x.Group.St@ident <- factor(sc10x.Group.St@ident,levels=c(
unique(as.character(sc10x.Group.St@ident)[grep("^Epi",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^BE",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^BC",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^LE",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^AT2",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^OE",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^CGC",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^NE",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^St",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^Fib",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^ProlFib",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^MatFib",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^SM",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^MyoFibSM",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^Endo",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^Peri",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^Leu",as.character(sc10x.Group.St@ident))]),
unique(as.character(sc10x.Group.St@ident)[grep("^MylImm",as.character(sc10x.Group.St@ident))])))
sc10x.Group.St <- StashIdent(object=sc10x.Group.St,save.name="ID")
postscript(paste0("./analysis/DIY/tSNE_SubClust.St.sub.sc.merge.eps"))
plot <- TSNEPlot(object=sc10x.Group.St,pt.size=5,do.label=TRUE,label.size=10,do.return=TRUE,vector.friendly=FALSE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
postscript(paste0("./analysis/DIY/tSNE_SubClust.St.sub.sc.merge.CustCol.eps"))
plot <- TSNEPlot(object=sc10x.Group.St,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=brewer.pal(5,"Reds")[2:5])
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
for (i in c("D27PrTzF_BE","D27PrTzF_LE","D27PrTzF_OE","D27PrTzF_Edn","D27PrTzF_StPDPNn","D27PrTzF_StPDPNp","D27PrTzF_Via","D27PrTzF_Via")){
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="samples")
Sub.cell <- names(sc10x.Group@ident[sc10x.Group@ident==i])
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ALL")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=names(sc10x.Group@ident),ident.use="Background")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Sub.cell,ident.use=i)
sc10x.Group@data <- sc10x.Group@data[,c(colnames(sc10x.Group@data)[!colnames(sc10x.Group@data) %in% names(sc10x.Group@ident[sc10x.Group@ident==i])],names(sc10x.Group@ident[sc10x.Group@ident==i]))]
postscript(paste0("./analysis/DIY/tSNE_Global.Merge.ID.Highlight.",i,".eps"))
plot <- TSNEPlot(object=sc10x.Group,pt.size=0.5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("grey","darkred"))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
}
for (i in c("BE","LE","OE_KRT13","OE_PSCA","Fib","SM","Endo","Leu")){
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ID")
Sub.cell <- names(sc10x.Group@ident[sc10x.Group@ident==i])
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ALL")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=names(sc10x.Group@ident),ident.use="Background")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Sub.cell,ident.use=i)
sc10x.Group@data <- sc10x.Group@data[,c(colnames(sc10x.Group@data)[!colnames(sc10x.Group@data) %in% names(sc10x.Group@ident[sc10x.Group@ident==i])],names(sc10x.Group@ident[sc10x.Group@ident==i]))]
postscript(paste0("./analysis/DIY/tSNE_Global.Merge.ID.Highlight.",i,".eps"))
plot <- TSNEPlot(object=sc10x.Group,pt.size=0.5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("grey","darkred"))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
}
for (i in c("Epi","St")){
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="Lineage")
Sub.cell <- names(sc10x.Group@ident[sc10x.Group@ident==i])
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ALL")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=names(sc10x.Group@ident),ident.use="Background")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Sub.cell,ident.use=i)
sc10x.Group@data <- sc10x.Group@data[,c(colnames(sc10x.Group@data)[!colnames(sc10x.Group@data) %in% names(sc10x.Group@ident[sc10x.Group@ident==i])],names(sc10x.Group@ident[sc10x.Group@ident==i]))]
postscript(paste0("./analysis/DIY/tSNE_Global.Merge.ID.Highlight.",i,".eps"))
plot <- TSNEPlot(object=sc10x.Group,pt.size=0.5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("grey","darkred"))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
}
for (i in c("BE","LE","OE_KRT13","OE_PSCA")){
sc10x.Group.Epi <- SetAllIdent(object=sc10x.Group.Epi,id="ID")
Sub.cell <- names(sc10x.Group.Epi@ident[sc10x.Group.Epi@ident==i])
sc10x.Group.Epi <- SetAllIdent(object=sc10x.Group.Epi,id="ALL")
sc10x.Group.Epi <- SetIdent(object=sc10x.Group.Epi,cells.use=names(sc10x.Group.Epi@ident),ident.use="Background")
sc10x.Group.Epi <- SetIdent(object=sc10x.Group.Epi,cells.use=Sub.cell,ident.use=i)
sc10x.Group.Epi@data <- sc10x.Group.Epi@data[,c(colnames(sc10x.Group.Epi@data)[!colnames(sc10x.Group.Epi@data) %in% names(sc10x.Group.Epi@ident[sc10x.Group.Epi@ident==i])],names(sc10x.Group.Epi@ident[sc10x.Group.Epi@ident==i]))]
postscript(paste0("./analysis/DIY/tSNE_SubClust.Epi.sub.sc.Highlight.",i,".eps"))
plot <- TSNEPlot(object=sc10x.Group.Epi,pt.size=0.5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("grey","darkred"))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
}
for (i in c("Fib","SM","Endo","Leu")){
sc10x.Group.St <- SetAllIdent(object=sc10x.Group.St,id="ID")
Sub.cell <- names(sc10x.Group.St@ident[sc10x.Group.St@ident==i])
sc10x.Group.St <- SetAllIdent(object=sc10x.Group.St,id="ALL")
sc10x.Group.St <- SetIdent(object=sc10x.Group.St,cells.use=names(sc10x.Group.St@ident),ident.use="Background")
sc10x.Group.St <- SetIdent(object=sc10x.Group.St,cells.use=Sub.cell,ident.use=i)
sc10x.Group.St@data <- sc10x.Group.St@data[,c(colnames(sc10x.Group.St@data)[!colnames(sc10x.Group.St@data) %in% names(sc10x.Group.St@ident[sc10x.Group.St@ident==i])],names(sc10x.Group.St@ident[sc10x.Group.St@ident==i]))]
postscript(paste0("./analysis/DIY/tSNE_SubClust.St.sub.sc.Highlight.",i,".eps"))
plot <- TSNEPlot(object=sc10x.Group.St,pt.size=0.5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("grey","darkred"))
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20),legend.text=element_text(size=20))
plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot)
dev.off()
}
\ No newline at end of file
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