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

Add DIY CustCol and Highlight tSNEs

parent 2673f2f8
Branches
Tags
No related merge requests found
......@@ -849,3 +849,35 @@ scCCA <- function(sc10x.1,sc10x.2,nm.1="D17",nm.2="D27",cc=FALSE){
)
return(results)
}
sctSNECustCol <- function(sc10x,i,bl,rd){
sc10x <- SetAllIdent(object=sc10x,id=i)
sc10x@ident <- factor(sc10x@ident,levels=c(bl,rd))
postscript(paste0("./analysis/diy/tSNE_",i,".CustCol.eps"))
if (bl!=""){
plot <- TSNEPlot(object=sc10x,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c(brewer.pal((length(bl)+1),"Blues")[2:(length(bl)+1)],brewer.pal((length(rd)+1),"Reds")[2:(length(rd)+1)]))
} else {
plot <- TSNEPlot(object=sc10x,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=brewer.pal((length(rd)+1),"Reds")[2:(length(rd)+1)])
}
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()
}
sctSNEHighlight <- function(sc10x,i,g){
sc10x <- SetAllIdent(object=sc10x,id=i)
sc10x <- SetIdent(object=sc10x,cells.use=names(sc10x@ident[!(sc10x@ident %in% g)]),ident.use="Background")
sc10x@ident <- factor(sc10x@ident,levels=c(g,"Background"))
sc10x@data <- sc10x@data[,c(colnames(sc10x@data)[!colnames(sc10x@data) %in% names(sc10x@ident[sc10x@ident==g])],names(sc10x@ident[sc10x@ident==g]))]
postscript(paste0("./analysis/diy/tSNE_",i,"_",g,".Highlight.eps"))
plot <- TSNEPlot(object=sc10x,pt.size=5,do.label=FALSE,label.size=10,do.return=TRUE,vector.friendly=FALSE,colors.use=c("darkred","grey"))
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()
}
......@@ -6,6 +6,7 @@ library(readr)
library(fBasics)
library(pastecs)
library(qusage)
library(RColorBrewer)
source("../r.scripts/sc-TissueMapper.R")
......@@ -74,6 +75,9 @@ if (!dir.exists("./analysis/tSNE/FINAL")){
if (!dir.exists("./analysis/deg")){
dir.create("./analysis/deg")
}
if (!dir.exists("./analysis/diy")){
dir.create("./analysis/diy")
}
#Retrieve command-line options
option_list=list(
......@@ -352,8 +356,32 @@ for (i in ls(pattern="^genes.deg")){
write.table(get(i),file=paste0("./analysis/deg/",i,".csv"),row.names=TRUE,col.names=NA,append=FALSE,sep=",")
}
sctSNECustCol(sc10x,i="Merge_Epi.dws_St.go",bl=c("BE","LE","OE1","OE2"),rd=c("Fib","SM","Endo","Leu"))
sctSNECustCol(sc10x.Epi,i="Epi.dws.sub",bl=c("BE","LE","OE1","OE2"),rd="")
sctSNECustCol(sc10x.St,i="St.go",bl="",rd=c("Fib","SM","Endo","Leu"))
for (g in c("Epi","St")){
sctSNEHighlight(sc10x,i="Lin",g=g)
}
for (g in c("BE","LE","OE1","OE2")){
sctSNEHighlight(sc10x,i="Merge_Epi.dws_St.go",g=g)
sctSNEHighlight(sc10x.Epi,i="Epi.dws.sub",g=g)
}
sctSNEHighlight(sc10x.Epi.NE,i="NE",g="NE")
for (g in c("Fib","SM","Endo","Leu")){
sctSNEHighlight(sc10x,i="Merge_Epi.dws_St.go",g=g)
sctSNEHighlight(sc10x.St,i="St.go",g=g)
}
for (g in c("D17PrPzF_BE","D17PrPzF_LE","D17PrPzF_OE","D17PrPzF_FMSt","D17PrPzF_Via","D17PrTzF_Via")){
sctSNEHighlight(sc10x,i="samples",g=g)
}
save(list=ls(pattern="^genes.deg"),file="./analysis/DEG.Rda")
rm(list=ls(pattern="^genes.deg"))
save(list=ls(pattern="^sc10x.Epi"),file="./analysis/sc10x.Epi.Rda")
rm(list=ls(pattern="^sc10x.Epi"))
save(list=ls(pattern="^sc10x.St"),file="./analysis/sc10x.St.Rda")
rm(list=ls(pattern="^sc10x.St"))
save(list=ls(pattern="^sc10x"),file="./analysis/sc10x.Rda")
rm(list=ls(pattern="^sc10x"))
save.image(file="./analysis/Data.RData")
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