Quantcast
Channel: Python
Viewing all articles
Browse latest Browse all 15

Using DendroPy Interoperability Modules to Download and Align GenBank Sequences and Estimate a Maximum Likelihood Tree

$
0
0

Site Section: 

Keywords: 

The following example shows how easy it can be to use the three interoperability modules provided by the DendroPy Phylogenetic Computing Library to download nucleotide sequences from GenBank, align them using MUSCLE, and estimate a maximum-likelihood tree using RAxML. The automatic label composition option of the DendroPy genbank module creates practical taxon labels out the original data. We also pass in additional arguments to RAxML to request that the tree search be carried out 250 times (['-N', '250']).

#! /usr/bin/env python

from dendropy.interop import genbank
from dendropy.interop import muscle
from dendropy.interop import raxml
gb = genbank.GenBankDna(id_range=(98332, 98359), prefix="AF0")
data = gb.generate_char_matrix(
        label_components=["accession", "organism"])
data = muscle.muscle_align(data)
rr = raxml.RaxmlRunner()
tree = rr.estimate_tree(data, ['-N', '250'])
print tree.as_ascii_plot()

(The tree below is shown just as an example of the output; some errant taxa placement is evident).

                                           /--- AF098348_Trictena_atripalpis
/------------------------------------------+
|                                          \--- AF098349_Trictena_sp.
|
|                                          /--- AF098335_Aoraia_lenis
|                                      /---+
|      /-------------------------------+   \--- AF098336_Aoraia_rufivena
|      |                               |
|      |                               \------- AF098334_Aoraia_enysii
|      |
|  /---+  /------------------------------------ AF098347_Oxycanus_sphragidias
|  |   |  |
|  |   |  |                            /------- AF098346_Oxycanus_antipoda
|  |   |  |                         /--+
|  |   |  |                         |  |   /--- AF098345_Oxycanus_dirempta
|  |   \--+   /---------------------+  \---+
|  |      |   |                     |      \--- AF098344_Oxycanus_australis
|  |      |   |                     |
|  |      |   |                     \---------- AF098343_Jeana_robiginosa
|  |      |   |
|  |      |   |                     /---------- AF098337_Cladoxycanus_minos
|  |      \---+                     |
|  |          |   /-----------------+      /--- AF098338_Dioxycanus_fuscus
|  |          |   |                 |  /---+
|  |          |   |                 \--+   \--- AF098339_Dioxycanus_oreas
|  |          |   |                    |
|  |          |   |                    \------- AF098342_Heloxycanus_patricki
+  |          \---+
|  |              |  /------------------------- AF098340_Dumbletonius_characterifer
|  |              |  |
|  |              |  |   /--------------------- AF098351_Wiseana_cervinata
|--+              |  |   |
|  |              \--+   |             /------- AF098355_Wiseana_jocosa
|  |                 |   |          /--+
|  |                 |   |          |  |   /--- AF098356_Wiseana_mimica
|  |                 |   |          |  \---+
|  |                 \---+      /---+      \--- AF098354_Wiseana_fuliginea
|  |                     |      |   |
|  |                     |      |   |  /------- AF098359_Wiseana_umbraculata
|  |                     |      |   \--+
|  |                     |  /---+      |   /--- AF098357_Wiseana_signata
|  |                     |  |   |      \---+
|  |                     |  |   |          \--- AF098358_Wiseana_signata
|  |                     \--+   |
|  |                        |   \-------------- AF098350_Wiseana_cervinata
|  |                        |
|  |                        |          /------- AF098341_Dumbletonius_unimaculatus
|  |                        \----------+
|  |                                   |   /--- AF098353_Wiseana_copularis
|  |                                   \---+
|  |                                       \--- AF098352_Wiseana_copularis
|  |
|  \------------------------------------------- AF098333_Aenetus_virescens
|
\---------------------------------------------- AF098332_Fraus_simulans

Viewing all articles
Browse latest Browse all 15

Trending Articles