Search code examples
rdataframetreephylogeny

R Help creating tree for MiRKAT


I am attempting to create a tree for using with the R package MiRKAT, but as the documentation is very hard to understand, I hope someone in here can help me out.

My data is in the structure:

         Acaryochloris Achromobacter Acidiphilium Acidisphaera
Sample1             23             1            0            4                 
Sample2              0             0            2            0                 
Sample3              4             0            4            0                 
Sample4              0            30            0            5                 
Sample5             11             0            5            0                 
Sample6              0             0            0            0 

And the package takes a tree of the structure in the vignette:

List of 4
 $ edge       : int [1:1710, 1:2] 857 858 859 860 861 862 863 864 865 866 ...
 $ Nnode      : int 855
 $ tip.label  : chr [1:856] "1883" "3114" "1483" "2576" ...
 $ edge.length: num [1:1710] 0.00846 0.09451 0.01012 0.01208 0.03501 ...
 - attr(*, "class")= chr "phylo"      

The vignette can be found on: http://research.fhcrc.org/content/dam/stripe/wu/files/MiRKAT/MiRKAT_Vignette.pdf

Is there any way to transform my data into such a tree structure? If so can you recommend any packages?


Solution

  • Sorry guys, I found out myself.

    mydata_dist <- dist(mydata)
    mydata_hc <- hclust(mydata_dist)
    mydata_phyl <- as.phylo(mydata_hc)