--- name: bio-viromics description: Detect, QC, and classify viral contigs and endogenized viral elements (EVEs) with geNomad, CheckV, GVClass, vConTACT3, Phold, and ViroSync. Use when finding viruses in assemblies, detecting EVEs in eukaryotic genomes, grading viral genomes, or assigning giant-virus or phage taxonomy. disable-model-invocation: true --- # Bio Viromics Detect, quality-check, and classify viral contigs or endogenized viral elements (EVEs), then compare each viral genome against a literature-derived reference set. Shared pipeline rules: read `../omics-pipeline/SKILL.md` first. `SKILL_DIR` is the directory that holds this `SKILL.md`. ## Instructions Tool order, branch selection, versions, and tool guides ([gvclass-usage.md](docs/gvclass-usage.md), [vcontact3-usage.md](docs/vcontact3-usage.md), [virosync-usage.md](docs/virosync-usage.md)): [docs/README.md](docs/README.md). Pass an explicit thread count to every tool (`-t` / `--threads` / `--threads-per-worker`) matching allocated CPUs. Check stage databases first with `check_databases.py` (`--stage viromics-giant-virus`, `--stage viromics-phage`, or `--stage viromics-endogenized`). 1. Enter from `results/taxonomy/domain_routing.tsv`: - Free viral contigs/bins (`prokaryotic_virus`, `giant_virus`, or `provirus_excise_for_viromics` rows) enter the viral workflow below. - Eukaryotic genome assemblies targeted for **endogenized viral element (EVE / GEVE)** screening enter the `endogenized` branch (**ViroSync**) directly. - Mixed or conflicting rows (`review_flag` `true`) are inspected before classification. 2. Select the branch(es) matching the study (`giant_virus`, `phage`, `endogenized`, `other`, or a mix): - **`giant_virus`** (`Nucleocytoviricota`, `Mirusviricota`, `Preplasmiviricota`): **GVClass** v2.2.0 (resource bundle v2.1.0) plus core marker-gene phylogenies (`VeryFastTree` first, then `IQ-TREE 3`; [phylogenomics page](../omics-pipeline/references/phylogenomics.md)). **GVClass alone is sufficient; `vConTACT3` is not required.** - **`phage`** (prokaryotic viruses): **geNomad** (DB v1.9) -> **CheckV** (DB v1.5) -> **vConTACT3** (DB v232) for genus-to-order clustering, plus optional **Phold** for structure-informed annotation of phage hypotheticals. - **`endogenized`** (EVEs in eukaryotic genomes): **ViroSync** v1.3.1 (resource bundle v1.3.0; [virosync-usage.md](docs/virosync-usage.md)) for marker detection, host-boundary refinement, and repeat evidence; optionally run **GVClass** on accepted giant-virus EVE regions. - **`other`** (RNA viruses, ssDNA viruses, other eukaryotic viruses): **geNomad** + **CheckV** + group-specific markers, phylogenomics, and protein-family methods from the literature playbook. Never force phage-only clustering on these groups. 3. Search the literature for the inferred viral group (`polars-dovmed`) and write `analysis_playbook.md`: reference sets, diagnostic markers, comparative analyses, genome features, and outlier signals. 4. Call genes and annotate proteins when needed ([gene-calling page](../omics-pipeline/references/gene-calling.md), `bio-annotation`; note standalone `prodigal-gv` 2.11.0 when matching ViroSync). 5. Compare each query to the literature-supported reference set on the comparative axes (`marker_census.tsv`, `family_copy_number_comparison.tsv`, `conserved_neighborhoods.tsv`, `ncRNA_census.tsv` in one comparison directory). Report matches, absences, expansions, and probable artifacts. 6. Assemble the evidence bundle with the branch-scoped driver (`RUN_DIR` is `results/_/`): ```bash uv run --script "$SKILL_DIR/scripts/build_viromics_evidence.py" \ relative_genome_metrics.tsv --resources resources.json --hypotheses hypotheses.tsv \ --reflections reflections.tsv --comparative-dir comparison/ \ --out "$RUN_DIR/viromics/evidence" ``` Input contracts (tab-separated, exact column order; fixtures under `fixtures/`): - `relative_genome_metrics.tsv`: `genome role group genome_size gene_count literature_min literature_max literature_doi`; `role` is `query` or `reference`, and each query needs at least two same-group references. - Comparative tables (`--comparative-dir`): each carries the minimum columns of rule 3 in `omics-pipeline`. - `hypotheses.tsv`: `hypothesis_id hypothesis type status evidence revision_stage`; at least five unique IDs with at least one `technical` or `null` hypothesis. - `reflections.tsv`: `stage observed qc_status hypotheses_gained hypotheses_lost alternatives next_check literature_id`; starts with `initial`, includes `final`, and uses `passed`, `failed`, or `conditional`. - `resources.json`: schema `1.0` with required `"branches"` (`["giant_virus"]`, `["phage"]`, `["endogenized"]`, `["other"]`, or a mix). Only the declared branch's required tools and `_db` entries are enforced (`giant_virus` requires `gvclass` + `gvclass_db`; `endogenized` requires `virosync` + `virosync_db`; `phage` requires `genomad`, `checkv`, `vcontact3` + their `_db` entries; `other` requires `genomad`, `checkv` + their `_db` entries). By default, database paths are checked for non-empty presence without re-hashing multi-GB trees; pass `--verify-checksums` to recompute full file/directory SHA-256 checksums. The driver computes `genome_size_frontier.tsv` with `record_class` in `above_literature_max`, `within_known_range`, or `below_literature_min` (flagging likely fragments). 7. Write the interesting-findings table ordered by `record_class` (`above_literature_max`, `within_known_range`, `below_literature_min`), then `distance_from_median` descending, then `genome` ascending. ## Input Requirements - Databases for the selected branch(es) verified via `check_databases.py`. - `contigs.fasta` (or eukaryotic genomes for `endogenized` / ViroSync) and `results/taxonomy/domain_routing.tsv` when available. ## Output Driver outputs in `$RUN_DIR/viromics/evidence/`: - `marker_census.tsv`, `family_copy_number_comparison.tsv`, `conserved_neighborhoods.tsv`, `ncRNA_census.tsv` - `hypothesis_register.tsv`, `intermediate_reflections.tsv`, `genome_size_frontier.tsv` - `run_manifest.json`, validated against [schemas/evidence-bundle.schema.json](schemas/evidence-bundle.schema.json) Workflow outputs in `$RUN_DIR/viromics/` (agent-authored): `viral_contigs.fasta` / `virosync/` / `checkv_results/` / `viral_taxonomy.tsv`, `analysis_playbook.md`, `viromics_report.md`, and `logs/`. ## Quality Gates - [ ] Input FASTA is non-empty and branch databases pass `check_databases.py`. - [ ] Branch selection matches the inferred viral group (`GVClass` suffices for giant viruses; `ViroSync` handles EVEs; `vConTACT3` is used only for phages). - [ ] Tool versions and database releases are recorded in `resources.json` and `tasks/METHODS.md`. - [ ] Unmet CheckV/GVClass quality or contamination thresholds are reported as results. - [ ] Comparative tables use the same query/reference set and link to hypothesis revisions. ## Non-Goals - No host assignment beyond evidence produced by the run. - No completeness/contamination claims without CheckV, GVClass, or ViroSync evidence. - No lifecycle calls (lytic/lysogenic/chronic) from sequence alone. - No phage-only clustering (`vConTACT3`) forced onto giant viruses, EVEs, or RNA/ssDNA viruses.