Commit a7e3307e authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Add custom coor plots for PdPgb

parent 527dfef0
......@@ -6,6 +6,7 @@ library(gridExtra)
library(RColorBrewer)
library(viridis)
library(scales)
library(ComplexHeatmap)
options(bitmapType="cairo")
......@@ -101,6 +102,13 @@ postscript(paste0("./analysis/vis/diy/Corr_lin.eps"))
print(plot)
dev.off()
cor.lin <- as.matrix(singler.lin@listData$scores)
cor.lin <- cor.lin[c(1:2,7:12,14,4,6,13,3,5),]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.0.5)][c(1:2,7:12,14,4,6,13,3,5)],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
postscript(paste0("./analysis/vis/diy/CorrCustom_lin.eps"))
Heatmap(scale(t(cor.lin)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.lin.ann,row_title="ImmGen Cell Types",column_title_side="bottom",column_title="Mouse Clusters")
dev.off()
sc10x.epi$Phenotype <- sc10x.epi$samples
Idents(sc10x.epi) <- "Phenotype"
sc10x.epi <- RenameIdents(sc10x.epi,"D17PrPzF_Via"="Normal")
......@@ -112,7 +120,6 @@ sc10x.epi <- RenameIdents(sc10x.epi,"D35PrTzF_Via"="Normal")
sc10x.epi <- RenameIdents(sc10x.epi,"BPH327PrGF_Via"="BPH")
sc10x.epi <- RenameIdents(sc10x.epi,"BPH340PrGF_Via"="BPH")
sc10x.epi <- RenameIdents(sc10x.epi,"BPH342PrF_Via"="BPH")
sc10x.epi <- RenameIdents(sc10x.epi,"BPH389PrGF"="BPH")
sc10x.epi$Phenotype <- Idents(sc10x.epi)
sc10x.epi$Phenotype <- factor(sc10x.epi$Phenotype,levels=c("Normal","BPH"))
......@@ -121,10 +128,10 @@ sc10x.epi$`Cell Type` <- factor(sc10x.epi$`Cell Type`,levels=c("BE","LE","Hilloc
Idents(sc10x.epi) <- "Cell Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.eps"))
DimPlot(sc10x.epi)+theme_cowplot()
DimPlot(sc10x.epi)+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.split.eps"))
DimPlot(sc10x.epi,split.by="Phenotype")+theme_cowplot()
DimPlot(sc10x.epi,split.by="Phenotype")+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/Dot_epi.pops.anchor.eps"))
......@@ -142,7 +149,6 @@ sc10x.fmst <- RenameIdents(sc10x.fmst,"D35PrTzF_Via"="Normal")
sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH327PrGF_Via"="BPH")
sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH340PrGF_Via"="BPH")
sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH342PrF_Via"="BPH")
sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH389PrGF"="BPH")
sc10x.fmst$Phenotype <- Idents(sc10x.fmst)
sc10x.fmst$Phenotype <- factor(sc10x.fmst$Phenotype,levels=c("Normal","BPH"))
......@@ -151,10 +157,10 @@ sc10x.fmst$`Cell Type` <- factor(sc10x.fmst$`Cell Type`,levels=c("Fib","SM"))
Idents(sc10x.fmst) <- "Cell Type"
postscript(paste0("./analysis/vis/diy/UMAP_fmst.pops.eps"))
DimPlot(sc10x.fmst)+theme_cowplot()
DimPlot(sc10x.fmst)+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/UMAP_fmst.pops.split.eps"))
DimPlot(sc10x.fmst,split.by="Phenotype")+theme_cowplot()
DimPlot(sc10x.fmst,split.by="Phenotype")+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
postscript(paste0("./analysis/vis/diy/Dot_fmst.pops.anchor.eps"))
......@@ -173,6 +179,13 @@ postscript(paste0("./analysis/vis/diy/Corr_epi.eps"))
print(plot)
dev.off()
cor.epi <- as.matrix(singler.epi@listData$scores)
cor.epi <- cor.epi[order(sc10x.epi$`Cell Type`[match(singler.epi@rownames,names(sc10x.epi$`Cell Type`))]),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(sc10x.epi$`Cell Type`[match(singler.epi@rownames,names(sc10x.epi$`Cell Type`))][order(sc10x.epi$`Cell Type`[match(singler.epi@rownames,names(sc10x.epi$`Cell Type`))])],levels=c("BE","LE","Hillock","Club","NE")),col=list(Cell.Type=c("BE"=brewer.pal(n=5,name="Dark2")[1],"LE"=brewer.pal(n=5,name="Dark2")[2],"Hillock"=brewer.pal(n=5,name="Dark2")[3],"Club"=brewer.pal(n=5,name="Dark2")[4],"NE"=brewer.pal(n=5,name="Dark2")[5])))
postscript(paste0("./analysis/vis/diy/CorrCustom_epi.eps"))
Heatmap(scale(t(cor.epi)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.epi.ann,row_title="Human Cell Types",column_title_side="bottom",column_title="Mouse Epi Clusters")
dev.off()
labs.fmst <- singler.fmst$labels
labs.fmst <- data.frame(Cell.Type=labs.fmst,row.names=rownames(singler.fmst))
labs.fmst$Cell.Type <- factor(labs.fmst$Cell.Type,levels=c("Fib","SM"))
......@@ -184,5 +197,12 @@ postscript(paste0("./analysis/vis/diy/Corr_fmst.eps"))
print(plot)
dev.off()
cor.fmst <- as.matrix(singler.fmst@listData$scores)
cor.fmst <- cor.fmst[order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames,names(sc10x.fmst$`Cell Type`))]),]
cor.fmst.ann <- columnAnnotation(Cell.Type=factor(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames,names(sc10x.fmst$`Cell Type`))][order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames,names(sc10x.fmst$`Cell Type`))])],levels=c("Fib","SM")),col=list(Cell.Type=c("Fib"=brewer.pal(n=3,name="Dark2")[1],"SM"=brewer.pal(n=3,name="Dark2")[2])))
postscript(paste0("./analysis/vis/diy/CorrCustom_fmst.eps"))
Heatmap(scale(t(cor.fmst)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.fmst.ann,row_title="Human Cell Types",column_title_side="bottom",column_title="Mouse FMSt Clusters")
dev.off()
write.table(table(sc10x$`Cell Type`,sc10x$samples),file="./analysis/vis/diy/Table_pops.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell Type`,sc10x$Phenotype),file="./analysis/vis/diy/Table_pops.Phenotype.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
\ No newline at end of file
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