or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

clustering.mdcore-tree.mddata-tables.mdexternal-formats.mdindex.mdncbi-taxonomy.mdphylogenetic.mdsequences.mdvisualization.md
tile.json

tessl/pypi-ete3

A Python Environment for (phylogenetic) Tree Exploration

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/ete3@3.1.x

To install, run

npx @tessl/cli install tessl/pypi-ete3@3.1.0

index.mddocs/

ETE3 - Environment for Tree Exploration

ETE3 is a comprehensive Python toolkit for phylogenetic tree manipulation, analysis, and visualization. It provides advanced capabilities for evolutionary analysis, tree reconstruction, comparison, and sophisticated visualization with customizable rendering options, serving researchers in phylogenetics, genomics, and bioinformatics.

Package Information

  • Package Name: ete3
  • Language: Python
  • Installation: pip install ete3

Core Imports

import ete3

Most common imports for core functionality:

from ete3 import Tree, PhyloTree, SeqGroup, NCBITaxa

For visualization:

from ete3 import TreeStyle, NodeStyle, faces

Basic Usage

from ete3 import Tree, PhyloTree, NCBITaxa

# Create a tree from Newick format
tree = Tree("(A:1,(B:1,(E:1,D:1):0.5):0.5);")

# Basic tree operations
print(f"Tree has {len(tree)} nodes")
print(f"Leaves: {tree.get_leaf_names()}")

# Tree traversal
for node in tree.traverse():
    print(f"Node: {node.name}, Distance: {node.dist}")

# Phylogenetic tree with species information
phylo_tree = PhyloTree("(human:1,(chimp:1,bonobo:1):0.5);")
phylo_tree.set_species_naming_function(lambda name: name)

# NCBI taxonomy integration
ncbi = NCBITaxa()
tree_with_taxonomy = ncbi.get_topology([9606, 9598, 9597])  # Human, chimp, bonobo
print(tree_with_taxonomy.get_ascii())

Architecture

ETE3 follows a hierarchical design centered around tree nodes:

  • TreeNode/Tree: Base classes providing core tree structure and manipulation
  • PhyloNode/PhyloTree: Extended classes with phylogenetic-specific features
  • EvolNode/EvolTree: Specialized classes for evolutionary analysis
  • SeqGroup: Sequence alignment and multiple sequence file handling
  • NCBITaxa: Integration with NCBI Taxonomy database
  • Visualization System: Modular rendering with styles, faces, and layouts
  • External Parsers: Support for multiple tree and sequence formats

This modular design allows users to work at different levels of complexity, from basic tree manipulation to advanced phylogenomic analysis.

Capabilities

Core Tree Operations

Fundamental tree structure manipulation including node creation, traversal, modification, and basic analysis. These operations form the foundation for all other ETE3 functionality.

class Tree:
    def __init__(self, newick=None, format=0, dist=None, support=None, name=None, quoted_node_names=False): ...
    def add_child(self, child=None, name=None, dist=None, support=None): ...
    def traverse(self, strategy="levelorder", is_leaf_fn=None): ...
    def get_leaves(self, is_leaf_fn=None): ...
    def get_common_ancestor(self, *target_nodes): ...
    def prune(self, nodes, preserve_branch_length=False): ...
    def write(self, features=None, outdir=None, format=0, is_leaf_fn=None): ...

Core Tree Operations

Phylogenetic Analysis

Advanced phylogenetic tree analysis including species handling, evolutionary event detection, tree reconciliation, and NCBI taxonomy integration.

class PhyloTree(Tree):
    def set_species_naming_function(self, fn): ...
    def reconcile(self, species_tree): ...
    def get_my_evol_events(self, sos_thr=0.0): ...
    def get_speciation_trees(self, map_features=None, autodetect_duplications=True): ...
    def annotate_ncbi_taxa(self, taxid_attr='species', tax2name=None, tax2track=None): ...

Phylogenetic Analysis

Sequence Handling

Multiple sequence alignment and sequence group operations for linking phylogenetic trees with molecular data.

class SeqGroup:
    def __init__(self, sequences=None, format="fasta", fix_duplicates=True): ...
    def get_seq(self, name): ...
    def iter_entries(self): ...
    def write(self, format="fasta", outfile=None): ...

Sequence Handling

NCBI Taxonomy Integration

Complete integration with NCBI Taxonomy database for taxonomic annotation, lineage retrieval, and species tree construction.

class NCBITaxa:
    def __init__(self, dbfile=None, taxdump_file=None, update=True): ...
    def get_topology(self, taxids, intermediate_nodes=False, rank_limit=None): ...
    def get_lineage(self, taxid): ...
    def annotate_tree(self, tree, taxid_attr="name", tax2name=None, tax2track=None, tax2rank=None): ...

NCBI Taxonomy

Tree Visualization

Comprehensive tree visualization system with customizable styles, faces, and layouts for creating publication-quality tree figures.

class TreeStyle:
    def __init__(self): ...

class NodeStyle:
    def __init__(self): ...

def show(tree_style=None): ...

Visualization

Data Tables and Arrays

Efficient handling of numerical data associated with trees and sequences, supporting matrix operations and statistical analysis.

class ArrayTable:
    def __init__(self, matrix_file=None, mtype="float"): ...
    def get_column_array(self, colname): ...
    def transpose(self): ...

Data Tables

Clustering Analysis

Specialized clustering tree operations for hierarchical clustering analysis and cluster validation.

class ClusterTree(Tree):
    def get_cluster_profile(self): ...
    def get_silhouette(self): ...

Clustering

External Format Support

Support for reading and writing multiple phylogenetic data formats including PhyloXML, NeXML, and various sequence formats.

class Phyloxml:
    def build_from_file(self, fname): ...
    def export(self): ...

class Nexml:
    def build_from_file(self, fname): ...
    def export(self): ...

External Formats