Commit 49153fc7 authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Fix row order for custom score heatmap

parent 5e9fc82b
......@@ -87,22 +87,7 @@ postscript(paste0("./analysis/vis/diy/UMAP_lin.res0.5.eps"))
DimPlot(sc10x)+theme_cowplot()
dev.off()
labs.lin <- singler.lin$labels
labs.lin <- replace(labs.lin,labs.lin=="Epithelial_cells","Epi")
labs.lin <- replace(labs.lin,labs.lin %in% c("Smooth_muscle_cells"),"FMSt")
labs.lin <- replace(labs.lin,labs.lin == "Endothelial_cells","Endo")
labs.lin <- replace(labs.lin,labs.lin %in% c("NK_cell","Monocyte"),"Leu")
labs.lin <- data.frame(Cell.Lineage=labs.lin,row.names=rownames(singler.lin))
labs.lin$Cell.Lineage <- factor(labs.lin$Cell.Lineage,levels=c("Epi","FMSt","Endo","Leu"))
labs.lin.col <- list(
Cell.Lineage=c(Epi=magma(4)[1],FMSt=magma(4)[2],Endo=magma(4)[3],Leu=magma(4)[4])
)
singler.lin@listData$scores <- singler.lin@listData$scores[,c(3,13,27,23,2,19,20,26,25,11,12,28,18,24,17,10,21,9,14,29,30,31,32,6,16,34,35,4,36,33,7,15,1,5,8,22)]
plot <- plotScoreHeatmap(singler.lin,show.labels=FALSE,show.pruned=FALSE,annotation_col=labs.lin,cluster_rows=FALSE,annotation_colors=labs.lin.col,cells.order= as.integer(c(1,2,14,4,5,10,7,8,9,6,3,12,13,11)))
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])))
......@@ -174,12 +159,6 @@ postscript(paste0("./analysis/vis/diy/Dot_fmst.pops.anchor.eps"))
DotPlot(sc10x.fmst,features=rev(c("DCN","MYL9")),dot.scale=10,cols=rev(heat.colors(2)))
dev.off()
labs.epi <- singler.epi$labels
labs.epi <- data.frame(Cell.Type=labs.epi,row.names=rownames(singler.epi))
labs.epi$Cell.Type <- factor(labs.epi$Cell.Type,levels=c("BE","LE","Hillock","Club","NE"))
labs.epi.col <- list(
Cell.Type=c(BE=hue_pal()(5)[1],LE=hue_pal()(5)[2],Hillock=hue_pal()(5)[3],Club=hue_pal()(5)[4],NE=hue_pal()(5)[5])
)
singler.epi@listData$scores <- singler.epi@listData$scores[,c(1,2,4,3,5)]
plot <- plotScoreHeatmap(singler.epi,show.labels=FALSE,show.pruned=FALSE,annotation_col=labs.epi,cluster_rows=FALSE,annotation_colors=labs.epi.col)
postscript(paste0("./analysis/vis/diy/Corr_epi.eps"))
......@@ -187,12 +166,6 @@ 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 Epi Cell Types",column_title_side="bottom",column_title="Human Epi Cells")
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"))
......
......@@ -56,6 +56,7 @@ postscript(paste0("./analysis/vis/diy/UMAP_lin.split.eps"))
DimPlot(sc10x,split.by="Region")+scale_color_viridis(discrete=TRUE,option="magma")+theme_cowplot()
dev.off()
singler.lin@listData$scores <- singler.lin@listData$scores[,c(14,7,5,9,10,16,12,3,11,2,1,4,8,13,15,6)]
cor.lin <- as.matrix(singler.lin@listData$scores)
cor.lin <- cor.lin[c(1:5,8:10,13:18,20:21,19,12,7,11,6,22),]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(c(rep("Epi",16),rep("FMSt",2),"Endo",rep("Leu",3)),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])))
......@@ -114,6 +115,7 @@ postscript(paste0("./analysis/vis/diy/UMAP_epi.split.ur.eps"))
DimPlot(sc10x.epi.ur)+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
singler.epi@listData$scores <- singler.epi@listData$scores[,c(1,3,2)]
cor.epi <- as.matrix(singler.epi@listData$scores)
cor.epi <- cor.epi[c(2,3,4,6,1,5),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(c("BE","Ur","VP LE","DLP LE","AP LE","ED"),levels=c("BE","Ur","VP LE","DLP LE","AP LE","ED")),col=list(ID=c("BE"="brown3","Ur"="brown2","LE"="brown1"),Cell.Type=c("BE"=brewer.pal(n=6,name="Dark2")[1],"Ur"=brewer.pal(n=6,name="Dark2")[2],"VP LE"=brewer.pal(n=6,name="Dark2")[3],"DLP LE"=brewer.pal(n=6,name="Dark2")[4],"AP LE"=brewer.pal(n=6,name="Dark2")[5],"ED"=brewer.pal(n=6,name="Dark2")[6])))
......@@ -189,6 +191,9 @@ E.MTAB.4991 <- c(E.MTAB.4991_BE,E.MTAB.4991_LE,E.MTAB.4991_OE)
sc10x.epi$CellType <- sc10x.epi$`Cell Type`
Idents(sc10x.epi) <- "CellType"
sc10x.epi <- RenameIdents(sc10x.epi,"VPr LE"="VPrLE")
sc10x.epi <- RenameIdents(sc10x.epi,"DLPr LE"="DLPrLE")
sc10x.epi <- RenameIdents(sc10x.epi,"APr LE"="APrLE")
sc10x.epi$CellType <- Idents(sc10x.epi)
sc10x.epi$CellType <- factor(sc10x.epi$CellType,levels=c("BE","Ur","VPrLE","DLPrLE","APrLE","ED"))
results <- scQuSAGE(sc10x.epi,gs=E.MTAB.4991,type="sm",id="CellType",nm="E.MTAB.4991",print="umap")
\ No newline at end of file
results <- scQuSAGE(sc10x.epi,gs=E.MTAB.4991,type="sm",id="CellType",nm="E.MTAB.4991",print="umap")
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