bio-annotation
Functional annotation and taxonomy inference from sequence homology.
SKILL.mdskills/bio-annotation
GitHubBio Annotation
Functional annotation and taxonomy inference from sequence homology.
Shared pipeline rules: read ~/.agents/skills/omics-pipeline/SKILL.md first (in a plugin install, ../omics-pipeline/SKILL.md from this file).
Instructions
Read docs/README.md for the tool choice and its pitfalls before running anything.
Normalize tool outputs and generate the complete comparison bundle with the schema-backed driver.
RUN_DIRis the run directory thatbioinformatics-projectdefines (results/<date>_<name>/):uv run --script ~/.agents/skills/bio-annotation/scripts/build_annotation_artifacts.py \ raw_annotations.tsv --genomes genomes.tsv --markers marker_catalog.tsv \ --out "$RUN_DIR/annotation"raw_annotations.tsvis one row per protein and family hit with columnsgenome, protein_id, family_id, family_name, category, e_value, annotation, taxonomy, confidence, merged by you from the tool outputs below.genomes.tsvhasgenome, role (query|reference), domain, route, protein_count, whereprotein_countis the total number of proteins of the genome, with or without a hit (it setsunannotated_count, and the run fails when it is missing or lower than the proteins inraw_annotations.tsv);marker_catalog.tsvhascategory, family_id, family_name, expected, whereexpectedisyesorno.fixtures/holds a runnable example. The driver refuses a non-empty destination, rejects anyroleother thanqueryorreference, validates all inputs before it writes a file (a failed run leaves the destination empty, so you can rerun into it), enforces globally unique protein identifiers, writes normalized Parquet tables, adds explicit absent-marker rows (an absent marker withexpectedyesis noted innotes, and the final envelope lists each one inwarnings), and computes query-specific/missing/expanded/contracted families against the reference median. The artifact contract is inschemas/artifacts.schema.json.Take the domain route for each genome from the router's routing table before interpreting protein annotations. Domain-specific taxonomy follows the route: GTDB-Tk for Bacteria and Archaea (cross-check NCBI/DIAMOND lineages),
bio-viromicsfor viruses (PHROG/NCVOG markers and vConTACT3 only for phage and prokaryotic-virus contexts; GVClass and NCLDV marker phylogeny for giant viruses), EukCC for Eukaryota without CheckM or GTDB-Tk assumptions.For InterProScan, validate the exact CLI with
--helpor--version. InterProScan 5 and the Nextflow-based InterProScan 6 both have current releases (see docs/README.md). Pin one release and one InterPro data release per project.Run InterProScan for domain and family annotation.
Run eggNOG-mapper v2 for orthology-based annotation. v3.0.0 is in beta; use it only when the project pins it deliberately.
Run sequence-vs-database search and resolve taxonomy with TaxonKit v0.20.0+ (required for the March 2025 NCBI rank update that replaces "superkingdom" with "domain" and adds "realm" for viruses). Backend choice (DIAMOND, clustered nr, MMseqs2-GPU): see docs/README.md.
For group-appropriate marker families, run HMM searches against the relevant profile libraries (Pfam, TIGRFAM, COG/arCOG, PHROG/NCVOG for viruses, eukaryotic ribosomal and structural HMMs when applicable). Use
pyhmmer(Python bindings around HMMER 3.4 with native SIMD and batch-friendly APIs) by default; fall back to the HMMER CLI (hmmsearch/hmmscan) when an upstream tool requires it. The profile libraries come from the literature-derived playbook for the inferred group.Build an annotation-wide feature inventory by genome or contig and by gene family, domain and pathway.
Marker-gene census (the driver writes it from your hits): for each diagnostic marker or machinery category of the inferred group (for example replication, transcription, translation-related, packaging, capsid/structural, chromatin/SMC/topoisomerase, host-interaction), record presence and copy number for each query genome and each comparison genome as
marker_census.tsvwith columnsgenome, category, family_id, family_name, copy_number, evidence_source, e_value, notes, expected. Expected-but-absent markers are rows, not silent omissions.Per-family copy-number matrix: a Pfam/InterPro/HMM-family by genome integer matrix covering the query and the supplied relatives, persisted as
family_copy_number_matrix.parquet. Compute per-family fold change against the relative median, and flag query-specific, missing-expected, expanded and contracted families infamily_expansion_candidates.tsv.Mine the inventory for discovery candidates against the literature-derived playbook: missing expected features, rare or expanded families, unusual combinations, annotation/taxonomy conflicts, high-value unknowns.
query_specificrequires the family to be absent from every reference. When the reference median is 0 but at least one reference carries the family, the status ispresent_in_reference_minoritywith an emptyfold_change: report it as a signal, never as a discovery.Order
family_expansion_candidates.tsvdeterministically before reporting. Sort bystatusin the orderquery_specific,missing_expected,expanded,contracted,present_in_reference_minority; then byfold_changedescending, withinffirst and blank or non-numeric values last; then bygenomeandfamily_idascending. Report the top rows in that order and keep the full table.
Input Requirements
- Tools from the project's pinned pixi environment (
docs/README.md);BIO_DB_ROOTset to the database directory. proteins.faa(FASTA protein sequences) andreference_db/(eggNOG, InterPro, DIAMOND databases and taxdump).- For the driver:
raw_annotations.tsv,genomes.tsv(at least one query and one reference), andmarker_catalog.tsvwith the columns in step 2.
Output
The driver writes every file below except the agent-authored report and logs/, and also writes run_manifest.json. All files sit in the stage directory under the run directory that bioinformatics-project defines (results/<date>_<name>/<stage>/, stage annotation).
- annotations.parquet
- domain_routing.tsv (the driver's normalized copy of the genome routes, not the QuickClade table)
- taxonomy.parquet
- feature_inventory.parquet
- marker_census.tsv
- family_copy_number_matrix.parquet
- family_expansion_candidates.tsv
- annotation_report.md (agent-authored)
- logs/
- Artifact contract: schemas/artifacts.schema.json
Quality Gates
-
proteins.faais non-empty, amino acid encoded, and free of*stop symbols before InterProScan (or they are stripped deliberately). - InterProScan output options use
-bor-d, never both. Packaged installs are initialized withpython3 setup.py -f interproscan.propertieswhen required, and the helper binariesps_scan.pl,pfscanandpfsearchresolve. - A short smoke test on 1-2 proteins passes before a large cluster job (
hpc-slurmfor submission). - The reference databases exist under
BIO_DB_ROOT. - The normalized bundle is produced in a fresh directory, matches
schemas/artifacts.schema.json, and has globally unique protein identifiers. -
marker_census.tsvcovers every literature-derived marker category for the inferred group, with explicit zero rows for absent markers; each expected marker the envelope lists inwarningsappears in the report as a result. -
family_copy_number_matrix.parquetincludes the query and the supplied relatives, andfamily_expansion_candidates.tsvcarries fold change against the relative median. - Reported discovery candidates (step 12) carry gene or protein ID, annotation source, confidence, why notable, and recommended validation.
Non-Goals
- No causal or phenotype claims from homology alone. An annotation transfer is a hypothesis about function, not a demonstration of it.
- No taxonomy for nucleotide assemblies, MAGs, or contigs outside the QuickClade route and its domain-specific follow-up.
- No reference database downloads or builds. The databases under
$BIO_DB_ROOTare an input; report a missing database instead of fetching it. - No structure-based inference. High-value unknowns go to the structure page.