As part of the ipyrad.analysis
toolkit we've created convenience functions for easily running common RAxML commands. This can be useful when you want to run all of your analyes in a clean stream-lined way in a jupyter-notebook to create a completely reproducible study.
In [1]:
## conda install ipyrad -c ipyrad
## conda install toytree -c eaton-lab
## conda install raxml -c bioconda
In [2]:
import ipyrad.analysis as ipa
import toyplot
import toytree
In [3]:
rax = ipa.raxml(
data="./analysis-ipyrad/aligntest_outfiles/aligntest.phy",
name="aligntest",
workdir="analysis-raxml",
);
In [4]:
## set some other params
rax.params.N = 10
rax.params.T = 2
rax.params.o = None
#rax.params.o = ["32082_przewalskii", "33588_przewalskii"]
In [5]:
print rax.command
In [6]:
rax.run(force=True)
In [7]:
rax.trees
Out[7]:
In [8]:
tre = toytree.tree(rax.trees.bipartitions)
tre.root(wildcard="3")
tre.draw(
height=300,
width=300,
node_labels=tre.get_node_values("support"),
);
In [9]:
##
## ipcluster start --n=20
##
Create a Client connected to the cluster
In [10]:
import ipyparallel as ipp
ipyclient = ipp.Client()
Create several raxml objects for different data sets
In [11]:
rax1 = ipa.raxml(
data="~/Documents/ipyrad/tests/analysis-ipyrad/pedic_outfiles/pedic.phy",
name="rax1", T=4, N=100)
rax2 = ipa.raxml(
data="~/Documents/ipyrad/tests/analysis-ipyrad/aligntest_outfiles/aligntest.phy",
name="rax2", T=4, N=100)
Submit jobs to run on the cluster queue.
In [12]:
rax1.run(ipyclient=ipyclient, force=True)
rax2.run(ipyclient=ipyclient, force=True)
Wait for jobs to finish
In [14]:
## you can query each job while it's running
rax1.async.ready()
Out[14]:
In [13]:
## or just block until all jobs on ipyclient are finished
ipyclient.wait()
Out[13]:
In [15]:
## load trees and add to axes
tre1 = toytree.tree(rax1.trees.bipartitions)
tre1.root(wildcard="prz")
tre1.draw(width=300);
tre2 = toytree.tree(rax2.trees.bipartitions)
tre2.root(wildcard="3")
tre2.draw(width=300);