A toolkit for phylogenetic and hierarchical tree analysis, manipulation, and visualization.

Install

mkdir -p .claude/skills/etetoolkit && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2280" && unzip -o skill.zip -d .claude/skills/etetoolkit && rm skill.zip

Installs to .claude/skills/etetoolkit

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Phylogenetic tree toolkit (ETE). Tree manipulation (Newick/NHX), evolutionary event detection, orthology/paralogy, NCBI taxonomy, visualization (PDF/SVG), for phylogenomics.
173 charsno explicit “when” trigger
Advanced

Key capabilities

  • Prune taxonomic branches from trees
  • Calculate Robinson-Foulds distance
  • Perform midpoint rooting
  • Convert biological formats (NHX, Newick, PhyloXML)
  • Traverse trees using node-level strategies

How it works

It executes Python scripts that load trees into graph-based memory structures to perform topological manipulations or distance arithmetic.

Inputs & outputs

You give it
Path to phylogenetic tree file and operation type
You get back
Transformed tree object or visualization file (PDF/SVG)

When to use etetoolkit

  • Pruning phylogenetic trees to specific taxa
  • Calculating Robinson-Foulds distances between trees
  • Converting between Newick, NHX, and PhyloXML formats
  • Visualizing trees as PDF or SVG files

About this skill

ETE Toolkit Skill

Overview

ETE (Environment for Tree Exploration) is a toolkit for phylogenetic and hierarchical tree analysis. Manipulate trees, analyze evolutionary events, visualize results, and integrate with biological databases for phylogenomic research and clustering analysis.

Core Capabilities

1. Tree Manipulation and Analysis

Load, manipulate, and analyze hierarchical tree structures with support for:

  • Tree I/O: Read and write Newick, NHX, PhyloXML, and NeXML formats
  • Tree traversal: Navigate trees using preorder, postorder, or levelorder strategies
  • Topology modification: Prune, root, collapse nodes, resolve polytomies
  • Distance calculations: Compute branch lengths and topological distances between nodes
  • Tree comparison: Calculate Robinson-Foulds distances and identify topological differences

Common patterns:

from ete3 import Tree

# Load tree from file
tree = Tree("tree.nw", format=1)

# Basic statistics
print(f"Leaves: {len(tree)}")
print(f"Total nodes: {len(list(tree.traverse()))}")

# Prune to taxa of interest
taxa_to_keep = ["species1", "species2", "species3"]
tree.prune(taxa_to_keep, preserve_branch_length=True)

# Midpoint root
midpoint = tree.get_midpoint_outgroup()
tree.set_outgroup(midpoint)

# Save modified tree
tree.write(outfile="rooted_tree.nw")

Use scripts/tree_operations.py for command-line tree manipulation:

# Display tree statistics
python scripts/tree_operations.py stats tree.nw

# Convert format
python scripts/tree_operations.py convert tree.nw output.nw --in-format 0 --out-format 1

# Reroot tree
python scripts/tree_operations.py reroot tree.nw rooted.nw --midpoint

# Prune to specific taxa
python scripts/tree_operations.py prune tree.nw pruned.nw --keep-taxa "sp1,sp2,sp3"

# Show ASCII visualization
python scripts/tree_operations.py ascii tree.nw

2. Phylogenetic Analysis

Analyze gene trees with evolutionary event detection:

  • Sequence alignment integration: Link trees to multiple sequence alignments (FASTA, Phylip)
  • Species naming: Automatic or custom species extraction from gene names
  • Evolutionary events: Detect duplication and speciation events using Species Overlap or tree reconciliation
  • Orthology detection: Identify orthologs and paralogs based on evolutionary events
  • Gene family analysis: Split trees by duplications, collapse lineage-specific expansions

Workflow for gene tree analysis:

from ete3 import PhyloTree

# Load gene tree with alignment
tree = PhyloTree("gene_tree.nw", alignment="alignment.fasta")

# Set species naming function
def get_species(gene_name):
    return gene_name.split("_")[0]

tree.set_species_naming_function(get_species)

# Detect evolutionary events
events = tree.get_descendant_evol_events()

# Analyze events
for node in tree.traverse():
    if hasattr(node, "evoltype"):
        if node.evoltype == "D":
            print(f"Duplication at {node.name}")
        elif node.evoltype == "S":
            print(f"Speciation at {node.name}")

# Extract ortholog groups
ortho_groups = tree.get_speciation_trees()
for i, ortho_tree in enumerate(ortho_groups):
    ortho_tree.write(outfile=f"ortholog_group_{i}.nw")

Finding orthologs and paralogs:

# Find orthologs to query gene
query = tree & "species1_gene1"

orthologs = []
paralogs = []

for event in events:
    if query in event.in_seqs:
        if event.etype == "S":
            orthologs.extend([s for s in event.out_seqs if s != query])
        elif event.etype == "D":
            paralogs.extend([s for s in event.out_seqs if s != query])

