Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
695e874
docs(adr-0006): A4 — criterion (b) localizes from the de-novo compara…
bioedcam Aug 7, 2026
eb0cd44
feat(mining): the ADR-0006 D3 criterion-(b) relaxed-architecture backend
bioedcam Aug 7, 2026
18307fe
fix(slurm): CodeRabbit r1 — clear stale promotions, serialise the (b)…
bioedcam Aug 7, 2026
feba710
docs(slurm): CodeRabbit app r1 — the documented (b) submit line was u…
bioedcam Aug 7, 2026
2745d78
fix(mining): CodeRabbit CLI r2 — the P3 round never received the (b) …
bioedcam Aug 7, 2026
cf1cfc7
fix(mining): CodeRabbit CLI r2 — five more, including an inverted wob…
bioedcam Aug 7, 2026
34cf2da
fix(mining): CodeRabbit CLI r2 — the remaining nine findings
bioedcam Aug 7, 2026
0f39ced
fix(mining): CodeRabbit CLI r3 — a supply clause that could not fail
bioedcam Aug 8, 2026
d9403e9
fix(mining): CodeRabbit CLI r4 — four minors, and two of my own tests…
bioedcam Aug 8, 2026
82be336
fix(mining): GitHub-app review — an empty shard merged invisibly
bioedcam Aug 8, 2026
e830c19
fix(mining): CodeRabbit CLI r5 — two minors, both "the shape is an in…
bioedcam Aug 8, 2026
238dec3
docs(dev-log): P3-15′-d review addendum — six rounds, 27 findings
bioedcam Aug 8, 2026
78a6172
fix(mining): CodeRabbit CLI r6 — and a CORRECTION to r5's premise
bioedcam Aug 8, 2026
801d152
fix(mining): CodeRabbit CLI r7 — a partial merge could pass corpus-wide
bioedcam Aug 8, 2026
cfcc858
fix(mining): CodeRabbit CLI r8 — five, incl. two readers that could d…
bioedcam Aug 8, 2026
1696ef8
fix(mining): CodeRabbit CLI r9 — a bulge shorter than the motif read …
bioedcam Aug 8, 2026
d7e86ec
fix(mining): CodeRabbit CLI r10 — the last unguarded outcome-deciding…
bioedcam Aug 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions analyses/phase3_log.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4623,3 +4623,66 @@ no-op (`tuple(t) is t`).
two identical things"* — one of two sibling file reads, one of two path checks, one of two
`None` guards. **When a fix lands, grep for the other call site before declaring the class
closed.**

## Step P3-15′-d — 2026-08-07: the relaxed-architecture (b) backend

**Inputs.** `data/interim/homolog_msa/certified_positive.sto` (the real job-766 `mlocarna`
consensus: 24 rows, 289 columns, three `#=GC SS_cons` blocks) · `data/processed/master_clean_v0.parquet`
(curated `Structure` / `antiterm_*` / `discriminator`) · `data/processed/splits/split_assignments.parquet`
(the ADR-0004 held-out carve) · `mining/{spare_rule,mine_round,remine,synteny_producer,covariation_producer,msa_shuffle}.py`.

**Process.** `mining/architecture.py` implements ADR-0006 **D3**'s `criterion_b` verbatim and
localizes its two inputs from the **A3/A4 de-novo comparative consensus** — Stockholm parse
(delegated to the existing `msa_shuffle.read_pfam_alignment`, not forked), WUSS/dot-bracket pair
table, maximal-helix and flanked-bulge decomposition, and an NCCA-pairing test.
`mining/architecture_producer.py` adds the per-candidate `run-shard`/`merge` status table, the D3
`freeze`, and `derive_relaxed_arch_supply_available`. `mine_round.RELAXED_ARCH_SUPPLY_AVAILABLE`
plus a `--relaxed-arch-status` table, the `remine` two-way `--relaxed-arch-available` /
`--no-…` pair and its exit-4 unevidenced preflight complete the wiring.
`slurm/p2/mine_round_producer.sbatch` now **promotes each `msa.sto` out of `$BUILD/work`** before
the EXIT trap destroys it; `slurm/p3/architecture_producer.sbatch` runs the (b) leg CPU-only.

