Git Product home page Git Product logo

etetoolkit / ete Goto Github PK

View Code? Open in Web Editor NEW
752.0 34.0 215.0 127.6 MB

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.

Home Page: http://etetoolkit.org

License: GNU General Public License v3.0

Python 90.34% Makefile 0.01% C 0.05% Shell 0.02% HTML 0.17% Cython 3.65% CSS 0.35% JavaScript 5.41%
python visualization phylogenetics phylogenomic tree-structure treeview

ete's Introduction

Join the chat at https://gitter.im/jhcepas/ete

Overview

ETE (Environment for Tree Exploration) is a toolkit that assists in the automated manipulation, analysis and visualization of trees. It is mainly written in Python, and includes many extra functionalities for phylogenetic trees.

Its main features include:

  • Read and write support for trees in Newick format
  • Multiple functions for traversing, searching and manipulating tree topologies and node annotations
  • Integration with NCBI Taxonomic database
  • Integration with GTDB database
  • Programmatic visualization framework
  • Visualization of huge trees based on adaptive zooming
  • Comparing trees
  • Phylogenetic functions
    • orthology detection
    • phylogenetic distance
  • Command line tools
    • phylogenetic reconstruction protocols
    • tree comparison
    • tree diff

The official website of ETE is http://etetoolkit.org. You can find downloading instructions and further documentation there.

News and announcements are usually posted on twitter: http://twitter.com/etetoolkit

If you use ETE, please cite:

Jaime Huerta-Cepas, François Serra and Peer Bork. "ETE 3: Reconstruction,
analysis and visualization of phylogenomic data."  Mol Biol Evol (2016) doi:
10.1093/molbev/msw046

Installation

Quick way

pip install https://github.com/etetoolkit/ete/archive/ete4.zip

For local development

