我正在使用R包cummeRbund(来自Bioconductor)来可视化RNA-seq数据,我创建了一个名为“DEG_genes”的cuffGeneSet实例,其中包含662个在男性和女性之间显着差异表达的基因。我的目标是使用csHeatmap()创建一个热图,其中男性和女性样本(复制品)是分开的,但在性别类别中具有特定的用户定义顺序。 我用过:
> DEG<-diffData(genes(cuff)) # take differentially expressed genes
> DEG_significant<-subset(DEG,significant=='yes') # retain only significant changes
> DEG_sign_IDs <- DEG_significant$gene_id # retrieve IDs
> DEG_genes<-getGenes(cuff,DEG_sign_IDs) # get CuffGeneSet instance
> hmap<-csHeatmap(DEG_genes,clustering='none',labRow=F,replicates=T)
这给了我几乎我想要的东西:热图显示左边的女性和右边的男性,但它们按字母顺序排列(Female_0,Female_1,Female_10,Female_11,Female_12 ...... Female_19,Female_2,Female_20,Female_21 .. ,左边是Female_29,男性同样是Male_0,Male_1,Male_10 ... Male_19,Male_2,Male_20 ......等等,我希望它们按特定顺序(clusterReps)。我创建了一个测试向量,其中包含特定顺序的复制名称(左边是男性,右边是0和6,右边是女性),如下所示:
clusterReps<-c("Male_6","Male_1","Male_2","Male_3","Male_4","Male_5","Male_0","Male_7","Male_8","Male_9","Male_10","Male_11","Male_12","Male_13","Male_14","Male_15","Male_16","Male_17","Male_18","Male_19","Male_20","Male_21","Male_22","Male_23","Male_24","Male_25","Male_26","Male_27","Male_28","Male_29","Male_30","Male_31","Male_32","Male_33","Female_0","Female_1","Female_2","Female_3","Female_4","Female_5","Female_6","Female_7","Female_8","Female_9","Female_10","Female_11","Female_12","Female_13","Female_14","Female_15","Female_16","Female_17","Female_18","Female_19","Female_20","Female_21","Female_22","Female_23","Female_24","Female_25","Female_26","Female_27","Female_28")
我希望数据完全相同,除了必须遵循“clusterReps”向量顺序的列的顺序。知道热图是一个ggplot,我在过去的两天里到处寻找解决方案,但没有成功(尽管在stackoverflow上使用heatmap.2()而不是csHeatmap()有一个严重的问题,我试图得到一个复制的fpkm矩阵并使用heatmap.2但只能使用heatmap_2并且不接受某些选项。 使用:
> hmap<-hmap+scale_x_discrete(limits=clusterReps)
Scale for 'x' is already present. Adding another scale for 'x', which will replace the existing scale.
仅更改x轴标签,但不更改实际数据(热图保持相同)。 是否有类似的功能重新排列列而不仅仅是标签? 在此先感谢您的帮助,我不熟悉处理ggplot对象,特别是cummeRbund的热图。
编辑: 以下是我可以提供的更多信息:
> DEG_genes
CuffGeneSet instance for 662 genes
Slots:
annotation
fpkm
repFpkm
diff
count
isoforms CuffFeatureSet instance of size 930
TSS CuffFeatureSet instance of size 785
CDS CuffFeatureSet instance of size 230
promoters CuffFeatureSet instance of size 662
splicing CuffFeatureSet instance of size 785
relCDS CuffFeatureSet instance of size 662
> summary(DEG_genes)
Length Class Mode
662 CuffGeneSet S4
我恐怕暂时无法提供更多信息,如果您希望我执行命令并报告输出,请告诉我。
答案 0 :(得分:0)
我对R不是很流利,但我遇到了同样的问题。为了解决这个问题,我制作了一个脚本,将cuffdiff文件夹中所有文件中的所有样本名称重命名为按字母顺序排序时给出正确顺序的内容,然后重建数据库。