Skip to content
Claudia Solis-Lemus edited this page Jun 6, 2016 · 22 revisions

Phylogenetic networks

Explicit networks have a biological interpretation: main evolutionary history is depicted by the "major tree"; internal nodes represent ancestral species; account for ILS and gene tree estimation error. Explicit:

Unlike implicit networks that do not account for ILS or gene tree estimation error, and cannot be interpreted biologically. Implicit:

Julia and PhyloNetworks

PhyloNetworks is a Julia package for phylogenetic networks with functions like

  • read/write networks in parenthetical format,
  • plot networks,
  • change the root,
  • estimate the maximum pseudolikelihood network,
  • do bootstrap analysis, and
  • summary of bootstrap results on networks.

Why Julia? Julia is a high-level and interactive programming language (like R or Matlab), but it is also high-performance (like C). Also, Julia allows for collaborations in an easy way through Github.

You can open Julia from the terminal (if you included the julia executable to your PATH, see requirements) or with the app.

We suggest to update the Julia packages regularly: Pkg.update(), but be careful of the "build status" here. Pkg.update() will update to the latest registered version, but you can also get unregistered changes. More details here.

Inside Julia, you can use the PhyloNetworks package with

using PhyloNetworks

To change the directory used by julia in a session, say to a folder named "tutorial" in your "Desktop", you have 2 options.

  • quit your session, navigate to the directory and restart julia there.
  • or change the working directory within your Julia session like this
homedir()  # just to show the command homedir() to extract the path to your home directory
cd("$(homedir())/Desktop/tutorial") # changes the working directory
pwd()      # just to check: print working directory

If you are going to use the example data, make sure you are inside the folder baseline.gamma0.3_n30. If you are using your own data, make sure that you are in the folder where that data is.

Read/write networks: extended Newick format

Recall that in parenthetical format, internal nodes can have a name:

To represent networks in parenthetical format, we simply need to split the hybrid node into two nodes with the same name:

By convention, the hybrid tag is # + H,LGT,R + number, and the minor hybrid edge leads to a leaf.

Thus, we get: (((A,(B)#H1),(C,#H1)),D);. We can write inheritance probabilities in the parenthetical format: (C,#H1):branch length:bootstrap support:inheritance probability.

In Julia:

net = readTopology("(((A,(B)#H1:::0.9),(C,#H1:::0.1)),D);")
writeTopology(net)

NOTE: the first time you run a function in Julia, it is compiled. So, it is slow. Subsequent runs of the function are faster.

Plot/root networks

net is a Julia object that can be manipulated inside Julia. For example, you can plot it with:

plot(net)
p=plot(net)
using Gadfly
draw(PDF("myplot.pdf",4inch,4inch),p)

The hybrid edges are displayed in blue: dark blue for the major edge, and light blue for the minor edge. Plot has many options like showing node/edge numbers, edge length, inheritance probabilities.

We can also change the root placement to a different edge or node, or to an outgroup.

rootatnode!(net,"A")
plot(net)

WARNING: we need to be careful with the placement of the root, because it should agree with the direction of the hybrid edges.

PhyloNetworks Workshop

Clone this wiki locally