Agent skill

Biopython Phylo

by aipoch in aipoch/medical-research-skills

Use Bio.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required.

MITAuto-check passedData & Analytics

Install Biopython Phylo

skills CLI
$ npx skills add aipoch/medical-research-skills --skill biopython-phylo -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aipoch/medical-research-skills biopython-phylo --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aipoch/medical-research-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/'scientific-skills/Data Analysis/biopython-phylo' .claude/skills/biopython-phylo && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
biopython-phylo
GitHub stars
2k
Token cost
~1.8k tokens
SKILL.md length
286 words
Files
4 (incl. references)
Skills in repo
567
Repo updated
First seen
Licence
MIT

At a glance

Use Bio.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required.

  • Tree parsing/conversion
  • SKILL.md covers When to Use, Key Features, Dependencies and Example Usage, plus 1 more section
  • Calls python
  • Pruning/rerooting

What it does

Biopython Phylo is an agent skill from aipoch/medical-research-skills. Use Bio.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `biopython-phylo_audit_result_v1.json`, `config/task_config.json` and `references/phylogenetics.md`).

It sits in Data & Analytics, covering Bioinformatics and Data visualization. It works with Biopython and Matplotlib. The repository describes itself as: Hundreds of agent skills for medical research, including protocol design, data analysis, evidence insights, and academic writing. The licence is MIT.

When your agent uses it

  • Tree parsing/conversion
  • Pruning/rerooting
  • Distance calculation
  • Plotting is required

Example prompts

  • “/biopython-phylo”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 686e09d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Biopython Phylo loads about 1.8k tokens when it runs, and up to ~5.4k if it reads all its reference files. Until then it costs about 51 tokens; SKILL.md has 286 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aipoch/medical-research-skills at commit 686e09d, republished under its MIT licence (© aipoch). 286 words, ~1,754 tokens.

Download SKILL.mdSave it as .claude/skills/biopython-phylo/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
biopython-phylo
description
Use Bio.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required.
license
MIT
author
AIPOCH

Source: https://github.com/aipoch/medical-research-skills

biopython-phylo

When to Use

  • Converting phylogenetic tree files between Newick, NEXUS, and phyloXML formats.
  • Traversing a tree to locate clades, prune taxa, or reroot at a specific node/outgroup.
  • Computing pairwise distances, distance matrices, or basic tree statistics (e.g., branch length summaries).
  • Producing quick tree visualizations as ASCII output for logs/CLI workflows.
  • Generating publication-ready plots of trees using Matplotlib.

Key Features

  • Read and write phylogenetic trees via Bio.Phylo with support for common formats (Newick/NEXUS/phyloXML).
  • Tree manipulation utilities: traversal, clade selection, pruning, and rerooting.
  • Distance computation and simple statistics derived from branch lengths/topology.
  • Visualization options:
    • ASCII rendering for terminal output.
    • Matplotlib-based plotting for figures.

Dependencies

  • biopython>=1.80
  • Optional (for plotting):
    • matplotlib>=3.7

Example Usage

The following example is runnable end-to-end and follows the conventions:

  • Configuration is stored in config/task_config.json.
  • Script is invoked as python scripts/phylo_task.py.
  • All file I/O uses encoding="utf-8".
  • JSON output uses ensure_ascii=False.
config/task_config.json
json
{
  "input_tree": "data/input_tree.nwk",
  "input_format": "newick",
  "output_tree": "artifacts/output_tree.xml",
  "output_format": "phyloxml",
  "prune_terminals": ["TaxonC"],
  "reroot_outgroup": "TaxonB",
  "ascii_out": "artifacts/tree_ascii.txt",
  "stats_out": "artifacts/tree_stats.json",
  "plot_enabled": true,
  "plot_out": "artifacts/tree_plot.png"
}
scripts/phylo_task.py
python
import json
import os
from typing import Any, Dict, List, Optional

from Bio import Phylo


def ensure_parent_dir(path: str) -> None:
    parent = os.path.dirname(path)
    if parent:
        os.makedirs(parent, exist_ok=True)