**Outputs.** `reports/p3/architecture_freeze.json` — the D3 measurement on the **8,715**
held-out canonical records (`source=='corpus' ∧ nested_role=='heldout'`, joined by
`ingest.record_hash`, **not** positionally): the flanked unpaired run containing the curated
discriminator is **7 nt in 7,983 of 8,605 (92.8 %)** — the literature's 7-nt antiterminator bulge,
recovered independently from structure — and the derived `UGGN` acceptor motif is present in
**99.87 %** at 4 nt of pairing (99.93 % at 3 nt). ⚠ **It pins nothing**; every rule parameter
ships keyword-required-with-no-default and the round supplies it.

**Validation.** unit+golden **5,032 passed**; failure set identical to a matched `main` baseline
apart from three parquet-only tests the local env cannot run (CI installs `pyarrow==24.0.0`;
their logic was executed directly in `tbox-finder-data` and all three hold). **19 sabotages /
19 RED against their NAMED test.** ruff 0.15.15 + black 25.11.0 clean; `snakemake --lint` OK.

**Decisions.** Two that were mine to make and are disclosed rather than absorbed.
(1) **D3's two relaxations are not symmetric.** Read as a plain requirement-drop they fire
*together* on every translational locus, making `criterion_b` unconditionally `True` across the
class-II corpus — and by **D9 row 5** that makes **Tier-2N unreachable**, the flagship class
defined out of existence by its own predicate. `criterion_b` keeps the ADR's literal text (so the
P6 freeze tests D3, not my fix); the three-valued localizer resolves *"required only where
detectable"* by distinguishing `absent` (detectable, not there — a real failure) from
`undetectable` (nothing to judge — the only state the relaxation excuses), and
`architecture_status` refuses `passed` when both relaxations are active with neither element
observed, routing to `unavailable` ⇒ spared.
(2) **The NCCA motif is derived, not transcribed** (§10.3): `acceptor_pairing_motif` computes it
from the tRNA 3′ terminus `N73-C74-C75-A76` and antiparallel Watson–Crick pairing, yielding
`UGGN`. Four agreeing peer-reviewed sources back the underlying fact [PMID:12547201;
DOI:10.1016/j.bbagrm.2008.09.001; PMID:15879350; DOI:10.1016/j.bpj.2009.12.2831], and the repo's
own curated corpus agrees: the TBDB `discriminator` is 4 nt in all 23,208 records carrying one and
matches `UGGN` in **99.79 %**. Cross-links ADR-0006 **A4**.

**⚠ THE DEFECT THE FIXTURE CAUGHT THAT NO UNIT TEST WOULD HAVE.** The first bulge finder sized
runs in **alignment columns**. On the real certified consensus that returned **zero bulges** —
because a 16-column run is only **8 residues** in the candidate's own row and a 37-column run is
11. Sizing moved to the degapped residues of the candidate's own sequence. A hand-built fixture
with no gaps would have passed either way; smoke-testing on the real artifact is what exposed it.

**⚠ THIS DOES NOT MOVE `n_mined` OFF 0, AND SAYS SO.** Per A4, (b) reads the *same* consensus (a)
does, so its supply derivation **delegates** to `derive_msa_supply_available` rather than probing
twice. Until the full-corpus (a)/(b) producer array has run, every `msa.sto` is absent and the
producer reports `unavailable` ⇒ **spared** — fail-closed and honest. `relaxed_architecture` also
remains absent from `TIER2N_PROTECTIVE_DISJUNCTS` (D9 row 5), so a (b)-only round is still
refused at readiness; a test pins that building the backend did not change it.

