我已经将系统发育树转换为 R 中的 igraph 图对象。转换非常简单。(我什至自己写过)
x <- read.tree(treeName) #library(ape)
xg <- as.igraph(x) #library(igraph)
xn <- as.network(x) #library(network)
问题是 igraph 丢失了内部节点并将所有具有相同值的节点放入超级节点中。转换为网络图对象不会这样做。
这要么是一个非常明显的问题,要么不是,但是我如何保留一个 igraph 无向图,使其尽可能接近原始的无根系统发育树?
这是我的树:
> write.tree(x)
[1] "(Stramenopiles:0.2264266375,(Rhodophyta:0.4773545356,(((Cyanobacteria:0.1381636873,((Cyanobacteria:0.0960776914,((Cyanobacteria:1.22123006e-06,Cyanobacteria:1.22123006e-06)100:0.03668339087,(Cyanobacteria:0.008925185678,(Cyanobacteria:0.02104285045,Cyanobacteria:0.01965272436)36:0.01191598625)100:0.08128993413)100:0.05623189811)40:0.02452201162,(Cyanobacteria:0.1215399949,(Cyanobacteria:0.08131938398,Cyanobacteria:0.1076590417)100:0.09027431172)56:0.02578283222)68:0.03740629446)100:0.1614683078,Rhizaria:0.4422343375)96:0.1466952346,((Firmicutes:0.2770757471,(BacteriaUnclassified:0.2238897211,((Firmicutes:1.22123006e-06,Firmicutes:1.22123006e-06)100:0.01388349775,(Firmicutes:0.01298811881,((Firmicutes:0.002455529288,Firmicutes:0.004912852781)96:0.01323989785,((Firmicutes:1.22123006e-06,(Firmicutes:1.22123006e-06,Firmicutes:1.22123006e-06)16:1.22123006e-06)12:1.22123006e-06,Firmicutes:1.22123006e-06)100:0.03379320834)92:0.0227065105)56:0.006847837211)100:0.2438513586)100:0.1331984947)100:0.1927737595,((((Thermotogae:0.2108367786,(Thermotogae:0.1031317823,Thermotogae:0.1447857053)100:0.1261652654)100:0.1193650964,(Thermotogae:0.04519932853,(Thermotogae:0.005668612775,((Thermotogae:1.22123006e-06,Thermotogae:1.22123006e-06)84:0.002822865755,Thermotogae:1.22123006e-06)64:1.22123006e-06)100:0.04363820472)100:0.1709187935)100:0.2678650283,(ChlamydiaeVerrucomicrobia:0.4849309265,ChlamydiaeVerrucomicrobia:0.3496477841)100:0.2385727076)60:0.04921379025,((Aquificae:0.3447440894,(Deferribacteres:0.3738656857,Proteobacteria:0.3458622172)64:0.05695037101)72:0.05488303029,(((Proteobacteria:0.3106123704,Proteobacteria:0.1793013243)100:0.1352912373,((Proteobacteria:0.1530616043,Proteobacteria:0.2157366776)60:0.07037030162,((Proteobacteria:0.005423860635,Proteobacteria:0.002575761354)84:0.01541355309,Proteobacteria:0.02622197026)100:0.1743560584)48:0.05780270366)68:0.04303933379,(Proteobacteria:0.4228268048,Proteobacteria:0.29377905)68:0.06111029)100:0.2071501222)40:0.02291143376)36:0.06368422427)96:0.1497733491)100:0.1422326131)100:0.1793317277,Stramenopiles:0.3338671992);"
仅供参考,使用 as.igraph() 将此树转换为 igraph 将需要以下 hack:
x$node.label[1] <- " "