Analyzes biological data with scikit-bio: sequence analysis, alignments, phylogenetic trees, alpha/beta diversity (UniFrac), ordination (PCoA), PERMANOVA, and FASTA/Newick I/O. For microbiome and community-ecology workflows.
scikit-bio is a comprehensive Python library for working with biological data. Apply this skill for bioinformatics analyses spanning sequence manipulation, alignment, phylogenetics, microbial ecology, and multivariate statistics.
This skill should be used when the user:
| Scenario | Use Instead |
|---|---|
| Running the full amplicon pipeline (demux -> DADA2 -> taxonomy -> diversity) as QIIME 2 artifacts | alterlab-qiime2-amplicon |
| Inferring a phylogeny with a substitution model (IQ-TREE/RAxML, bootstrap support) | alterlab-phylogenetics |
| Publication-quality tree figures — styled rendering, colored clades, custom node styles | alterlab-etetoolkit |
| General sequence record parsing, BLAST parsing, Entrez retrieval | alterlab-biopython |
| Single-cell or bulk expression analysis rather than community ecology | alterlab-scanpy / alterlab-pydeseq2 |
| Generic multivariate statistics on non-compositional data | alterlab-statistical-analysis |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-qiime2-amplicon) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Work with biological sequences using specialized classes for DNA, RNA, and protein data.
Key operations:
Common patterns:
import skbio
# Read sequences from file
seq = skbio.DNA.read('input.fasta')
# Sequence operations
rc = seq.reverse_complement()
rna = seq.transcribe()
protein = rna.translate()
# Find motifs
motif_positions = seq.find_with_regex('ATG[ACGT]{3}')
# Check for properties
has_degens = seq.has_degenerates()
seq_no_gaps = seq.degap()
Important notes:
DNA, RNA, Protein classes for grammared sequences with validationSequence class for generic sequences without alphabet restrictionsPerform pairwise and multiple sequence alignments using dynamic programming algorithms.
Key capabilities:
pair_align APIPairAlignPathTabularMSAmulti_align (and the multi_align_nucl /
multi_align_prot wrappers), added in 0.7.4 — previously TabularMSA could only hold an
alignment produced elsewhereCommon patterns:
from skbio.alignment import pair_align, pair_align_nucl, pair_align_prot, TabularMSA
from skbio import DNA
# Pairwise alignment (0.7+ unified API). mode='global' (default) or 'local'.
seq1, seq2 = DNA('ATCGATCGATCG'), DNA('ATCGGGGATCG')
res = pair_align(seq1, seq2, mode='local')
print(res.score)
aligned = res.paths[0].to_aligned((seq1, seq2)) # tuple of aligned sequences
# Nucleotide / protein convenience wrappers with sensible defaults
res = pair_align_nucl(seq1, seq2) # DNA/RNA
# res = pair_align_prot(p1, p2, sub_score='BLOSUM62') # protein
# Read multiple alignment from file
msa = TabularMSA.read('alignment.fasta', constructor=DNA)
consensus = msa.consensus()
Important notes:
pair_align returns a named tuple (score, paths, matrices); paths is a list of PairAlignPath objects (up to max_paths).sub_score accepts a (match, mismatch) tuple, a named matrix string (e.g. 'BLOSUM62'), or a SubstitutionMatrix; gap_cost takes a single value (linear) or (open, extend) tuple (affine — recommended for biological sequences).local_pairwise_align_ssw, StripedSmithWaterman, and *_pairwise_align/AlignScorer interfaces were removed/deprecated in 0.6–0.7; use pair_align* instead.multi_align(seqs) (0.7.4+) builds a progressive alignment and
returns a TabularMSA. It is a convenience implementation, not a MAFFT/MUSCLE replacement —
for large or publication-critical alignments still use a dedicated aligner
(alterlab-phylogenetics covers that path).Construct, manipulate, and analyze phylogenetic trees representing evolutionary relationships.
Key capabilities:
Common patterns:
from skbio import TreeNode
from skbio.tree import nj
# Read tree from file
tree = TreeNode.read('tree.nwk')
# Construct tree from distance matrix
tree = nj(distance_matrix)
# Tree operations
subtree = tree.shear(['taxon1', 'taxon2', 'taxon3'])
tips = [node for node in tree.tips()]
lca = tree.lowest_common_ancestor(['taxon1', 'taxon2'])
# Calculate distances
patristic_dist = tree.find('taxon1').distance(tree.find('taxon2'))
cophenetic_matrix = tree.cophenetic_matrix()
# Compare tree topologies (Robinson-Foulds)
rf_distance = tree.compare_rfd(other_tree)
Important notes:
skbio.tree: nj (neighbor joining), upgma (assumes a molecular clock), and gme/bme (greedy/balanced minimum evolution).tree.compare_rfd(other); the module-level rf_dists() computes pairwise RF distances across many trees. (robinson_foulds was renamed.)Calculate alpha and beta diversity metrics for microbial ecology and community analysis.
Key capabilities:
Common patterns:
from skbio.diversity import alpha_diversity, beta_diversity
import skbio
# Alpha diversity
alpha = alpha_diversity('shannon', counts_matrix, ids=sample_ids)
faith_pd = alpha_diversity('faith_pd', counts_matrix, ids=sample_ids,
tree=tree, taxa=feature_ids)
# Beta diversity
bc_dm = beta_diversity('braycurtis', counts_matrix, ids=sample_ids)
unifrac_dm = beta_diversity('unweighted_unifrac', counts_matrix,
ids=sample_ids, tree=tree, taxa=feature_ids)
# Get available metrics
from skbio.diversity import get_alpha_diversity_metrics
print(get_alpha_diversity_metrics())
Important notes:
taxa= (renamed from otu_ids= in 0.6; "OTU" terminology was replaced by "taxon" project-wide). Plain richness is observed_features, not the old observed_otus.tree plus taxa (feature) IDs that match the tree tips.partial_beta_diversity() for computing specific sample pairs only.pandas.Series; beta diversity returns a DistanceMatrix.Reduce high-dimensional biological data to visualizable lower-dimensional spaces.
Key capabilities:
Common patterns:
from skbio.stats.ordination import pcoa, cca
# PCoA from distance matrix
pcoa_results = pcoa(distance_matrix)
pc1 = pcoa_results.samples['PC1']
pc2 = pcoa_results.samples['PC2']
# CCA: y = samples-by-features table, x = samples-by-constraints (environment)
cca_results = cca(feature_table, environmental_matrix)
# Save/load ordination results
pcoa_results.write('ordination.txt')
results = skbio.OrdinationResults.read('ordination.txt')
Important notes:
Perform hypothesis tests specific to ecological and biological data.
Key capabilities:
Common patterns:
from skbio.stats.distance import permanova, anosim, mantel
# Test if groups differ significantly
permanova_results = permanova(distance_matrix, grouping, permutations=999)
print(f"p-value: {permanova_results['p-value']}")
# ANOSIM test
anosim_results = anosim(distance_matrix, grouping, permutations=999)
# Mantel test between two distance matrices
mantel_results = mantel(dm1, dm2, method='pearson', permutations=999)
print(f"Correlation: {mantel_results[0]}, p-value: {mantel_results[1]}")
Important notes:
permanova, mantel, permdisp, pcoa and the UniFrac metrics accept engine="fast"
(0.7.4+), which uses Numba when installed and Cython otherwise; skbio.get_config() shows the
current settings and the global compute_engine option sets them in one place. Defaults are
unchanged, so results do not shift when you opt in — only the runtime.skbio.stats.composition carries the compositional-data toolkit: clr / ilr / rclr (and
rclr_inv) transforms, ancom, ancombc, ancombc2 (0.7.4+, with global, pairwise, Dunnett
and trend post-hoc tests), dirmult_ttest and dirmult_lme.
Two 0.7.4 changes to watch for, because old code keeps running and returns something different:
ancombc now returns an ANCOMBCResult rather than a DataFrame (the primary table is
.result, and the global test moved to ANCOMBCResult.global_test() after a correctness fix),
and its Log2(FC) column was renamed Log(FC) because the values were always natural-log.
Anything that read Log2(FC) or exponentiated base-2 was misreporting effect sizes.
Read and write 19+ biological file formats with automatic format detection.
Supported formats:
Common patterns:
import skbio
# Read with automatic format detection
seq = skbio.DNA.read('file.fasta', format='fasta')
tree = skbio.TreeNode.read('tree.nwk')
# Write to file
seq.write('output.fasta', format='fasta')
# Generator for large files (memory efficient)
for seq in skbio.io.read('large.fasta', format='fasta', constructor=skbio.DNA):
process(seq)
# Convert formats
seqs = list(skbio.io.read('input.fastq', format='fastq', constructor=skbio.DNA))
skbio.io.write(seqs, format='fasta', into='output.fasta')
Important notes:
into parameter specifiedverify=FalseCreate and manipulate distance/dissimilarity matrices with statistical methods.
Key capabilities:
Common patterns:
from skbio import DistanceMatrix
import numpy as np
# Create from array
data = np.array([[0, 1, 2], [1, 0, 3], [2, 3, 0]])
dm = DistanceMatrix(data, ids=['A', 'B', 'C'])
# Access distances
dist_ab = dm['A', 'B']
row_a = dm['A']
# Read from file
dm = DistanceMatrix.read('distances.txt')
# Use in downstream analyses
pcoa_results = pcoa(dm)
permanova_results = permanova(dm, grouping)
Important notes:
Work with feature tables (OTU/ASV tables) common in microbiome research.
Key capabilities:
Common patterns:
from skbio.table import Table
# Read BIOM table
table = Table.read('table.biom')
# Access data
sample_ids = table.ids(axis='sample')
feature_ids = table.ids(axis='observation')
counts = table.matrix_data # scipy sparse; .toarray() for dense
# Filter
filtered = table.filter(sample_ids_to_keep, axis='sample')
# To pandas (sparse by default)
df = table.to_dataframe(dense=True)
Important notes:
Table is scikit-bio's re-export of the BIOM Table; import it from skbio.table (not the top-level skbio namespace).observation = features (taxa/OTUs/ASVs), sample = samples; matrix_data is observations-by-samples sparse.Table(data, observation_ids, sample_ids) constructor or Table.from_tsv / from_json / from_hdf5 (there is no from_dataframe).Work with protein language model embeddings for downstream analysis.
Key capabilities:
Common patterns:
from skbio.embedding import (
ProteinEmbedding, ProteinVector,
embed_vec_to_distances, embed_vec_to_ordination, embed_vec_to_numpy,
)
# Per-residue embedding for one protein (e.g. an ESM output)
emb = ProteinEmbedding(embedding_array, sequence)
# One fixed-length vector per protein (e.g. a mean-pooled embedding)
vecs = [ProteinVector(vec, seq) for vec, seq in zip(vectors, sequences)]
# Module-level helpers operate on a collection of *Vector objects:
arr = embed_vec_to_numpy(vecs) # ndarray for ML
dm = embed_vec_to_distances(vecs, metric='euclidean') # DistanceMatrix
ord_results = embed_vec_to_ordination(vecs) # OrdinationResults (PCoA)
Important notes:
*Embedding (per-position matrix for a single sequence) from *Vector (one summary vector per sequence).to_distances/to_ordination/to_numpy/to_dataframe conversions are module-level functions (embed_vec_to_*) over a list of vectors, not methods on the embedding objects.DistanceMatrix, OrdinationResults) plug straight into scikit-bio's diversity/ordination/statistics ecosystem.uv pip install "scikit-bio>=0.7,<0.8" # examples here target the 0.7 API (current 0.7.4)
uv pip install numba # optional: enables engine="fast" / GPU paths
The 0.6→0.7 line renamed several interfaces (otu_ids→taxa, observed_otus→observed_features, robinson_foulds→compare_rfd) and replaced the old pairwise-alignment functions with pair_align*. Pin if you depend on these.
partial_beta_diversity()For detailed API information, parameter specifications, and advanced usage examples, refer to references/api_reference.md which contains comprehensive documentation on:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite./alterlab-accreditation-aolScaffolds program-level Assurance-of-Learning (AoL) documentation for AACSB (Standard 5 in the 2020 standards and the 2026 Global Standards) and ABET (Criterion 3 Student Outcomes, Criterion 4 Continuous Improvement) accreditation — program learning outcomes / competency goals, curriculum-to-outcome mapping matrices, direct- and indirect-assessment plans, rubric design, and closing-the-loop continuous-improvement narratives — and validates the structure of an outcome-mapping matrix with scripts/aol_matrix.py. Use when the user needs AACSB or ABET assurance-of-learning material, a program-learning-outcomes set, a curriculum/outcome map or coverage matrix, a direct/indirect assessment plan, a closing-the-loop report, or accreditation self-study text. For single-course design or course rubrics prefer alterlab-teaching-design; for post-award grant reports prefer alterlab-grant-reporting. Part of the AlterLab Academic Skills suite./alterlab-adaptyvPrepares and validates Adaptyv Bio Foundry protein-testing submissions with no account — optimizes and pre-screens sequences locally (NetSolP/SoluProt heuristics, SolubleMPNN, ESM), assembles the experiment payload, and validates it offline against the Foundry's own type/method/sequence rules so it is ready and correct before it costs anything. Submitting to the Foundry, browsing the target catalog, tracking status and retrieving results run through the Foundry API with the user's own ADAPTYV_API_KEY (experiments cost money and take weeks). Use when designing proteins for wet-lab validation (binding/affinity, expression, thermostability, fluorescence), preparing or validating a Foundry submission, pre-screening sequences, or tracking an Adaptyv experiment. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite./alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite./alterlab-ai-use-disclosureHelps faculty and researchers disclose generative-AI use and comply with the rules for manuscripts, grant proposals, peer review, theses and figures. Walks a venue → policy → placement decision tree over policies verified on 2026-09-23 (ICMJE, Springer Nature/Nature, Elsevier, Wiley, Taylor & Francis, Sage, IEEE, PLOS, arXiv; NIH NOT-OD-25-132 and NOT-OD-23-149, NSF, UKRI, ERC, TÜBİTAK; YÖK's 2024 ethics guide; EU AI Act Article 50), drafts English and Turkish statements, and ships scripts/disclosure_builder.py to emit a statement plus warnings where a policy forbids the use. Use when the request mentions an AI or ChatGPT disclosure or declaration, whether and where AI use must be declared, AI in peer review or grant review, AI-generated figures, AI rules for a thesis, or 'yapay zekâ kullanım beyanı'. For course AI policies and APA/MLA citations of ChatGPT prefer alterlab-syllabus-ai-policy; for writing the paper itself prefer alterlab-scientific-writing. Part of the AlterLab Academic Skills suite.Other plugins' skills for the same job