To install ETE in a local directory to help with the development, you can:

  • Clone this repository (git clone https://github.com/etetoolkit/ete.git)
  • Install dependecies
    • If you are using conda: conda install -c conda-forge cython bottle brotli numpy scipy
    • Otherwise, you can install them with pip install <dependencies>
  • Build and install ete4 from the repository's root directory: pip install -e .

Optional dependencies

If you want to use the treeview module (which depends on PyQt), you can add [treeview] to the pip installation.

For example with pip install -e .[treeview] for a local editable installation. Or pip install -e .[treeview,test,doc] to also include the modules for testing and generating the documentation.

Exploring a tree

To simply load a tree from a file (my_tree.nw) and start exploring it interactively, you can use the ete4 utility and run:

ete4 explore -t my_tree.nw

Or start a python session and write:

from ete4 import Tree

t = Tree(open('my_tree.nw'))

t.explore()

It will open a browser window with an interface to explore the tree.

Documentation

Most documentation is automatically generated with sphinx from the contents of the doc directory, and is available at https://etetoolkit.github.io/ete/ .

Gallery of examples

Getting support

Rather than sending direct support-related emails to the developers, it is better to keep the communication public.

For question on how to use ETE in the bioinformatics context, use Biostars with the etetoolkit tag, or stack overflow.

For bug reports, feature requests and general discussion, use https://github.com/etetoolkit/ete/issues

For more technical problems, you can also use the official ETE mailing list at https://groups.google.com/d/forum/etetoolkit. To avoid spam, messages from new users are moderated. Expect some delay until your first message appears after your account is validated.

For any other inquiries (collaborations, sponsoring, etc), please contact [email protected].

Tests

You can launch some tests by running:

./run_tests.py

Contributing and bug reporting

https://github.com/etetoolkit/ete/wiki/Contributing

Roadmap

https://github.com/etetoolkit/ete/wiki/ROADMAP

ete's People

Contributors

a1an77 avatar andriyor avatar balzer82 avatar blaiseli avatar chrstphrchvz avatar dariusrussellkish avatar davidhwyllie avatar dburkhardt avatar dengzq1234 avatar diegobernabelopez avatar dkagrawal avatar dorbarker avatar fmaguire avatar fransua avatar glebzhelezov avatar idoerg avatar jerryatmda avatar jfaccioni avatar jhcepas avatar jincao1 avatar johnbioinf avatar jordibc avatar jorgebotas avatar linsalrob avatar matsen avatar mortonjt avatar rafiot avatar sam-m888 avatar scapella avatar unode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ete's Issues

preorder traverse is not left-to-right

Anting Xu , Apr 7 2012

to etetoolkit
I am using ete2.1rev492.

For a tree like this(in newick):
((3,4)2,(6,7)5)1;

Preorder traverse should produce:
1, 2, 3, 4, 5, 6, 7

However, the tree.traverse("preorder") method actually produces:
1, 5, 7, 6, 2, 4, 3

I guess it is a bug in the code. Please confirm. Thanks.

problem in set outgroup

t = Tree ('(((a,b),c));')
t.set_outgroup (t & 'a')

gives an error at "down_branch_connector = self.children[0]" line 837
and delete whole tree.

fix: line 828:
++ if len(self.children)!=1:

-- if len(self.children)>1:

tree.describe() [reported via google.groups by Daniel Pérez]

When I try to execute this line of code:

print 'TESTING TREE: ', tree.describe()

Please note tree is an apparently valid tree taken from phylomeDBconnector.

This error rises:

Traceback (most recent call last):
File "test_kegg.py", line 88, in
if utils.get_tree_with_all_subnodes_dbg(node1) and utils.get_tree_with_all_subnodes_dbg(node2):
File "/home/viridis/dev/test-eric/utilities.py", line 50, in get_tree_with_all_subnodes_dbg
print 'TESTING TREE: ', tree.describe()
File "/usr/local/lib/python2.7/dist-packages/ete2-2.0rev111-py2.7.egg/ete2/coretype/tree.py", line 470, in describe
max_node, max_dis = get_farthest_leaf()
NameError: global name 'get_farthest_leaf' is not defined

Inside ETE2 I find tree.py and ther the method describe:
def describe(self):
""" Prints general information about this node and its
connections."""
if len(self.get_tree_root().children)==2:
rooting = "Yes"
elif len(self.get_tree_root().children)>2:
rooting = "No"
else:
rooting = "Unknown"
max_node, max_dis = get_farthest_leaf() #MAYBE A self.get_farthest_leaf() would solve the problem?
print "Number of nodes:\t %d" % len(self.get_descendants())
print "Number of leaves:\t %d" % len(self.get_leaves())
print "Rooted:", rooting
print "Max. lenght to root:"
print "The Farthest descendant node is", max_node.name,
"with a branch distance of", max_dist

redraw only modified items

When bgcolor or linetypes are changed in the GUI, the whole tree is redrawn, this can be changed to rerender only the necesary parts.

AttributeError in mouseDoubleClickEvent

An AttributeError is raised when double-clicking on a node in the treeview component of ete2-2.1rev492.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ete2-2.1rev492-py2.7.egg/ete2/treeview/qt4_gui.py", line 764, in mouseDoubleClickEvent
    bg.setPen(QtGui.QPen(QtGui.QColor("red")))
AttributeError: '_NodeItem' object has no attribute 'setPen'

get_balance_age_outgroup

t.set_outgroup(t.get_age_balanced_outgroup(sp2age_per_phylome[phylome_id]))
File "/soft/general/python-2.6.4/lib/python2.6/site-packages/ete2-2.1rev492-py2.6.egg/ete2/phylo/phylotree.py", line 330, in get_age_balanced_outgroup
out_age_min = min([species2age[sp] for sp in out_species])
ValueError: min() arg is an empty sequence


el dictionario que le paso: ( --- seria sp2age_per_phylome[phylome_id])

{'DROYA': 5,
'CULPI': 5,
'HUMAN': 9,
'CIOIN': 9,
'AEDAE': 5,
'BOMMO': 5,
'NASVI': 5,
'PEDHC': 5,
'DAPPU': 7,
'DROME': 5,
'APIME': 5,
'ANOGA': 5,
'TRICA': 5,
'DROPS': 5,
'DROMO': 5,
'ACYPI': 5,
'CAEEL': 10}


este son los ids. los arboles son del phyloma 16 (pea aphid). puede ser que hay mas en que no funciona.
he mirado algunos de estos, y tiene una estructura rara, llena de ids duplicados

Phy000YGS1_ACYPI
Phy000YIEH_ACYPI
Phy000YO1U_ACYPI
Phy000YPTH_ACYPI
Phy0010AQT_ACYPI
Phy0010BF4_ACYPI
Phy0010BJW_ACYPI
Phy0010C3I_ACYPI

When reading the attached tree in NHX format, I got more leaves with strange name

When reading the attached tree in NHX format, I got more leaves with strange name.
t=Tree("final.ph")

It works perfectly by the following commend.
t=Tree("final.ph",format=9)

However, format "9" seems not for NHX according to the following link.
http://packages.python.org/ete2/tutorial/tutorial_trees.html#reading-and-writing-newick-trees

It also seems for NHX according to the following link.
http://packages.python.org/ete2/tutorial/tutorial_phylogeny.html?highlight=nhx
print t.write(features=["sequence"], format=9)

(((seqA[&&NHX:sequence=MAEIPDETIQQFMALT---HNIAVQYLSEFGDLNEALNSYYASQTDDIKDRREEAHQF

MALTNVSHQFMALTNVSH],seqB[&&NHX:sequence=MAEIPDATIQQFMALTNVSHNIAVQY--EFGDLNEALNSY

YAYQTDDQKDRREEAHQFMALTNVSH----------]),seqC[&&NHX:sequence=MAEIPDATIQ---ALTNVSHNIA

VQYLSEFGDLNEALNSYYASQTDDQPDRREEAHQFMALTNVSH----------]),seqD[&&NHX:sequence=MAEAPD

ETIQQFMALTNVSHNIAVQYLSEFGDLNEAL--------------REEAHQ----------FMALTNVSH]);

"if xxx in tree" syntax does not work in leaf nodes

As reported to the ETE list:

mynode in mytree
True

And I have found a case in which it doesn't work: if mytree has a single node. Is this intended or a bug?

print mynode
--Phy0008JA7_HUMAN
'Phy0008JA7_HUMAN' in mynode # string case
False
mynode & 'Phy0008JA7_HUMAN' in mynode #node case
False
'Phy0008JA7_HUMAN' == mynode.name #work around
True

ladderize

Sort branches (swap) according to partition size

get_balance_age_outgroup

t.set_outgroup(t.get_age_balanced_outgroup(sp2age_per_phylome[phylome_id]))
File "/soft/general/python-2.6.4/lib/python2.6/site-packages/ete2-2.1rev492-py2.6.egg/ete2/phylo/phylotree.py", line 330, in get_age_balanced_outgroup
out_age_min = min([species2age[sp] for sp in out_species])
ValueError: min() arg is an empty sequence


el dictionario que le paso: ( --- seria sp2age_per_phylome[phylome_id])

{'DROYA': 5,
'CULPI': 5,
'HUMAN': 9,
'CIOIN': 9,
'AEDAE': 5,
'BOMMO': 5,
'NASVI': 5,
'PEDHC': 5,
'DAPPU': 7,
'DROME': 5,
'APIME': 5,
'ANOGA': 5,
'TRICA': 5,
'DROPS': 5,
'DROMO': 5,
'ACYPI': 5,
'CAEEL': 10}


este son los ids. los arboles son del phyloma 16 (pea aphid). puede ser que hay mas en que no funciona.
he mirado algunos de estos, y tiene una estructura rara, llena de ids duplicados

Phy000YGS1_ACYPI
Phy000YIEH_ACYPI
Phy000YO1U_ACYPI
Phy000YPTH_ACYPI
Phy0010AQT_ACYPI
Phy0010BF4_ACYPI
Phy0010BJW_ACYPI
Phy0010C3I_ACYPI

fix prune function

it fails when all nodes to keep are in the same branch of the root node

misbehavior in prune function

t = Tree('(((f:1,g:1)d:1,e:1)b:1,c:1);', format=1)

t.prune(["f", "g", "b", "c"]) #by node names

"b" is removed !!

add format to display root name/values in write function

add new format in order to be abble to display info about root.
right now a way to do it is:
tree.write(format=1)[:-1] + '%s:%s;' % (tree.name, tree.dist)

would be nice to just tree.write(format=12) :)

this is usefull in some cases, as when trying to export to dendropy.

align face content

  • top- and down-branch could be centered, or aligned to left or right
  • faces in the same column are always vertically centered. Other positions can be added.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.