3

phytools パッケージを使用してフェノグラムを生成すると、ツリーのヒントとヒント ラベルが表示されません。これを修正する方法、または問題の特性の値でプロットされたy軸を持つノードとヒントを含むフェノグラムをプロットする別の方法について誰かアイデアがありますか?

ここに私が持っているものがあります:

midpointData <-
structure(list(Species = structure(1:6, .Label = c("Icterus_croconotus", 
"Icterus_graceannae", "Icterus_icterus", "Icterus_jamacaii", 
"Icterus_mesomelas", "Icterus_pectoralis"), class = "factor"), 
    bio_1nam = c(243L, 193L, 225L, 209L, 189L, 180L), bio_12nam = c(5127.5, 
    751.5, 1373, 914.5, 4043.5, 2623.5), bio_16nam = c(1470.5, 
    442, 656.5, 542, 1392.5, 1074), bio_17nam = c(1094.5, 51.5, 
    135, 189.5, 768.5, 377.5), bio_2nam = c(97.5, 91.5, 83, 82.5, 
    81, 102), bio_5nam = c(314, 265.5, 311, 274, 282, 281), bio_6nam = c(167.5, 
    132.5, 175.5, 154.5, 128, 114)), .Names = c("Species", "bio_1nam", 
"bio_12nam", "bio_16nam", "bio_17nam", "bio_2nam", "bio_5nam", 
"bio_6nam"), class = "data.frame", row.names = c(NA, -6L))

prunedTargetTree <- 
structure(list(edge = structure(c(7L, 7L, 8L, 9L, 9L, 8L, 10L, 
11L, 11L, 10L, 1L, 8L, 9L, 2L, 3L, 10L, 11L, 4L, 5L, 6L), .Dim = c(10L, 
2L)), Nnode = 5L, tip.label = c("Icterus_mesomelas", "Icterus_pectoralis", 
"Icterus_graceannae", "Icterus_croconotus", "Icterus_icterus", 
"Icterus_jamacaii"), edge.length = c(0.152443952069696, 0.014866140819964, 
0.0311847312922788, 0.106393079957453, 0.106393079957453, 0.0727572150872864, 
0.0130293222294024, 0.0517912739330428, 0.0517912739330428, 0.0648205961624452
)), .Names = c("edge", "Nnode", "tip.label", "edge.length"), class = "phylo", order = "cladewise")

library(phytools)
reconBio1 <- ace(midpointData$bio_1nam, prunedTargetTree, type = "continuous", method = "ML")
bio1final <- c(reconBio1$ace, midpointData$bio_1nam)
names(bio1final) <- c(7,8,9,10,11,4,3,5,6,1,2)
plot.new()
phenogram(prunedTargetTree, bio1final, ylim = c(min(bio1final), max(bio1final)))

ツリーは次のようになります。 TreeWithoutTips

4

1 に答える 1

0

私は問題を解決しましたが、他の人が同じ問題に遭遇した場合に備えて解決策を共有したいと思いました. pheonogram() は、ヒントの数値インデックスではなく、prunedTargetTree$tip.label に一致する引数 x (別名 bio1final) 内の名前を探します。それ以外の:

bio1final <- c(reconBio1$ace, midpointData$bio_1nam); 
names(bio1final) <- c(7,8,9,10,11,4,3,5,6,1,2)

それは読むべきです:

bio1final <- c(reconBio1$ace, midpointData$bio_1nam); 
names(bio1final) <- c(7,8,9,10,11,as.character(midpointData$Species))

**as.character は重要です。そうしないと、$Species が因子として読み込まれ、ツリーの先端がプロットされないためです。

于 2014-01-20T04:43:39.363 に答える