def load_config(path: str) -> Dict[str, Any]:
    with open(path, "r", encoding="utf-8") as f:
        return json.load(f)


def prune_by_names(tree, names: List[str]) -> None:
    # Prune terminals by name if present
    for n in names:
        if tree.find_any(name=n) is not None:
            tree.prune(target=n)


def reroot_by_outgroup_name(tree, outgroup_name: str) -> None:
    outgroup = tree.find_any(name=outgroup_name)
    if outgroup is None:
        raise ValueError(f"Outgroup '{outgroup_name}' not found in tree terminals/clades.")
    tree.root_with_outgroup(outgroup)


def tree_stats(tree) -> Dict[str, Any]:
    terminals = tree.get_terminals()
    nonterminals = tree.get_nonterminals()

    # Collect branch lengths (may include None)
    lengths = []
    for clade in tree.find_clades(order="preorder"):
        if clade.branch_length is not None:
            lengths.append(float(clade.branch_length))

    return {
        "n_terminals": len(terminals),
        "n_nonterminals": len(nonterminals),
        "n_clades_total": len(terminals) + len(nonterminals),
        "branch_length_count": len(lengths),
        "branch_length_sum": sum(lengths) if lengths else 0.0,
        "branch_length_min": min(lengths) if lengths else None,
        "branch_length_max": max(lengths) if lengths else None,
        "branch_length_mean": (sum(lengths) / len(lengths)) if lengths else None,
    }


def write_ascii(tree, out_path: str) -> None:
    ensure_parent_dir(out_path)
    with open(out_path, "w", encoding="utf-8") as f:
        Phylo.draw_ascii(tree, file=f)


def plot_tree(tree, out_path: str) -> None:
    # Optional dependency: matplotlib
    import matplotlib
    matplotlib.use("Agg")  # headless backend
    import matplotlib.pyplot as plt

    ensure_parent_dir(out_path)
    fig = plt.figure(figsize=(10, 6))
    ax = fig.add_subplot(1, 1, 1)
    Phylo.draw(tree, do_show=False, axes=ax)
    fig.tight_layout()
    fig.savefig(out_path, dpi=200)
    plt.close(fig)


def main(config_path: str = "config/task_config.json") -> None:
    cfg = load_config(config_path)

    input_tree = cfg["input_tree"]
    input_format = cfg.get("input_format", "newick")
    output_tree = cfg["output_tree"]
    output_format = cfg.get("output_format", "phyloxml")

    prune_terminals: List[str] = cfg.get("prune_terminals", [])
    reroot_outgroup: Optional[str] = cfg.get("reroot_outgroup")

    ascii_out = cfg.get("ascii_out", "artifacts/tree_ascii.txt")
    stats_out = cfg.get("stats_out", "artifacts/tree_stats.json")

    plot_enabled = bool(cfg.get("plot_enabled", False))
    plot_out = cfg.get("plot_out", "artifacts/tree_plot.png")

    # Read
    tree = Phylo.read(input_tree, input_format)

    # Manipulate
    if prune_terminals:
        prune_by_names(tree, prune_terminals)

    if reroot_outgroup:
        reroot_by_outgroup_name(tree, reroot_outgroup)

    # Write converted tree
    ensure_parent_dir(output_tree)
    Phylo.write(tree, output_tree, output_format)

    # ASCII visualization
    write_ascii(tree, ascii_out)

    # Stats
    ensure_parent_dir(stats_out)
    with open(stats_out, "w", encoding="utf-8") as f:
        json.dump(tree_stats(tree), f, ensure_ascii=False, indent=2)

    # Plot (optional)
    if plot_enabled:
        plot_tree(tree, plot_out)


if __name__ == "__main__":
    main()
Run
bash
python scripts/phylo_task.py

