# Online Resource 2 — analysis code, derived data and numerical audit

What this package does and does not do. It holds the analysis code, the frozen
randomized-code ensemble, every derived per-species value, the frozen protocol
and an audit that recomputes 150 quantities asserted in the manuscript from the
deposited outputs. The scripts that regenerate those outputs from the
third-party source tables are included, but the source tables themselves are not
redistributed, so a full end-to-end rerun needs them from their original
sources; verifying what the manuscript asserts does not.

**Article:** The standard genetic code's rank among randomized alternatives is not a
property of the code

**Journal:** Journal of Molecular Evolution

**Authors:** Lucas Giovani Ribeiro, Marcos André Simonssini

**Affiliation:** Independent Researchers, Uruana de Minas, Minas Gerais, Brazil

**Corresponding author:** Lucas Giovani Ribeiro — coin26@mail.com

---

Analysis code, derived data, figures and the frozen analysis protocol.

## Contents

```
code/       analysis, figure generation, the deposited secondary analyses,
            a pipeline driver and three verification scripts
data/       derived per-species values, the randomized-code ensemble,
            the phylogeny, taxon-name mapping and exclusion lists
figures/    Fig1-Fig5 and FigS1-FigS2 in EPS, PDF and PNG
protocol/   the frozen analysis protocol and its internal dated changelog
```

## External data

`data/coral_counts.pkl` and `data/coral_abund.pkl` are substitution counts and
callable trinucleotide abundances **aggregated per species** from the CORAL
branch table, and are included so the numerical audit runs without external
downloads. The source table itself is third-party and is not redistributed:
obtain it from the study cited in the manuscript and point `CORAL_XLSX` at it to
run the analyses that need branch-level data.

## Data dictionary

`data/DATA_DICTIONARY.md` documents every deposited file and its columns, including the two species-key
columns whose distinction matters when joining.

## Requirements

```bash
pip install -r requirements.txt
```

`requirements.txt` pins the versions the deposited outputs were produced with.
The package is Python only, and contains no editorial tooling. The manuscript
sources, the JavaScript that typesets them and the builder that rebuilds Online
Resource 1 from `esm1.txt` are typesetting rather than analysis and are not
deposited; `build_all.sh` runs the Online Resource 1 stage only when that builder
is present, which it is in the authors' workspace and is not here. The chain the
editorial tools form is recorded in the header of `build_all.sh`.

## Building the submission files

`code/build_all.sh` runs the verification, numerical-audit and integrity stages
the deposited package contains. When the non-deposited editorial builder is
present — in the authors' workspace, not here — it first rebuilds Online Resource
1 from `esm1.txt`.txt`, then the numerical audit, then the hash manifest, then the
final audit. Each step
must exit zero or the script stops.

It does not typeset the manuscript. That needs the markdown sources and the
JavaScript builders, which are editorial rather than scientific and are not
deposited. The order matters there too — writing the .docx discards any
equation objects a previous run inserted — and the chain is recorded in the
header of `build_all.sh` for the record.

## Running

```bash
python3 code/run_analysis.py --list          # stages and what each needs
python3 code/run_analysis.py                 # what runs without the CORAL table
CORAL_XLSX=/path/to/media-1.xlsx python3 code/run_analysis.py    # everything
CORAL_XLSX=/path/to/media-1.xlsx python3 code/deposited_analyses.py
```

**What this package regenerates, and what it does not.** The driver validates
the pipeline against a published benchmark, checks the tree and dataset,
rebuilds the figures, and re-checks every quantity asserted in the manuscript
against the deposited outputs. It does not recompute the phylogenetic mixed
model, the parametric bootstrap, the cross-validation or the annealing search
from scratch: those take hours and require the third-party CORAL table. Their
products are deposited in `data/`, and the code that produced them is in
`code/`.

## Verification

```bash
python3 code/verify_package.py                        # no dependencies needed
CORAL_XLSX=/path/to/table python3 code/audit_numbers.py
```

`verify_package.py` confirms the file manifest, the SHA-256 of the frozen
ensemble and its structural invariants, the row counts of the five principal
derived tables, and the SHA-256 of every deposited file, using the Python
standard library alone.

`audit_numbers.py` recomputes the quantities asserted in the manuscript and
compares each to the value reported: 150 checks from this package, 162 with the
external table.

`final_audit.py` is a build-time check on the manuscript files themselves —
limits, section order, rendered output, cross-document consistency. It needs the
manuscript sources, which are the submission rather than part of this package,
so from here it runs only its package-integrity block and reports that the rest
was skipped. That is expected.