**Commit.** see PR.
28 changes: 28 additions & 0 deletions docs/decisions/ADR-0006-validation-decision-rule-and-tiering.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,31 @@ gate3_rollup(per_corpus_verdicts: dict[str, verdict], breadth_floor_met: bool,
**Cross-reference impact.** ADR-0002 **A13** (the env providing mlocarna) · **D7** (instantiation recorded; open "e.g." class, thresholds P6-frozen) · **A2** (this supply flips `msa_supply_available` TRUE, unblocking the round-readiness gate) · ADR-0005 **A9/D14** (the (a)-backend the N=4 RUN's readiness gate waits on) · **A1** (the target DB searched).

- **Amendment A3 sign-off:** ☑ recorded 2026-07-27 (bioedca), CLAUDE.md §7 item 2 — D7's CM-free de-novo aligner instantiated by LocARNA/mlocarna comparative consensus (job-748 cmbuild-from-one root cause); no D7/A1/A2 threshold changed.

---

## Amendment A4 — D3's criterion-(b) element localization is instantiated by the D7/A3 de-novo comparative consensus, superseding the unreachable R2DT / class-I-templated `cmalign` route (P3-15′-d, 2026-08-07)

- **Status:** **Accepted (user sign-off 2026-08-07; CLAUDE.md §7 item 2, bioedca).** Records which instrument supplies **D3**'s `named_elements_present` / `ncca_bulge_detected` inputs. **No D3 predicate logic, no D6/D7/D8 P6-frozen value, and no D9 routing row is amended.** Requires **no** ADR-0002 amendment: `envs/locarna.yml` (`locarna` 2.0.1, ADR-0002 A13) and `envs/rscape.yml` (A11) are already pinned and locked.

**What D3 names, and why it cannot be honoured literally.** D3's parenthetical is *"(R2DT 2.0 / `cmalign` on the host cross-check; §13.2)"* — two named instruments. Both fail, for different reasons:

1. **R2DT is unreachable under ADR-0002's regime.** Measured 2026-08-07: `api.anaconda.org` returns *"could not be found"* for `bioconda/r2dt`, `conda-forge/r2dt` **and** `bioconda/traveler` (its renderer), while `bioconda/infernal` resolves on the same call — so the probe is powered, not silently broken. ADR-0002 D1 records **no container runtime on the cluster** (no apptainer/singularity/docker/podman). R2DT 2.0 itself lists *"Facilitating R2DT installation via conda"* as **future** work [PMID:39921562].
2. **R2DT would supply no independent structure even if installable.** Its Rfam path *is* the `cmalign` path: *"For sequences matching templates, the 2D structure is predicted using the Infernal `cmalign` program by aligning the input sequences to the template covariance models"* [PMID:39921562]; *"R2DT uses the Rfam covariance models built from the Rfam seed alignments"* [PMID:34108470]. Traveler adds standardised **layout**, not a CM-free structure source; R2DT ships an Rfam-derived T-box template at `data/rfam/RF00230/`; its "template-free" mode **takes a dot-bracket the caller supplies**. On a locus with no template hit it *"will not attempt to draw a structure"* [PMID:34108470] — the same blindness as `cmalign`, not a remedy for it.
3. **The `cmalign`-vs-RF00230 route is blind precisely at the flagship class, and needs a second valueless delegation.** RF00230 (Rfam 15.1, `num_seed` 48) is described in terms of **transcription** antitermination; the class-II corpus required a **custom** covariance model, not RF00230 [PMID:32882008], and ultrashort-Stem-I variants *"lack the key motifs present in the canonical transcriptional T-box systems"* [DOI:10.1002/iub.2098; PMID:25583497]. Localizing (b)'s elements by `cmalign` further requires knowing whether a candidate clears **D8**'s RF00230 alignability cutoff — which **D17** freezes at P6 with **no value** — so the route needs D6 *and* D8, not D6 alone. PRD §18.2 already names *"orthogonal validation re-imposes the CM frame"* as a project risk whose pinned mitigation is the de-novo route. ⚠ **No source quantifies an RF00230 recall/bit-score deficit on class-II or ultrashort loci; no such number is asserted here (§10.3).**

**Pinned instantiation.** D3's element inputs are localized from the **A3 per-candidate `mlocarna` `#=GC SS_cons` comparative consensus** of the candidate's own homolog set — the same artifact that already supplies (a) — together with the candidate's own primary sequence. Hard constraints: **never** RF00230, **never** an Rfam/class-I template, **never** the Stage-1/Stage-2 model's own output. The operational predicate remains exactly as D3 already requires — **frozen on the held-out canonical set and unit-tested**. This amendment pins the **instrument and its anti-circularity constraints only, not an algorithm**; no localization rule is fabricated here (§10.3).

**D6's threshold is supplied, not frozen.** `ultrashort_relax`'s short-Stem-I nt threshold ships **keyword-required with no default**, supplied per round and recorded in provenance — the discipline already used by `--strand-policy` (P3-15′-b), `substrate_prescan.scan_shard`'s `score_threshold` (ADR-0005 A8), and criterion (c)'s three required parameters (P3-15′-c-ii). This **does not consume D17's P6 delegation**; the P6 freeze stands unchanged. The relaxation only ever makes (b) *more* likely to pass ⇒ more sparing ⇒ the fail-closed direction, so an imperfect value errs safe.

**⚠ Disclosed cost — (a) and (b) cease to be independent disjuncts.** (b) now reads the same MSA (a) does, so it is computable only where that MSA is buildable (A2's `min_sequences = 20` floor). Where the MSA is unavailable, (b) is `unavailable` and **spares** (fail-closed). ADR-0005 D14 describes its three model-independent disjuncts as independent; **two of them now share a supply**, and any report resting on their conjunction must say so. This is a real weakening of the rule's redundancy, disclosed rather than absorbed.

**⚠ Measured context for what (b) can still change.** At sign-off the mining ceiling is already bounded **without** (b): criterion (c) is `failed` on **96 of 941** candidates (`546 passed / 96 failed / 299 unavailable`, reproduced from the committed config), and intersecting that with the 941-candidate Stage-2 posteriors leaves **69–80 candidates** (7.3–8.5 %) failing both across every Stage-2 threshold in [0.5, 0.99]. Because mining is a conjunction, **(b) can only lower that number, never raise it**, and by D9 row 5 it contributes **zero** Tier-2N protection (`TIER2N_PROTECTIVE_DISJUNCTS` excludes it, frozen with no override). (b) is built so the conjunction can complete and so canonical-architecture candidates that (a) and (c) both missed retain a model-independent guard — not to increase yield.

**Not amended.** D3's base predicate and its two relaxations; D3's prohibition on keying (b) to a `cmalign`-vs-RF00230 bit-score (**strengthened** — no `cmalign` is on (b)'s path at all); D6/D7/D8's P6-frozen values and D17's delegation map; D9's routing, including row 5's `(c)✓ ∧ (a)✓ ∧ (b)✗` Tier-2N definition; D5/D8's **specifier**-localization path (unchanged, including its `cmalign`/R2DT wording — this amendment governs criterion (b) only); A1's target DB; A2's operator and `min_sequences = 20` floor; A3's aligner. **R2DT as a §17 publication-figure deliverable is untouched and separable from the predicate.**

**§10.1 evidence** (accessed 2026-08-07; article metadata + full text via PubMed/PMC, Rfam 15.1 API, r2dt-bio/R2DT README). R2DT internals + distribution: PMID:34108470 [DOI:10.1038/s41467-021-23555-5] · PMID:39921562 [DOI:10.1093/nar/gkaf032]. RF00230's class-I scope / class-II custom CM: PMID:32882008 [DOI:10.1093/nar/gkaa721] · Rfam RF00230 rel. 15.1. Ultrashort / non-canonical Stem I: PMID:25583497 [DOI:10.1073/pnas.1424175112] · [DOI:10.1002/iub.2098] · PMID:29581302 [DOI:10.1073/pnas.1721254115].

**Cross-reference impact.** **D3** (instrument pinned) · **A3** (its `#=GC SS_cons` becomes load-bearing for (b) as well as (a), and must be **promoted out of the `$BUILD/work` node-local scratch where `slurm/p2/mine_round_producer.sbatch` currently destroys it**) · **D6/D17** (threshold supplied per round, P6 freeze untouched) · **D8** (its alignability cutoff is no longer on (b)'s path) · **D9 row 5** (unchanged) · ADR-0005 **D14** (its "three independent model-independent disjuncts" framing now carries the shared-supply caveat above) · ADR-0005 **A10** (the (a) producer's pinned envelope now also sizes (b)'s supply) · **ADR-0002** (no amendment required; A11/A13 envs suffice) · **PRD §5, §6, §13.2, §13.3(b)** (prose updated in the same step to name the de-novo consensus as (b)'s instrument).

- **Amendment A4 sign-off:** ☑ recorded 2026-08-07 (bioedca), CLAUDE.md §7 item 2 — D3's criterion-(b) element localization instantiated by the A3 de-novo comparative consensus (R2DT measured unreachable *and* CM-derived; RF00230 class-I-scoped; D8's cutoff valueless); D6's threshold supplied keyword-required-no-default, P6 freeze untouched; (a)/(b) supply-dependence disclosed. No D3/D6/D7/D8/D9/A1/A2/A3 value changed.
206 changes: 206 additions & 0 deletions reports/p3/architecture_freeze.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
{
"acceptor_motif": "UGGN",
"adr": "ADR-0006 D3/D6 (criterion (b)), A3/A4 (the de-novo consensus instrument); ADR-0005 D14",
"bulge_size_nt": {
"counts": {
"10": 1,
"11": 1,
"113": 1,
"119": 2,
"120": 1,
"125": 1,
"13": 2,
"133": 1,
"134": 1,
"136": 1,
"137": 1,
"138": 3,
"139": 1,
"14": 6,
"140": 2,
"141": 1,
"143": 10,
"144": 5,
"149": 2,
"15": 6,
"151": 1,
"155": 1,
"16": 8,
"17": 4,
"171": 1,
"172": 1,
"173": 1,
"174": 1,
"176": 1,
"18": 23,
"19": 7,
"20": 3,
"21": 1,
"22": 1,
"245": 1,
"25": 1,
"26": 1,
"27": 2,
"28": 1,
"29": 7,
"30": 4,
"31": 11,
"32": 2,
"33": 36,
"34": 26,
"35": 14,
"36": 33,
"37": 14,
"38": 8,
"39": 11,
"4": 15,
"40": 8,
"41": 15,
"42": 13,
"43": 7,
"44": 16,
"45": 10,
"46": 10,
"47": 4,
"48": 14,
"49": 5,
"5": 38,
"50": 5,
"51": 4,
"52": 3,
"53": 1,
"54": 4,
"55": 5,
"56": 10,
"57": 1,
"58": 3,
"59": 2,
"6": 71,
"60": 2,
"61": 2,
"62": 3,
"63": 1,
"64": 1,
"65": 1,
"68": 1,
"7": 7983,
"71": 2,
"73": 1,
"78": 1,
"79": 1,
"8": 38,
"83": 3,
"84": 1,
"86": 1,
"9": 21,
"90": 1,
"92": 1,
"96": 1
},
"modal_size": 7,
"note": "length of the flanked unpaired run CONTAINING the curated discriminator, in the record's own residues"
},
"carve": {
"definition": "source == 'corpus' AND nested_role == 'heldout'",
"join": "ingest.record_hash(master_clean row) == split.corpus_record_sha256",
"n_records": 8715,
"n_structure_parseable": 8715,
"n_unparseable": 0,
"n_with_discriminator_in_a_flanked_bulge": 8605
},
"disclosure": "measured on CURATED structure, which is CM-derived: this is the localizer's sensitivity on known architecture, NOT the rate at which a de-novo consensus resolves one. The second number needs the full-corpus (a)/(b) supply run and is not claimed here.",
"n_helices": {
"min_helix_pairs=1": {
"1": 2,
"10": 6142,
"11": 540,
"12": 16,
"2": 15,
"3": 45,
"4": 10,
"5": 20,
"6": 73,
"7": 71,
"8": 658,
"9": 1123
},
"min_helix_pairs=2": {
"1": 8,
"10": 6008,
"11": 427,
"12": 4,
"2": 11,
"3": 46,
"4": 7,
"5": 25,
"6": 77,
"7": 71,
"8": 783,
"9": 1248
},
"min_helix_pairs=3": {
"1": 8,
"10": 120,
"2": 11,
"3": 49,
"4": 16,
"5": 95,
"6": 90,
"7": 817,
"8": 1357,
"9": 6152
}
},
"ncca_recovery": {
"1": {
"n": 8605,
"share": 1.0
},
"2": {
"n": 8605,
"share": 1.0
},
"3": {
"n": 8599,
"share": 0.999303
},
"4": {
"n": 8594,
"share": 0.998722
}
},
"pins_nothing": true,
"provenance": {
"adr": "ADR-0006 D3/D6 (criterion (b)), A3/A4 (the de-novo consensus instrument); ADR-0005 D14",
"env_lock_hash": null,
"extra": {
"external_inputs": [
{
"name": "master_clean_v0.parquet",
"sha256": "1eb76591d0e481019dd7acf72a439f157fec9f2aeecb8cc5c37ba80a7b062dd2"
},
{
"name": "split_assignments.parquet",
"sha256": "d51252ee8b2211603d672f0da2963b3364fe1acc48c542269da6eb63f0c6ebc3"
}
],
"pins_nothing": true
},
"generated_at_utc": "2026-08-07T21:42:17.227990+00:00",
"git_sha": "695e874ee3c068924fcb9078ebc5d758270f8ab7",
"inputs": {},
"outputs": {},
"rule": "architecture_producer::freeze",
"schema_version": "1.0",
"script": "src/tbox_finder/mining/architecture_producer.py",
"seed": 42
},
"schema_version": "1.0",
"stem_i_extent_nt": {
"max": 154,
"min": 3,
"n": 8578,
"note": "D6's threshold is supplied per round (ADR-0006 A4); NO value is frozen here"
},
"step": "P3-15'-d"
}
19 changes: 19 additions & 0 deletions slurm/p2/mine_round_producer.sbatch
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,25 @@ mlocarna --version 2>&1 | grep -q "LocARNA 2.0.1" || { echo "FATAL: mlocarna !=
PYTHONHASHSEED=0 PYTHONPATH=src python -m tbox_finder.mining.covariation_producer align-shard \
--shard "$SHARD" --workroot "$BUILD/work" --cpu 2

# ── PROMOTE the per-candidate #=GC SS_cons consensus OUT of node-local scratch ────────────────────
# ADR-0006 A4 makes this artifact load-bearing for criterion (b) as well as (a): (b)'s
# named_elements_present / ncca_bulge_detected are localized from THIS file. Until P3-15'-d it was
# written under $BUILD/work and destroyed by the EXIT trap below, so the only CM-free structure the
# repo produces did not survive the job that produced it. Copy runs BEFORE stage 3 so a scoring
# failure cannot take the consensus down with it. Per-candidate subdirectory names are the (a)
# producer's own slugs, which is exactly what architecture_producer.candidate_msa_path() rebuilds.
MSA_OUT="$ROUND_DIR/msa"
mkdir -p "$MSA_OUT"
n_promoted=0
for d in "$BUILD"/work/*/; do
[ -s "$d/msa.sto" ] || continue # not producible (< min_sequences, align failed)
slug=$(basename "$d")
mkdir -p "$MSA_OUT/$slug"
cp -p "$d/msa.sto" "$MSA_OUT/$slug/msa.sto"
n_promoted=$((n_promoted + 1))
done
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
echo "promoted $n_promoted per-candidate msa.sto → $MSA_OUT"

# ── STAGE 3: SCORE (tbox-rscape) → the shard status table ────────────────────────────────────────
conda activate tbox-rscape
command -v R-scape >/dev/null || { echo "FATAL: R-scape not on PATH — tbox-rscape not created?" >&2; exit 2; }
Expand Down
Loading
Loading