Skip to contents

read beast/mrbayes/mega Nexus output

read beast/mrbayes/mega newick file format

Usage

read.beast(file)

read.mrbayes(file)

read.beast.newick(file)

read.mega(file)

Arguments

file

newick file

Value

treedata object

treedata object

Author

Guangchuang Yu https://guangchuangyu.github.io

Bradley R Jones

Examples

file <- system.file("extdata/BEAST", "beast_mcc.tree", package="treeio")
read.beast(file)
#> 'treedata' S4 object that stored information
#> of
#> 	'/usr/lib/R/site-library/treeio/extdata/BEAST/beast_mcc.tree'.
#> 
#> [email protected] phylo:
#> 
#> Phylogenetic tree with 15 tips and 14 internal nodes.
#> 
#> Tip labels:
#>   A_1995, B_1996, C_1995, D_1987, E_1996, F_1997, ...
#> 
#> Rooted; includes branch lengths.
#> 
#> with the following features available:
#>   'height', 'height_0.95_HPD', 'height_median', 'height_range', 'length',
#> 'length_0.95_HPD', 'length_median', 'length_range', 'posterior', 'rate',
#> 'rate_0.95_HPD', 'rate_median', 'rate_range'.
#> 
#> # The associated data tibble abstraction: 29 × 16
#> # The 'node', 'label' and 'isTip' are from the phylo tree.
#>     node label  isTip height height_0.9…¹ heigh…² heigh…³ length lengt…⁴ lengt…⁵
#>    <int> <chr>  <lgl>  <dbl> <list>         <dbl> <list>   <dbl> <list>    <dbl>
#>  1     1 A_1995 TRUE      18 <dbl [2]>         18 <dbl>    1.34  <dbl>     1.32 
#>  2     2 B_1996 TRUE      17 <dbl [2]>         17 <dbl>    3.30  <dbl>     3.28 
#>  3     3 C_1995 TRUE      18 <dbl [2]>         18 <dbl>    3.33  <dbl>     3.31 
#>  4     4 D_1987 TRUE      26 <dbl [2]>         26 <dbl>    9.14  <dbl>     8.97 
#>  5     5 E_1996 TRUE      17 <dbl [2]>         17 <dbl>    3.29  <dbl>     3.27 
#>  6     6 F_1997 TRUE      16 <dbl [2]>         16 <dbl>    0.849 <dbl>     0.831
#>  7     7 G_1992 TRUE      21 <dbl [2]>         21 <dbl>    5.21  <dbl>     5.19 
#>  8     8 H_1992 TRUE      21 <dbl [2]>         21 <dbl>    2.19  <dbl>     2.16 
#>  9     9 I_1994 TRUE      19 <dbl [2]>         19 <dbl>    1.76  <dbl>     1.74 
#> 10    10 J_1983 TRUE      30 <dbl [2]>         30 <dbl>    1.60  <dbl>     1.56 
#> # … with 19 more rows, 6 more variables: length_range <list>, posterior <dbl>,
#> #   rate <dbl>, rate_0.95_HPD <list>, rate_median <dbl>, rate_range <list>, and
#> #   abbreviated variable names ¹​height_0.95_HPD, ²​height_median, ³​height_range,
#> #   ⁴​length_0.95_HPD, ⁵​length_median
file <- system.file("extdata/MrBayes", "Gq_nxs.tre", package="treeio")
read.mrbayes(file)
#> 'treedata' S4 object that stored information
#> of
#> 	'/usr/lib/R/site-library/treeio/extdata/MrBayes/Gq_nxs.tre'.
#> 
#> [email protected] phylo:
#> 
#> Phylogenetic tree with 12 tips and 10 internal nodes.
#> 
#> Tip labels:
#>   B_h, B_s, G_d, G_k, G_q, G_s, ...
#> 
#> Unrooted; includes branch lengths.
#> 
#> with the following features available:
#>   'length_0.95HPD', 'length_mean', 'length_median', 'prob', 'prob_percent',
#> 'prob+-sd', 'prob_range', 'prob_stddev'.
#> 
#> # The associated data tibble abstraction: 22 × 11
#> # The 'node', 'label' and 'isTip' are from the phylo tree.
#>     node label isTip length_0.95…¹ lengt…² lengt…³ prob  prob_…⁴ prob+…⁵ prob_…⁶
#>    <int> <chr> <lgl> <list>        <chr>   <chr>   <chr> <chr>   <chr>   <list> 
#>  1     1 B_h   TRUE  <dbl [2]>     0.1434… 0.1431… 1     100     100+-0  <dbl>  
#>  2     2 B_s   TRUE  <dbl [2]>     0.1925… 0.1922… 1     100     100+-0  <dbl>  
#>  3     3 G_d   TRUE  <dbl [2]>     0.0547… 0.0546… 1     100     100+-0  <dbl>  
#>  4     4 G_k   TRUE  <dbl [2]>     0.0628… 0.0627… 1     100     100+-0  <dbl>  
#>  5     5 G_q   TRUE  <dbl [2]>     0.0632… 0.0631… 1     100     100+-0  <dbl>  
#>  6     6 G_s   TRUE  <dbl [2]>     0.0105… 0.0103… 1     100     100+-0  <dbl>  
#>  7     7 G_t   TRUE  <dbl [2]>     0.0072… 0.0071… 1     100     100+-0  <dbl>  
#>  8     8 M_s   TRUE  <dbl [2]>     0.2950… 0.2943… 1     100     100+-0  <dbl>  
#>  9     9 N_m   TRUE  <dbl [2]>     0.2277… 0.2275… 1     100     100+-0  <dbl>  
#> 10    10 P_h   TRUE  <dbl [2]>     0.2250… 0.2250… 1     100     100+-0  <dbl>  
#> # … with 12 more rows, 1 more variable: prob_stddev <chr>, and abbreviated
#> #   variable names ¹​length_0.95HPD, ²​length_mean, ³​length_median,
#> #   ⁴​prob_percent, ⁵​`prob+-sd`, ⁶​prob_range
tree <- read.beast.newick(textConnection('(a[&rate=1]:2,(b[&rate=1.1]:1,c[&rate=0.9]:1)[&rate=1]:1);'))