2

NMF R パッケージでは、 consensusmap() を使用して出力を視覚化できます。プロットは、どのサンプルが「コンセンサス」トラックのどのクラスターに属しているかを示しています。

このサンプル分類を抽出して、次のようなデータ フレームを取得したいと思います。

Sample    Cluster
S1        1
S2        1
S3        2
S4        1
.         .
.         .
S100      2

ConsensusClusterPlus パッケージでは、これは簡単です。results$consensusClass を引き出すだけです。NMF パッケージの同様のソリューションが見つかりません。生のプロット データを見ようとしましたが、複雑すぎて意味を抽出できません。

ここに問題の図があります。どの「ステータス」がどの「コンセンサス」内にあるかを調べる必要があります。

ここに画像の説明を入力

4

2 に答える 2

0

木全体を歩いて数えますか?

> v <- syntheticNMF(20, 3, 10)

> xx<-consensusmap(x) 

> str(xx)
List of 4
$ Rowv  :  ..--[dendrogram w/ 2 branches and 10 members at h = 1,  midpoint = 5.97, value = 3.4]
  ..  |--[dendrogram w/ 2 branches and 7 members at h = 1, midpoint = 3.69, value = 2.5]
  ..  |  |--[dendrogram w/ 2 branches and 4 members at h = 0, midpoint = 2.12, value = 1.6]
  ..  |  |  |--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 1.25, value = 1.2]
  ..  |  |  |  |--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.8]
  ..  |  |  |  |  |--leaf "2" ( value.2 = 0.4 )
  ..  |  |  |  |  `--leaf "1" ( value.1 = 0.4 )
  ..  |  |  |  `--leaf "3" ( value.3 = 0.4 )
  ..  |  |  `--leaf "4" ( value.4 = 0.4 )
  ..  |  `--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 1.25, value = 0.9]
  ..  |     |--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.6]
  ..  |     |  |--leaf "6" ( value.6 = 0.3 )
  ..  |     |  `--leaf "5" ( value.5 = 0.3 )
  ..  |     `--leaf "7" ( value.7 = 0.3 )
  ..  `--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 1.25, value = 0.9]
  ..     |--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.6]
  ..     |  |--leaf "9" ( value.9 = 0.3 )
  ..     |  `--leaf "8" ( value.8 = 0.3 )
  ..     `--leaf "10" ( value.10 = 0.3 )
  $ rowInd: int [1:10] 2 1 3 4 6 5 7 9 8 10
  $ Colv  :  ..--[dendrogram w/ 2 branches and 10 members at h = 1, midpoint = 3.03, value = 3.4]
  ..  |--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 0.75, value = 0.9]
  ..  |  |--leaf "10" ( value.10 = 0.3 )
  ..  |  `--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.6]
  ..  |     |--leaf "8" ( value.8 = 0.3 )
  ..  |     `--leaf "9" ( value.9 = 0.3 )
  ..  `--[dendrogram w/ 2 branches and 7 members at h = 1, midpoint = 2.31, value = 2.5]
  ..     |--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 0.75, value = 0.9]
  ..     |  |--leaf "7" ( value.7 = 0.3 )
  ..     |  `--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.6]
  ..     |     |--leaf "5" ( value.5 = 0.3 )
  ..     |     `--leaf "6" ( value.6 = 0.3 )
  ..     `--[dendrogram w/ 2 branches and 4 members at h = 0, midpoint = 0.875, value = 1.6]
  ..        |--leaf "4" ( value.4 = 0.4 )
  ..        `--[dendrogram w/ 2 branches and 3 members at h = 0, midpoint = 0.75, value = 1.2]
  ..           |--leaf "3" ( value.3 = 0.4 )
  ..           `--[dendrogram w/ 2 branches and 2 members at h = 0, midpoint = 0.5, value = 0.8]
  ..              |--leaf "1" ( value.1 = 0.4 )
  ..              `--leaf "2" ( value.2 = 0.4 )
 $ colInd: int [1:10] 10 8 9 7 5 6 4 3 1 2


> lapply(cut(xx$Rowv,0.5)$lower, function(l) rapply(l, function(i) i))
[[1]]
[1] 2 1 3 4

[[2]]
[1] 6 5 7

[[3]]
[1]  9  8 10
于 2016-11-20T14:05:31.760 に答える
0
NMF::predict(NMFfitX_object, what = "consensus")

クラス NMF.rank のオブジェクトがある場合、含まれている NMFfitX オブジェクトにランク = 3 でアクセスできます。

NMF.rank_object$fit$`3`
于 2022-01-18T15:05:50.583 に答える