2016-11-20 390 views
1

在NMF R包中,可以使用consensusmap()来显示输出。图表显示哪些样本属于“共识”轨道中的哪些群集。R NMF包:如何提取样本分类?

我想提取该样本分类使得我得到的数据帧是这样的:

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

在ConsensusClusterPlus包这是容易的。您只需提取结果$ consensusClass即可。我找不到NMF包的类似解决方案。我试图看看原始数据,但从中抽取任何含义太过复杂。

这里是一个问题的例子:我需要找出哪个'地位'在哪个'共识'内。

enter image description here

回答

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 
+0

感谢您的建议。 我不太了解这个树状结构,我找不到那里的'共识'轨迹。在我的数据中,我甚至没有看到“$ Colv”,我可以看到你有你的。 我有病例/对照数据,我想看看病例或对照是否有过多的原型。 –