etetoolkit
ETE (Environment for Tree Exploration) toolkit for phylogenetic and hierarchical tree analysis; use it when you need to parse/manipulate Newick/NHX trees, detect duplication/speciation events, integrate NCBI taxonomy, and render publication-quality figures.
Best use case
etetoolkit is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
ETE (Environment for Tree Exploration) toolkit for phylogenetic and hierarchical tree analysis; use it when you need to parse/manipulate Newick/NHX trees, detect duplication/speciation events, integrate NCBI taxonomy, and render publication-quality figures.
Teams using etetoolkit should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/etetoolkit/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How etetoolkit Compares
| Feature / Agent | etetoolkit | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
ETE (Environment for Tree Exploration) toolkit for phylogenetic and hierarchical tree analysis; use it when you need to parse/manipulate Newick/NHX trees, detect duplication/speciation events, integrate NCBI taxonomy, and render publication-quality figures.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)
## When to Use
- **Preprocess phylogenetic trees**: convert formats (Newick/NHX/PhyloXML), reroot (midpoint/outgroup), prune taxa, and resolve polytomies before downstream analyses.
- **Detect evolutionary events in gene trees**: infer **duplication vs. speciation** events and derive **ortholog/paralog** relationships for phylogenomics.
- **Annotate trees with taxonomy**: map species names to **NCBI TaxIDs**, retrieve lineages/ranks, and build minimal taxonomy topologies connecting a set of taxa.
- **Generate publication-quality visualizations**: render trees to **PDF/SVG/PNG** with custom styles, support-based coloring, and node “faces” (labels, shapes, heatmaps).
- **Compare alternative topologies**: quantify differences between trees using **Robinson–Foulds (RF)** distance and partition/bipartition analysis.
## Key Features
- **Tree I/O and manipulation**
- Read/write: Newick, NHX, PhyloXML, NeXML
- Traversals: preorder, postorder, levelorder
- Operations: prune, reroot, collapse, resolve polytomies
- Metrics: branch/topological distances, RF distance
- **Phylogenetic (gene tree) analysis**
- Alignment association (FASTA/Phylip)
- Species name extraction from gene IDs
- Duplication/speciation detection (e.g., species overlap / reconciliation-style workflows)
- Orthology/paralogy extraction and gene-family splitting
- **NCBI taxonomy integration**
- Auto-download + local cache of taxonomy DB
- TaxID ↔ scientific name translation
- Lineage/rank retrieval and taxonomy-based topology building
- Tree annotation with taxonomic metadata
- **Visualization**
- Rectangular/circular layouts, GUI exploration
- NodeStyle/TreeStyle customization
- Faces (text, shapes, charts/heatmaps) and layout functions
- Export to PDF/SVG/PNG
- **Clustering support**
- ClusterTree for dendrograms linked to numeric matrices
- Cluster quality metrics (e.g., silhouette, Dunn index)
- Heatmap + tree combined views
## Dependencies
- `ete3` (recommended: `>=3.1.0`)
- Optional GUI/rendering dependencies (platform-specific):
- `PyQt5` (e.g., `>=5.15`)
- Qt SVG support (often packaged as `python3-pyqt5.qtsvg` on Debian/Ubuntu)
## Example Usage
The following example is designed to be runnable end-to-end (it uses an in-memory Newick string and does not require external files).
```python
# pip install ete3
from ete3 import Tree, TreeStyle, NodeStyle
# 1) Load a tree (Newick)
nw = "((A:0.1,B:0.2)90:0.3,(C:0.2,D:0.4)70:0.1);"
t = Tree(nw, format=1)
# 2) Basic stats
print("Leaves:", len(t))
print("Total nodes:", sum(1 for _ in t.traverse()))
# 3) Midpoint rooting
mid = t.get_midpoint_outgroup()
t.set_outgroup(mid)
# 4) Prune to taxa of interest (preserve branch lengths)
t.prune(["A", "C", "D"], preserve_branch_length=True)
# 5) Style nodes (color internal nodes by support)
ts = TreeStyle()
ts.show_leaf_name = True
ts.show_branch_support = True
for n in t.traverse():
st = NodeStyle()
if n.is_leaf():
st["fgcolor"] = "blue"
st["size"] = 8
else:
# ETE stores internal support in n.support when present
st["fgcolor"] = "darkgreen" if getattr(n, "support", 0) >= 80 else "red"
st["size"] = 5
n.set_style(st)
# 6) Render (PDF/SVG/PNG supported depending on your environment)
t.render("example_tree.pdf", tree_style=ts)
print("Wrote: example_tree.pdf")
```
## Implementation Details
### Tree parsing formats (Newick “format” codes)
ETE uses a `format` integer to control how node attributes are interpreted when reading/writing Newick. Common patterns:
- `format=0`: flexible default (often includes branch lengths)
- `format=1`: includes internal node names
- `format=2`: includes support/bootstrap values
- `format=5`: internal node names + branch lengths
- `format=8`: name + distance + support (maximal common usage)
- `format=9`: leaf names only
- `format=100`: topology only
Example:
```python
from ete3 import Tree
t = Tree("tree.nw", format=1)
t.write(outfile="out.nw", format=5)
```
### NHX feature preservation
NHX is used to store custom per-node features. When writing, specify which features to serialize:
```python
t.write(outfile="tree.nhx", features=["taxid", "habitat", "lineage"])
```
### Rerooting and pruning behavior
- **Midpoint rooting** uses `get_midpoint_outgroup()` to select an outgroup that balances path lengths.
- **Pruning** should typically use `preserve_branch_length=True` to avoid distorting distances in phylogenetic contexts.
### Evolutionary event detection (gene trees)
For gene trees, `PhyloTree` supports event labeling on internal nodes (commonly:
- `evoltype == "D"` for duplication
- `evoltype == "S"` for speciation)
A typical workflow is:
1. Load a gene tree (optionally with an alignment).
2. Provide a **species naming function** to map gene IDs → species.
3. Run descendant event detection.
4. Extract ortholog groups (speciation subtrees) or query ortholog/paralog sets from events.
### Tree comparison (Robinson–Foulds)
`Tree.robinson_foulds(other_tree)` returns:
- `rf`: RF distance (number of differing bipartitions)
- `max_rf`: maximum possible RF given shared leaves
- plus shared leaves and partition sets for deeper inspection
Normalized RF is typically computed as `rf / max_rf` (when `max_rf > 0`).Related Skills
skill-auditor
A comprehensive auditor for any agent skill — including Manus, OpenClaw/ClawHub, Claude, LobeHub, or custom SKILL.md-based skills. Use this skill whenever a user wants to evaluate, audit, review, score, or quality-check an agent skill before publishing, updating, or deploying. Covers two hard veto gates (structural redlines + research integrity redlines), static quality scoring across 25 criteria (ISO 25010 + OpenSSF + Agent), dynamic test input generation, multi-mode execution testing, multi-layer output evaluation with five specialized category rubrics (Evidence Insight / Protocol Design / Data Analysis / Academic Writing / Other), a Research Veto that applies to all four research categories, human eval viewer generation, actionable P0/P1/P2 optimization recommendations, and automatic skill improvement that outputs a polished, production-ready SKILL.md. Also use whenever a user says "audit my skill", "evaluate my skill", "improve my skill", or wants a corrected version after evaluation.
two-sample-mr-research-planner
Generates complete two-sample Mendelian randomization (MR) research designs from a user-provided research direction. Use when users want to design, plan, or build a study using two-sample MR to test causal relationships. Triggers:"design a two-sample MR study", "build a publishable MR paper", "test whether this biomarker causally affects this disease", "generate Lite/Standard/Advanced MR plans", "screen multiple exposures with MR", "bidirectional MR design", "causal inference using GWAS summary statistics", or "I want to study X and Y using MR". Always outputs four workload configurations (Lite / Standard / Advanced / Publication+) with a recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, and publication upgrade path.
research-proposal-generator
Generates a comprehensive research proposal design based on input literature, including hypothesis, mechanism verification, and budget. Use when the user wants to design a research project from a paper.
research-grants
Write competitive research proposals for NSF, NIH, DOE, DARPA, and Taiwan's NSTC when you need agency-compliant narratives, budgets, and review-criteria alignment for a specific solicitation/FOA/BAA.
protocol-standardization
Standardize fragmented experimental steps into reproducible protocol documents when you need method organization, lab SOP drafting, or cross-operator reproducibility; missing parameters must be explicitly marked as "To be supplemented/Not provided".
prospero-registration-helper
Assists researchers in generating PROSPERO registration content for meta-analyses from a title and optional protocol. Use when the user wants to draft a PROSPERO registration form.
non-tumor-ml-research-planner
Generates complete non-tumor biomedical machine learning research designs from a user-provided research direction. Always use this skill when users want to plan bioinformatics + ML papers for non-cancer diseases (metabolic, cardiovascular, kidney, inflammatory, autoimmune, infectious, neurological, endocrine, wound healing, chronic multifactor), design diagnostic biomarker studies, combine GEO datasets with feature selection and ML modeling, or generate Lite/Standard/Advanced/Publication+ workload plans. Trigger for:"non-tumor ML study", "bioinformatics paper outside oncology", "key genes and diagnostic model for a disease", "pyroptosis/ferroptosis/senescence/autophagy + disease", "GEO datasets + machine learning", "RF + LASSO diagnostic model", "DEG + feature selection + validation", "immune infiltration + biomarker", "non-cancer biomarker paper". Trigger even for casual phrasings like "I want to study X using machine learning", "help me design a non-tumor bioinformatics paper", or "how do I build a diagnostic model for disease Y".
network-tox-docking-research-planner
Generates complete network toxicology + molecular docking research designs from a user-provided toxicant and disease/phenotype. Always use this skill when users want to investigate how an environmental toxicant, endocrine disruptor, heavy metal, food contaminant, pharmaceutical residue, or consumer product chemical may contribute to a disease through shared molecular targets, hub genes, pathways, and docking evidence. Trigger for:"network toxicology study", "toxicology mechanism paper", "target prediction + PPI + docking", "environmental pollutant and disease mechanism", "hub genes and docking for toxicant", "Lite/Standard/Advanced toxicology plan", "CTD + SwissTargetPrediction + GeneCards + STRING", "CB-Dock2 docking study", "triclosan/BPA/cadmium/PFAS + disease". Also triggers for Chinese phrasings:"网络毒理学研究设计"、"毒物机制论文"、"靶点预测+PPI+对接"、"环境污染物与疾病机制". Trigger even for casual phrasings like "I want to study how chemical X affects disease Y" or "help me design a toxicology paper". Always output four workload configurations (Lite / Standard / Advanced / Publication+) with a recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, and publication upgrade path.
meta-protocol-writer
Generates a PROSPERO-compliant Meta-analysis protocol based on Title and PICOS. Use when the user wants to write a protocol for a systematic review or meta-analysis.
hypothesis-generation
Structured scientific hypothesis formulation from observations; use when you have experimental observations or preliminary data and need testable hypotheses with predictions, mechanisms, and validation experiments.
hypogenic
Automated LLM-driven hypothesis generation and testing for tabular datasets; use when you need systematic exploration of empirical patterns (e.g., fraud detection, content analysis) and want to combine literature insights with data-driven hypothesis evaluation.
faers-multi-drug-soc-planner
Generates complete FAERS-based multi-drug single-SOC safety comparison research designs from a user-provided drug set, comparator, and adverse event domain. Always use this skill when users want to compare safety signals across multiple drugs using FAERS or OpenFDA data within one System Organ Class (SOC) or bounded AE domain. Trigger for:"FAERS study comparing drugs within one SOC", "publishable FAERS safety comparison paper", "compare neuropsychiatric adverse events across beta-blockers", "Lite/Standard/Advanced FAERS safety plans", "active-comparator restricted disproportionality", "adjusted ROR logistic regression FAERS", "within-class head-to-head drug comparison", "pharmacovigilance signal comparison", "single-SOC PT-level FAERS design", or any phrasing like "I want to compare drug X and drug Y for adverse events in FAERS" or "build a comparative pharmacovigilance paper". Always output four workload configurations (Lite / Standard / Advanced / Publication+) with a recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, and publication upgrade path.