使用phangorn :: simSeq()时出现意外结果

时间:2018-11-20 10:31:39

标签: r

我正在使用phangorn :: simSeq()

https://www.rdocumentation.org/packages/phangorn/versions/2.4.0/topics/simSeq

并且我使用type =“ DNA”作为参数。

在结果消息中,我得到“状态是c g t”(这是我期望的结果,但是当我看到结果是: enter image description here

我希望看到A,C,T,G的结果不是1,2,3,4 ...如何使A,C,T,G而不是1,2,3,4出现。我以为可以通过指定参数type="DNA"

来实现

1 个答案:

答案 0 :(得分:0)

simSeq返回一个phyDat对象。您可以使用as.character将此对象转换为字符矩阵,也可以使用write.phyDat将其导出。

> library(phangorn)
> tree <- rcoal(5)
> dat <- simSeq(tree, l=10)
> as.character(dat)
   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
t2 "t"  "g"  "c"  "c"  "t"  "g"  "a"  "g"  "t"  "a"  
t5 "g"  "t"  "c"  "t"  "t"  "t"  "t"  "g"  "c"  "g"  
t1 "g"  "t"  "c"  "t"  "t"  "t"  "t"  "g"  "c"  "g"  
t3 "g"  "a"  "g"  "c"  "t"  "t"  "t"  "c"  "g"  "g"  
t4 "g"  "g"  "g"  "g"  "t"  "a"  "a"  "g"  "g"  "g"