Implementation Details

  • Configuration-first execution: parameters are stored in config/task_config.json as an intermediate artifact; scripts are invoked uniformly via python scripts/<task_name>.py. Avoid stacking many CLI -- arguments; prefer config files.
  • Encoding and JSON output:
    • Always open files with encoding="utf-8".
    • When writing JSON, use ensure_ascii=False to preserve non-ASCII characters.
  • Supported formats:
    • Input/output formats are passed to Phylo.read(...) and Phylo.write(...) (e.g., newick, nexus, phyloxml).
  • Pruning:
    • Pruning is performed by terminal/clade name using tree.prune(target=<name>). Names not found are skipped (or can be treated as errors depending on your policy).
  • Rerooting:
    • Rerooting uses tree.root_with_outgroup(outgroup_clade); the outgroup is located via tree.find_any(name=...).
  • Statistics:
    • Branch lengths may be missing (None); statistics should ignore missing values.
    • Basic counts can be derived from tree.get_terminals() and tree.get_nonterminals().
  • Visualization:
    • ASCII output uses Phylo.draw_ascii(tree, file=...) for deterministic CLI-friendly rendering.
    • Matplotlib plotting uses a non-interactive backend (Agg) for headless environments and saves to an image file.

© aipoch, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in scientific-skills/Data Analysis/biopython-phylo of aipoch/medical-research-skills.

  • SKILL.md
  • biopython-phylo_audit_result_v1.json
  • config/task_config.json
  • references/phylogenetics.md

Open the folder on GitHubat commit 686e09d

Compare with similar skills

Biopython Phylo next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Biopython Phylo compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Biopython Phylo this skillaipoch/medical-research-skills2k—~1.8kAutomated safety check: PassMIT
Bio Data Visualization Manhattan Qq LocuszoomGPTomics/bioSkills1.2k2 repos~4.3kAutomated safety check: PassMIT
Bio Data Visualization Volcano And Ma PlotsGPTomics/bioSkills1.2k2 repos~5.3kAutomated safety check: PassMIT
Bio Reporting Figure ExportGPTomics/bioSkills1.2k1 repos~3.6kAutomated safety check: PassMIT
Bio Metagenomics VisualizationFreedomIntelligence/OpenClaw-Medical-Skills3.1k1 repos~1.8kAutomated safety check: PassNone
Bio Phylo Tree VisualizationGPTomics/bioSkills1.2k1 repos~5.2kAutomated safety check: PassMIT

Similar skills

  • Build Manhattan, Miami, QQ, and locuszoom-style regional plots from GWAS, TWAS, PWAS, and QTL summary statistics with correct genomic-inflation diagnostics, multi-trait overlays, lead-SNP labeling…

    1.2k GitHub starsUsed in 2 repos~4.3k tokens
    Data & AnalyticsAuto-check passed
  • Build volcano and MA plots from differential-expression / association results with LFC shrinkage, FDR-adjusted thresholds, sensible label placement, and axis-truncation conventions.

    1.2k GitHub starsUsed in 2 repos~5.3k tokens
    Data & AnalyticsAuto-check passed
  • Bio Reporting Figure Export

    GPTomics/bioSkills

    Exports publication-ready figures with the correct vector/raster split, embedded editable fonts, color-space-robust palettes, and journal-correct sizing and resolution in matplotlib and ggplot2.

    1.2k GitHub starsUsed in 1 repo~3.6k tokens
    Data & AnalyticsAuto-check passed
  • Bio Metagenomics Visualization

    FreedomIntelligence/OpenClaw-Medical-Skills

    Visualize metagenomic profiles using R (phyloseq, microbiome) and Python (matplotlib, seaborn).

    3.1k GitHub starsUsed in 1 repo~1.8k tokens
    Data & AnalyticsAuto-check passed
  • Draw and export phylogenetic trees with Bio.Phylo plus matplotlib, and route rich figures to ggtree, ETE4, or iTOL.

    1.2k GitHub starsUsed in 1 repo~5.2k tokens
    Data & AnalyticsAuto-check passed
  • Bio Hi C Analysis Hic Visualization

    FreedomIntelligence/OpenClaw-Medical-Skills

    Visualize Hi-C contact matrices, TADs, loops, and genomic features using matplotlib, cooltools, and HiCExplorer.

    3.1k GitHub starsUsed in 1 repo~2.2k tokens
    Research & ScienceAuto-check passed