3. NCBI Taxonomy Integration

Integrate taxonomic information from NCBI Taxonomy database:

  • Database access: Automatic download and local caching of NCBI taxonomy (~300MB)
  • Taxid/name translation: Convert between taxonomic IDs and scientific names
  • Lineage retrieval: Get complete evolutionary lineages
  • Taxonomy trees: Build species trees connecting specified taxa
  • Tree annotation: Automatically annotate trees with taxonomic information

Building taxonomy-based trees:

from ete3 import NCBITaxa

ncbi = NCBITaxa()

# Build tree from species names
species = ["Homo sapiens", "Pan troglodytes", "Mus musculus"]
name2taxid = ncbi.get_name_translator(species)
taxids = [name2taxid[sp][0] for sp in species]

# Get minimal tree connecting taxa
tree = ncbi.get_topology(taxids)

# Annotate nodes with taxonomy info
for node in tree.traverse():
    if hasattr(node, "sci_name"):
        print(f"{node.sci_name} - Rank: {node.rank} - TaxID: {node.taxid}")

Annotating existing trees:

# Get taxonomy info for tree leaves
for leaf in tree:
    species = extract_species_from_name(leaf.name)
    taxid = ncbi.get_name_translator([species])[species][0]

    # Get lineage
    lineage = ncbi.get_lineage(taxid)
    ranks = ncbi.get_rank(lineage)
    names = ncbi.get_taxid_translator(lineage)

    # Add to node
    leaf.add_feature("taxid", taxid)
    leaf.add_feature("lineage", [names[t] for t in lineage])

4. Tree Visualization

Create publication-quality tree visualizations:

  • Output formats: PNG (raster), PDF, and SVG (vector) for publications
  • Layout modes: Rectangular and circular tree layouts
  • Interactive GUI: Explore trees interactively with zoom, pan, and search
  • Custom styling: NodeStyle for node appearance (colors, shapes, sizes)
  • Faces: Add graphical elements (text, images, charts, heatmaps) to nodes
  • Layout functions: Dynamic styling based on node properties

Basic visualization workflow:

from ete3 import Tree, TreeStyle, NodeStyle

tree = Tree("tree.nw")

# Configure tree style
ts = TreeStyle()
ts.show_leaf_name = True
ts.show_branch_support = True
ts.scale = 50  # pixels per branch length unit

# Style nodes
for node in tree.traverse():
    nstyle = NodeStyle()

    if node.is_leaf():
        nstyle["fgcolor"] = "blue"
        nstyle["size"] = 8
    else:
        # Color by support
        if node.support > 0.9:
            nstyle["fgcolor"] = "darkgreen"
        else:
            nstyle["fgcolor"] = "red"
        nstyle["size"] = 5

    node.set_style(nstyle)

# Render to file
tree.render("tree.pdf", tree_style=ts)
tree.render("tree.png", w=800, h=600, units="px", dpi=300)

Use scripts/quick_visualize.py for rapid visualization:

# Basic visualization
python scripts/quick_visualize.py tree.nw output.pdf

# Circular layout with custom styling
python scripts/quick_visualize.py tree.nw output.pdf --mode c --color-by-support

# High-resolution PNG
python scripts/quick_visualize.py tree.nw output.png --width 1200 --height 800 --units px --dpi 300

# Custom title and styling
python scripts/quick_visualize.py tree.nw output.pdf --title "Species Phylogeny" --show-support

Advanced visualization with faces:

from ete3 import Tree, TreeStyle, TextFace, CircleFace

tree = Tree("tree.nw")

# Add features to nodes
for leaf in tree:
    leaf.add_feature("habitat", "marine" if "fish" in leaf.name else "land")

# Layout function
def layout(node):
    if node.is_leaf():
        # Add colored circle
        color = "blue" if node.habitat == "marine" else "green"
        circle = CircleFace(radius=5, color=color)
        node.add_face(circle, column=0, position="aligned")

        # Add label
        label = TextFace(node.name, fsize=10)
        node.add_face(label, column=1, position="aligned")

ts = TreeStyle()
ts.layout_fn = layout
ts.show_leaf_name = False

tree.render("annotated_tree.pdf", tree_style=ts)

5. Clustering Analysis

Analyze hierarchical clustering results with data integration:

  • ClusterTree: Specialized class for clustering dendrograms
  • Data matrix linking: Connect tree leaves to numerical profiles
  • Cluster metrics: Silhouette coefficient, Dunn index, inter/intra-cluster distances
  • Validation: Test cluster quality with different distance metrics
  • Heatmap visualization: Display data matrices alongside trees

Clustering workflow:

from ete3 import ClusterTree

