--- name: omics-pipeline description: Run omics pipeline stages from reads QC and mapping to assembly, binning, gene calling, phylogenomics and structure, and open the annotation, viromics and HGT stage skills. Use when a genome, metagenome or viral analysis needs a stage page, a driver or the shared pipeline rules. --- # Omics Pipeline This skill is the entry for omics pipeline work across both HPC/Slurm clusters and local workstations/laptops. It holds the shared rules, one decision page per stage that has no skill of its own, the portable database catalog reference, and the table of stage skills. ## Instructions ### Stage pages A stage page sits in `references/` and holds the tool choice, the traps, and the outputs of one stage. The agent runs the tools and writes the outputs. There is no driver. | Stage | Use when | Page | | --- | --- | --- | | Reference databases | Check `BIO_DB_ROOT` / `config/databases.toml` with `check_databases.py` | [databases.md](references/databases.md) | | Reads QC, profiling and mapping | Raw FASTQ, adapters, `sylph` profile, mapping and coverage | [reads-qc-mapping.md](references/reads-qc-mapping.md) | | Assembly | QC-passed reads to contigs, QUAST | [assembly.md](references/assembly.md) | | Binning | Bin contigs, score MAG completeness, contamination and chimerism | [binning.md](references/binning.md) | | Gene calling | CDS prediction, eukaryotic completeness, tRNA and rRNA census | [gene-calling.md](references/gene-calling.md) | | Phylogenomics | Marker alignments, `VeryFastTree` first then `IQ-TREE 3`, closest relatives | [phylogenomics.md](references/phylogenomics.md) | | Protein families | Homolog clustering (`MMseqs2`) and orthology (`Proteinortho`) | [protein-families.md](references/protein-families.md) | | Structure | ProstT5 3Di (`Phold`/`Baktfold`), Foldseek, TM-Vec, Boltz-2 | [structure.md](references/structure.md) | Tool notes that the pages link: [quickbin.md](references/quickbin.md), [autocycler.md](references/autocycler.md), [pyrodigal-gv.md](references/pyrodigal-gv.md), [infernal.md](references/infernal.md), [boltz.md](references/boltz.md), [tm-vec.md](references/tm-vec.md). For Nextflow or Prefect with Dask, read [workflow-engines.md](references/workflow-engines.md). ### Stage skills Stage skills are sibling directories of this skill's own directory: read `..//SKILL.md` relative to this file, which works in a plugin install and a checkout install alike. A driver always runs from its stage skill's own `scripts/` directory, as `uv run --script "$SKILL_DIR/scripts/"` (`SKILL_DIR` is that stage skill's directory). | Stage | Use when | Skill | | --- | --- | --- | | Domain routing (first gate) | Any assembly, MAG, SAG, genome, bin set or contig FASTA, before any domain-specific stage | `tracking-taxonomy-updates` | | Annotation | Function, domains, homology taxonomy, marker and family census | `bio-annotation` | | Viromics | Viral contigs, CheckV grades, giant-virus (`GVClass`), phage (`vConTACT3`/`Phold`), or endogenized virus (`ViroSync`) analysis | `bio-viromics` | | Interdomain HGT | Virus-host gene exchange, donor direction with tree-decided polarization | `bio-interdomain-hgt` | | Taxonomy release tracking | Compare NCBI, GTDB or ICTV releases, renamed taxa | `tracking-taxonomy-updates` | ### Shared rules Every stage skill and stage page points here. Each rule is stated once. 1. **Domain routing first.** Run **QuickClade** (BBTools `40.05` container, `percontig`, calibrated `>=3 kb` and `k3dif <= 0.055`, never filtering on QuickClade's `Confidence` column) through `tracking-taxonomy-updates`, paired with **Tiara** for eukaryotic contig screening and **geNomad** for viral/plasmid contigs, before choosing a domain-specific stage. Skip triage only when the user supplies a trusted domain label and asks to skip it. QuickClade routes; it is not the final authority. The shared routing table is `results/taxonomy/domain_routing.tsv`. Routes: - Bacteria and Archaea: GTDB-Tk (HPC) or QuickClade + marker trees (workstation/laptop). - Giant viruses (`Nucleocytoviricota`, `Mirusviricota`, `Preplasmiviricota`): `bio-viromics` with **GVClass** + marker-gene phylogeny (`vConTACT3` is not required). - Phage and prokaryotic viruses: `bio-viromics` with **vConTACT3** (+ optional **Phold**). - Endogenized viruses / EVEs in eukaryotic genomes: `bio-viromics` with **ViroSync**. - Eukaryota: Tiara/EukCC and eukaryote-aware gene calling (`BRAKER3`, `Tiberius`, or `MetaEuk`). - Mixed, short/distant (`quickclade_filter != pass`), or conflicting contigs: flag for manual review before running domain-specific tools. 2. **Large ONT reads.** Do not spend the first full read pass on `gzip -t` or raw `seqkit stats` unless asked. Record raw `stat` metadata (path, size, mtime), optionally check a small sample, make the first full pass the filtering step, then run `seqkit stats` on every produced read set. Check file type by content, not suffix: when `gzip -t` fails on a `.gz` name, inspect the magic bytes before calling the file corrupt, because it may be plain FASTQ. Write long-running outputs to `.tmp`, check them, then `mv`; reuse an output only when it is non-empty and its stage `.done` marker exists. 3. **Hypotheses and comparative axes.** Before the first analysis step, register at least five distinct hypotheses covering biological explanations plus technical/artifact and null explanations (see `bio-logic`; explain why if fewer are plausible). After each major result or QC gate, write a short reflection: what was seen, whether QC passed, which hypotheses gained or lost support, which alternatives remain, and the next discriminating check. Revise the register as evidence comes in; never drop a hypothesis silently. When close relatives or a reference set exist, compare the query on the relevant axes (or note why an axis was skipped) and persist one table per axis: - genome-property frontier (`relative_genome_metrics.tsv`, `genome_size_frontier.tsv`) - marker-gene census (`marker_census.tsv`) - per-family copy number (`family_copy_number_comparison.tsv`) - conserved neighborhoods (`conserved_neighborhoods.tsv`) - ncRNA census (`ncRNA_census.tsv`) Required columns of the comparative tables (extra columns are allowed, and the `bio-viromics` driver checks these minimum columns): - `relative_genome_metrics.tsv`: `genome`, `role` (`query` or `reference`), `group`, `genome_size`, `gene_count`, `literature_min`, `literature_max`, `literature_doi`, in this order. - `marker_census.tsv`: `genome`, `category`, `family_id`, `copy_number`. The `bio-annotation` driver adds `family_name`, `evidence_source`, `e_value` and `notes`. - `family_copy_number_comparison.tsv`: `family_id`, `query_copy_number`, `relative_median`, `status`. - `conserved_neighborhoods.tsv`: `query_block_id`, `relative`, `members`. - `ncRNA_census.tsv`: `assembly`, `class`, `model`, `count`. An expected marker or RNA class that is absent is a result, never silence. 4. **Failures and drivers.** On execution failure, keep the logs and report the failed command. Retry only after diagnosing the cause and recording the changed parameters. Thresholds are project choices: record each one. Report an unmet biological threshold as a result; never tune parameters only to pass a gate. The three stage drivers (`bio-annotation`, `bio-viromics`, `bio-interdomain-hgt`) print one JSON envelope as the last line of stdout: `{"ok": true, "skill", "out", "manifest", "warnings"}`, or `{"ok": false, "skill", "error": {"code", "message"}}` with exit code 2. 5. **Environment and databases.** Use the project's pinned pixi environment from `bioinformatics-project`; tool and database version policy follows `stop-overengineering`. Python helper scripts run through `uv run --script`, never system Python or conda. A version in a stage skill or page is the one its commands were checked against, not an install pin. Check stage databases with `check_databases.py` ([databases.md](references/databases.md)) and record tool, version, thread count, and database release in `tasks/METHODS.md`. 6. **Compute profile and scheduler.** Load `hpc-slurm` before any cluster/batch work (stage skills hold no account, QOS, or cluster flags; login-node limits follow `hpc-slurm`). On local workstations or laptops, cap threads and memory (`-Xmx`, `--split-memory-limit`, `-mem`) below host limits and prefer the workstation options on each stage page. Pass an explicit thread count to every tool. 7. **Figures.** Figures follow `beautiful-data-viz`. 8. **Discovery.** For a genome, MAG, viral genome or protein set: - Infer the group first. Search the literature for how that group is analyzed, and take methods and comparison sets from it. - Compare like with like: run the query and its references through the same tools, databases, and thresholds. - Say why each analysis fits, and name the plausible ones you skipped. - End with an interesting-findings table (`candidate`, `evidence`, `confidence`, `comparison baseline`, `literature context`, `follow-up test`). - Separate query-specific findings from features common to the comparison set, and state negative findings. - The final report lists the hypotheses considered, the reflections, the literature context, the revised ranking, the findings table, and the next analyses that best separate remaining alternatives. 9. **Literature and reporting.** - Search with `polars-dovmed` after the first hypothesis register and after any unexpected, central, or final finding. Use one corpus and one focal anchor per discovery query, never `--corpus both`. Use `fallback_search.py` when the hosted API is unreachable. - Record the corpus, query string, and hit count. If a search fails, report the failure and its cause; do not drop the step silently. - Summarize script or API JSON in Markdown; write large payloads to disk and report the path. - Re-run a lookup or driver instead of trusting tool output from earlier in a long conversation. - When a script returns `ok: false`, state the error code and message before proposing a fix. ## Input Requirements - A project made with `bioinformatics-project`, with a locked pixi environment. - `BIO_DB_ROOT` configured (environment variable or `config/databases.toml`) and checked via `check_databases.py`. - The inputs of the stage you run; each stage page and stage skill lists them. ## Output - No files of its own. Stage outputs sit under the run directory that `bioinformatics-project` defines (`results/_//`), as each stage page and stage skill names them. - `results/taxonomy/domain_routing.tsv` is the shared routing table (agent-authored path, written by `tracking-taxonomy-updates`). ## Quality Gates - [ ] The routing table exists for every nucleotide input before a domain-specific stage runs, or the skipped screen has a recorded reason. - [ ] Hypotheses (including technical and null explanations) are registered before analysis, and one reflection exists per QC gate. - [ ] The environment lock file is committed, databases are verified via `check_databases.py`, and each tool has an explicit thread count. - [ ] Each relevant comparative axis has a persisted table, or a written reason for skipping it. - [ ] Each literature search has its corpus, query string, and hit count recorded. - [ ] The final report has the contents rule 8 lists.