0

ヒートマップを作成していますが、プロットする前に結果を確認するために結果を変数に割り当てることができません。Rstudio が自動的にプロットします。ヒートマップの順に行名のリストを取得したいと思います。これが可能かどうかはわかりません。私はこのコードを使用しています:

hm <-    heatmap.2( assay(vsd)[ topVarGenes, ], scale="row", 
         trace="none", dendrogram="both", 
         col = colorRampPalette( rev(brewer.pal(9, "RdBu")) )(255),
         ColSideColors = c(Controle="gray", Col1.7G2="darkgreen", JG="blue", Mix="orange")[
           colData(vsd)$condition ] )
4

2 に答える 2

1

プロットをオブジェクトに割り当てることができます。プロットは引き続きプロット ウィンドウに描画されますが、各プロット要素のすべてのデータを含むリストも表示されます。次に、リストから目的のプロット要素を抽出するだけです。例えば:

library(gplots)

p = heatmap.2(as.matrix(mtcars), dendrogram="both", scale="row")

pプロットのすべての要素を含むリストです。

p # Outputs all the data in the list; lots of output to the console

str(p) # Struture of p; also lots of output to the console

names(p) # Names of all the list elements

p$rowInd # Ordering of the data rows

p$carpet # The heatmap values

リスト要素を調べると、デンドログラムとヒートマップに関連付けられた他のすべての値が表示されます。

于 2016-02-25T20:10:52.560 に答える
0

他の人には、gplots によって作成されたヒートマップのマトリックス表現をキャプチャするためのより完全な説明方法:

matrix_map <- p$carpet
matrix_map <- t(matrix_map)
于 2016-02-28T19:46:29.363 に答える