# Load tree with data matrix
matrix = """#Names\tSample1\tSample2\tSample3
Gene1\t1.5\t2.3\t0.8
Gene2\t0.9\t1.1\t1.8
Gene3\t2.1\t2.5\t0.5"""

tree = ClusterTree("((Gene1,Gene2),Gene3);", text_array=matrix)

# Evaluate cluster quality
for node in tree.traverse():
    if not node.is_leaf():
        silhouette = node.get_silhouette()
        dunn = node.get_dunn()

        print(f"Cluster: {node.name}")
        print(f"  Silhouette: {silhouette:.3f}")
        print(f"  Dunn index: {dunn:.3f}")

# Visualize with heatmap
tree.show("heatmap")

6. Tree Comparison

Quantify topological differences between trees:

  • Robinson-Foulds distance: Standard metric for tree comparison
  • Normalized RF: Scale-invariant distance (0.0 to 1.0)
  • Partition analysis: Identify unique and shared bipartitions
  • Consensus trees: Analyze support across multiple trees
  • Batch comparison: Compare multiple trees pairwise

Compare two trees:

from ete3 import Tree

tree1 = Tree("tree1.nw")
tree2 = Tree("tree2.nw")

# Calculate RF distance
rf, max_rf, common_leaves, parts_t1, parts_t2 = tree1.robinson_foulds(tree2)

print(f"RF distance: {rf}/{max_rf}")
print(f"Normalized RF: {rf/max_rf:.3f}")
print(f"Common leaves: {len(common_leaves)}")

# Find unique partitions
unique_t1 = parts_t1 - parts_t2
unique_t2 = parts_t2 - parts_t1

print(f"Unique to tree1: {len(unique_t1)}")
print(f"Unique to tree2: {len(unique_t2)}")

Compare multiple trees:

import numpy as np

trees = [Tree(f"tree{i}.nw") for i in range(4)]

# Create distance matrix
n = len(trees)
dist_matrix = np.zeros((n, n))

for i in range(n):
    for j in range(i+1, n):
        rf, max_rf, _, _, _ = trees[i].robinson_foulds(trees[j])
        norm_rf = rf / max_rf if max_rf > 0 else 0
        dist_matrix[i, j] = nor

---

*Content truncated.*

When not to use it

  • Non-hierarchical data structures
  • Real-time streaming data analysis

Prerequisites

pythonETE Toolkit library

Limitations

  • Limited by system memory for very large trees
  • Requires knowledge of phylogenetic data formats

How it compares

It automates standard phylogenetic research workflows that normally require complex, manual bioinformatics scripting.

Compared to similar skills

etetoolkit side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
etetoolkit (this skill)67moReviewAdvanced
exploratory-data-analysis152moReviewIntermediate
model-compare77moReviewAdvanced
astropy67moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

software-architecture

davila7

Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

333868

planning-with-files

davila7

Implements Manus-style file-based planning for complex tasks. Creates task_plan.md, findings.md, and progress.md. Use when starting complex multi-step tasks, research projects, or any task requiring >5 tool calls.

233106

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

scroll-experience

davila7

Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.

101142

humanizer

davila7

Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases. Credits: Original skill by @blader - https://github.com/blader/humanizer

90175

game-development

davila7

Game development orchestrator. Routes to platform-specific skills based on project needs.

70195

You might also like

exploratory-data-analysis

K-Dense-AI

Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats. This skill should be used when analyzing any scientific data file to understand its structure, content, quality, and characteristics. Automatically detects file type and generates detailed markdown reports with format-specific analysis, quality metrics, and downstream analysis recommendations. Covers chemistry, bioinformatics, microscopy, spectroscopy, proteomics, metabolomics, and general scientific data formats.

15114

model-compare

rawwerks

Compare 3D CAD models using boolean operations (IoU, Dice, precision/recall). Use when evaluating generated models against gold references, diffing CAD revisions, or computing similarity metrics for ML training. Triggers on: model diff, compare models, IoU, intersection over union, model similarity, CAD comparison, STEP diff, 3D evaluation, gold reference, generated model, precision recall 3D.

783

astropy

davila7

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

682

statistical-analysis

anthropics

Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.

848

datacommons-client

davila7

Work with Data Commons, a platform providing programmatic access to public statistical data from global sources. Use this skill when working with demographic data, economic indicators, health statistics, environmental data, or any public datasets available through Data Commons. Applicable for querying population statistics, GDP figures, unemployment rates, disease prevalence, geographic entity resolution, and exploring relationships between statistical entities.

637

analyzing-market-sentiment

jeremylongshore

Analyze cryptocurrency market sentiment using Fear & Greed Index, news analysis, and market momentum. Use when gauging overall market mood, checking if markets are fearful or greedy, or analyzing sentiment for specific coins. Trigger with phrases like "analyze crypto sentiment", "check market mood", "is the market fearful", "sentiment for Bitcoin", or "Fear and Greed index".

339

Search skills

Search the agent skills registry