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

General instructions here

explicit phylogenetic networks

(need to add explanation here: explicit vs implicit, unrooted-semidirected, root and hybrid edges)

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). 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

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 and 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)

We can also change the root placement to a different edge or node. For this, we need to know the edge/node number, but we get this information if we plot it:

plot(net, showEdgeNumber=true)
rootonedge!(net,1)
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