如何在Pheatmap的注释行中创建检查器模式?

时间:2018-07-05 03:31:36

标签: r colors annotations pheatmap

这实际上是一个分为两部分的问题。

我正在尝试生成一个热图,其中一行属于两个注释条件。有人建议,不要使用第三种颜色来表征该组,而应使用其他两组的方格图案。可能吗?我目前正在使用pheatmap。这是一个虚拟的示例:

#Creating dummy matrix
mt=matrix(rnorm(100,5,1),nrow = 5, ncol = 5)
colnames(mt)=paste0("Sample_",1:5)
rownames(mt)=paste0("Gene_",1:5)

#Column annotation
annotC=data.frame("Group"=c(rep("G1",2),rep("G2",3)))
rownames(annotC)=colnames(mt)

#Row annotation
annotR=data.frame("Subtype"=c(rep("Sub1",2),"Sub1+Sub2",rep("Sub2",2)))
rownames(annotR)=rownames(mt)

#Annotation colors
annot_color=list("Group"=c("G1"='green',"G2"='yellow'),
                 "Subtype"=c("Sub1"='blue',"Sub1+Sub2"='purple',"Sub2"='red'))

library(pheatmap)              
pheatmap(mat,scale="row",border_color = NA,legend = T,
         annotation_col = annotC,
         annotation_row = annotR,
         annotation_colors = annot_color,
         cluster_rows = F)

在这种情况下,“ Gene_3”行不是紫色,而是红色和蓝色的方格图案。我发现this帖子中有简单的条形图,并且this建议使用网格包来修改注释栏,但是我无法建立链接。可能吗?

我的另一个疑问是,是否可以用黑体字写一行,让我们假设“ Gene_1”。还有可能吗?

先谢谢您! 最好!

0 个答案:

没有答案
相关问题