More from aipoch/medical-research-skills

All 567 skills in this repo
  • Academic Poster Generator

    aipoch/medical-research-skills

    Complete workflow for generating academic research posters from PDF literature; use when you need to extract paper content from PDFs and produce a LaTeX-based poster…

    2k GitHub stars~2.2k tokensUpdated 21 days ago
    Auto-check passed
  • Diagnostic Study Quality Assessment Quadas

    aipoch/medical-research-skills

    Analyzes clinical diagnostic accuracy studies for bias using the QUADAS-2 tool.

    2k GitHub stars~1.4k tokensUpdated 21 days ago
    Auto-check passed
  • Exploratory Data Analysis

    aipoch/medical-research-skills

    Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats.

    2k GitHub stars~3.7k tokensUpdated 21 days ago
    Auto-check passed
  • Iso Certification

    aipoch/medical-research-skills

    A toolkit for preparing ISO 13485:2016 certification documentation for medical device QMS.

    2k GitHub stars~1.8k tokensUpdated 21 days ago
    Auto-check passed
  • Journal Skills

    aipoch/medical-research-skills

    Recommends target journals for manuscript submission by analyzing the paper topic/abstract and the journal distribution of similar PubMed literature; use when users ask for journal…

    2k GitHub stars~1.7k tokensUpdated 21 days ago
    Auto-check passed
  • Latex Posters

    aipoch/medical-research-skills

    Creates academic-poster writing packages for LaTeX using beamerposter, tikzposter, or baposter.

    2k GitHub stars~1.3k tokensUpdated 21 days ago
    Auto-check passed

Questions about Biopython Phylo

What does Biopython Phylo do?

Use Bio.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required. Biopython Phylo is an agent skill from aipoch/medical-research-skills.Phylo to read/write phylogenetic trees and perform visualization and statistics; use when tree parsing/conversion, pruning/rerooting, distance calculation, or plotting is required.

When should I use Biopython Phylo?

Biopython Phylo fits situations like: tree parsing/conversion; pruning/rerooting; distance calculation; plotting is required.

How do I install Biopython Phylo in Claude Code?

Run `npx skills add aipoch/medical-research-skills --skill biopython-phylo -a claude-code`. Or copy the skill folder (scientific-skills/Data Analysis/biopython-phylo in aipoch/medical-research-skills) into .claude/skills/biopython-phylo in your project. Claude Code loads it when a task matches its description.

How do I install Biopython Phylo in Codex?

Run `npx skills add aipoch/medical-research-skills --skill biopython-phylo -a codex`. Or copy the skill folder (scientific-skills/Data Analysis/biopython-phylo in aipoch/medical-research-skills) into .agents/skills/biopython-phylo in your project. Codex loads it when a task matches its description.

Can I use Biopython Phylo in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aipoch/medical-research-skills --skill biopython-phylo -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/biopython-phylo, .gemini/skills/biopython-phylo, .github/skills/biopython-phylo and .opencode/skills/biopython-phylo in your project.

What does Biopython Phylo need to run?

Going by SKILL.md and its folder, Biopython Phylo needs the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Biopython Phylo access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Biopython Phylo safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Biopython Phylo use?

Biopython Phylo is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Biopython Phylo use?

About 1.8k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.6k tokens, read only when the agent opens those files.

What are the alternatives to Biopython Phylo?

Skills that share tags, products or a category with Biopython Phylo: Bio Data Visualization Manhattan Qq Locuszoom (GPTomics/bioSkills, 1.2k stars), Bio Data Visualization Volcano And Ma Plots (GPTomics/bioSkills, 1.2k stars), Bio Reporting Figure Export (GPTomics/bioSkills, 1.2k stars) and Bio Metagenomics Visualization (FreedomIntelligence/OpenClaw-Medical-Skills, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Biopython Phylo?

aipoch (a GitHub organization) maintains it in aipoch/medical-research-skills, which has 1,974 GitHub stars. The repository holds 567 skills in this directory. The repository was last updated on September 17, 2026.

Source: aipoch/medical-research-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.