Quick start
This page runs PhyloDiamond on a small example. See Input and output for the input formats and how to read the results in detail, and The method in brief for what PhyloDiamond estimates.
Install and load
PhyloDiamond is a Julia package. If you don't have Julia yet, install it following the official instructions. Then, inside Julia:
using Pkg
Pkg.add("PhyloDiamond")Load the package at the start of every Julia session:
using PhyloDiamondTo see the help for a function, type ? followed by its name, for example ?phylo_diamond.
Run on a file of gene trees
PhyloDiamond comes with a small example file: 100 gene trees on 8 taxa (named 1 to 8), one tree per line in newick format. These gene trees were simulated on a network with hybrid clade (1,2), parent clades (3,4) and (5,6), and remaining clade (7,8).
genetrees = joinpath(pkgdir(PhyloDiamond), "test", "file", "gt.txt")
readline(genetrees) # the first gene tree"((7:2.127,8:2.127):0.694,((5:0.522,6:0.522):2.065,((3:0.671,4:0.671):1.182,(1:0.858,2:0.858):0.995):0.733):0.235);"To estimate the 5 best-fitting networks:
res = phylo_diamond(genetrees, 5)Reading in trees, looking at 70 quartets in each...
0+--------------------------------------------------+100%
**************************************************
Inference of top 5 8-taxon phylogenetic networks with phylogenetic invariants
1. N2222 (0.03689157145883046)
[(1,2),(3,4),(5,6),(7,8)]
((7:1,8:1):4, (((3:1,4:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(5:1,6:1):2):1):1);
2. N2222 (0.03823994257144703)
[(1,2),(5,6),(3,4),(7,8)]
((7:1,8:1):4, (((5:1,6:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(3:1,4:1):2):1):1);
3. N2222 (0.04097959230267735)
[(1,2),(7,8),(5,6),(3,4)]
((3:1,4:1):4, (((7:1,8:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(5:1,6:1):2):1):1);
4. N2222 (0.04258688497092598)
[(1,2),(5,6),(7,8),(3,4)]
((3:1,4:1):4, (((5:1,6:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(7:1,8:1):2):1):1);
5. N2222 (0.04789498610785061)
[(1,2),(3,4),(7,8),(5,6)]
((5:1,6:1):4, (((3:1,4:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(7:1,8:1):2):1):1);The first run takes a few seconds because Julia compiles the code; later runs are faster.
Read the result
phylo_diamond does three things:
- prints a report (above);
- writes the same report to
phylo_diamond.txtin the current folder. If that file already exists, the new report is added at the end; - returns a dictionary from rank (1 = best) to the network in extended newick format:
res[1]"((7:1,8:1):4, (((3:1,4:1):2, ((1:1,2:1):1)#H1:1::0.7):1, (#H1:1::0.3,(5:1,6:1):2):1):1);"Every candidate network has a single 4-node hybridization cycle that splits the taxa into four clades, n0, n1, n2 and n3. The best network in the report reads:
1. N2222 (0.03689157145883046)
[(1,2),(3,4),(5,6),(7,8)][(1,2),(3,4),(5,6),(7,8)]lists the taxa inn0,n1,n2,n3:n0 = (1,2)is the hybrid clade;n1 = (3,4)andn2 = (5,6)are the two parent clades thatn0inherits from;n3 = (7,8)is the remaining clade.
N2222is the number of taxa inn0,n1,n2,n3.- The number in parentheses is the invariant score. Smaller scores mean the data fit that network better.
This is the network the gene trees were simulated on, so PhyloDiamond recovers the true clades.
Network 2 is the same network with n1 and n2 swapped. PhyloDiamond often cannot tell the two parent clades apart, so these two networks usually have close scores.
PhyloDiamond estimates only which taxa are in each clade. The branch lengths and inheritance probabilities in the newick strings are fixed placeholders (see Input and output).
Next steps
- To run PhyloDiamond on your own data (gene trees or a table of concordance factors), see Input and output.
- To learn what the four clades and the score mean, see The method in brief.