問題タブ [pheatmap]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
1639 参照

r - Something weird in pheatmap (a bug?)

Reproducible Data:

Data Description:

df has 5 numerical variables. I did the K-means algorithm according to these 5 attributes and produced a new categorical variable GRP which has 4 levels. Next, I ordered it with GRP and named it df.order.


What I did with pheatmap:

Error in annotation_colors[[colnames(annotation)[i]]] : subscript out of bounds


Here is where I got something weird:

At first, I guess the problem resulted from the argument annotation_row.I check the row names of the two data frames.

You can see that they are equal. However, I executed the following code and the heatmap work.

Theoretically this code "rownames(colormat) <- rownames(ann_row)" should make no sense because these two objects are equal originally, but why does it make the pheatmap() function work?


Edit: From @steveb's comment, I don't even have to set the rownames using ann_row. I just set

and the pheatmap also works. This situation is still counterintuitive.


Final Output:

enter image description here

0 投票する
1 に答える
2220 参照

r - Pheatmap display_numbers 引数

内で意味のある星を使用して表示する必要がありpheatmpます。以下のアプローチを利用しました。ご覧のとおり、図で報告された星はセルの境界を越えています。セル内で中央に配置する方法はありますか?

0 投票する
1 に答える
891 参照

r - Rでpheatmapを使用して各行の最小/最大にカラースケールを固定する方法

現在、R で pheatmap を使用して、単一細胞データから遺伝子発現のヒートマップを作成しています。

私が現在抱えている問題は、Morpheus などの他のヒートマップ ジェネレーターで使用されている相対的なカラー スケールを再現できないことです: https://software.broadinstitute.org/morpheus/

詳細に説明すると、Morpheus では、カラー スケールを各行の最小値と最大値に固定できます。たとえば、カラースケールが次のような単純なものであると仮定すると、モーフィアスが最初の行で 0 ダークブルーと 6 ダークレッドを色付けし、10 がダークブルーで 16 が 2 番目の行でダークレッドになるc('dark_blue', 'blue', 'bright_blue', 'white', 'bright_red', 'red', 'dark_red')ように見えるマトリックスを提供します。 t(data.frame(row1=c(0, 1, 2, 3, 4, 5, 6), row2=c(10, 11, 12, 13, 14, 15, 16))),. カラー バーは、各行の相対的な最小値と最大値を表します。

これは、データを単純にスケーリングすることと同じではないことに注意してください。これは、私が pheatmap で行ってきたことです。問題は、 のようなものがある場合t(data.frame(row1=c(1, 2, 3, 4, 5, 6), row2=c(10, 0, 0, 0, 0, 0)))、データをスケーリングしても、カラースケールが最小値 (スケーリング後 ~-0.41) と最大 (ヒートマップ全体で約 2.04 (スケーリング後)。

これを実現する簡単な方法があることは間違いありませんが、基本的なドキュメントを調べてもわかりませんでした。また、この方法でヒートマップを表示すると遺伝子間の比較ができないことも理解していますが、それは私の用途では特に重要ではありません。