Software correction and computational validation report
SpikeForge 1.1.0rc2
Can a BAM-control generator produce structurally valid, quantitatively accurate and auditable mutation controls—and refuse experiments that cannot be represented honestly?
1
Executive summary
The original SpikeForge implementation contained structural, allele-accounting, molecule-selection and verification defects that made its output unsuitable as validation evidence. The corrected implementation was evaluated with legacy-versus-corrected BAM comparisons, a six-variant VAF ladder, record-level reconciliation, independent BAM parsing and indexed fetch, and release acceptance tests.
All 34 inspected legacy BAMs failed at the first declared BGZF block boundary. All 20 corrected BAMs passed a boundary walk across 284,860 declared blocks, and all 20 associated BAI files passed structural traversal. Across 114 matched successful variant comparisons, mean absolute requested-VAF error decreased from 0.000915 to 0.000663, a descriptive reduction of 27.6%. The corrected implementation also refused to publish controls when the requested dose could not be physically represented.
The evidence supports the corrected variant workflow as a research pipeline-control tool. It does not establish clinical performance. The BAM-level fusion challenge was structurally functional but failed its realism audit and is not accepted as a blind-realistic control.
2
Study question and hypotheses
Primary question
Can corrected SpikeForge generate structurally valid, correctly dosed and fully auditable BAM controls while refusing infeasible experiments instead of issuing misleading PASS results?
Working hypotheses
- Structural validity: corrected BAM and BAI files will pass structural checks that legacy outputs fail.
- Dose accuracy: corrected outputs will have lower absolute requested-versus-achieved VAF error on matched successful events.
- Auditability: every output difference will be attributable to an authorized edit or declared synthetic record, with no unexpected additions or removals.
- Fail-closed behavior: infeasible controls will be withheld before publication rather than represented as successful.
- Fusion realism: planted BAM-level fusion records will be sufficiently similar to nearby real alignments for blind validation use.
These hypotheses summarize the post-audit validation objectives; the study was not preregistered. Hypothesis 5 was not supported.
3
Methods
Study design
A frozen copy of the legacy implementation was compared with the corrected working implementation. Real-data comparisons used fixed inputs, a fixed six-event hg19 ladder and random seed 2026. Structural validation, allele-dose measurement, feasibility behavior, exported-artifact reconciliation and software acceptance were evaluated separately.
| Analysis set | Size | Purpose |
|---|---|---|
| Locked historical cohort | 12 post-dedup hg19 BAMs | Strict legacy-versus-corrected comparison |
| Stress cohort | 21 inputs; 20 biological libraries after excluding an undetermined lane | Feasibility under difficult depth and allele conditions |
| Matched successful subset | 19 libraries; 114 event comparisons | Paired requested-VAF error analysis |
| Variant ladder | 6 hg19 events; requested VAF 0.5%–25% | SNV and deletion dose targeting |
| Fusion challenge | 1 orientation-explicit event | Structural function, record reconciliation and realism |
| Release fixtures | Synthetic 3,270-record output and official HTSlib range.bam | Exact-count, parsing, indexing and HTTPS-input acceptance |
Experimental procedure
- Audit legacy BAM framing, reference validation, allele accounting, molecule identity, tag maintenance, verification, publication transactions and truth artifacts.
- Apply corrections while keeping the legacy source frozen for comparison.
- Run the fixed VAF ladder on the historical and stress cohorts. Measure baseline and achieved ALT support directly.
- Walk declared BGZF boundaries and BAI structures independently of the writer.
- Reconcile input and output BAM records against exported ledgers and raw-record SHA-256 digests.
- Run exact-count and remote-input acceptance tests, including independent Bamnostic parsing and indexed fetch.
- Publish output only after the private candidate passes the verifier and allele-count gate.
Primary and secondary endpoints
| Endpoint | Measure | Interpretation |
|---|---|---|
| BAM structural validity | Declared BGZF boundaries traversed without error | File framing is internally consistent |
| BAI structural validity | Independent index traversal and interval fetch | Generated index can address the edited region |
| Dose accuracy | Absolute achieved VAF − requested VAF | Lower values indicate closer targeting |
| Record integrity | Identical, modified, added, removed and unexpected record counts | All differences must be authorized |
| Feasibility behavior | Publication or fail-closed outcome | Failure is correct when the requested control is unrepresentable |
| Realism | Tag and distribution comparison with nearby real reads | Structural validity alone does not establish blind realism |
4
Results
The corrected implementation passed the structural and auditability objectives and improved dose accuracy on the matched successful subset. It also produced informative negative results: many low-feasibility experiments were correctly withheld, and the BAM-level fusion failed the realism objective.
4.1 Structural validity
| Measure | Legacy | Corrected | Result |
|---|---|---|---|
| BAM files passing declared-boundary walk | 0 / 34 | 20 / 20 | Supported |
| Declared BGZF blocks checked | 34 before first failure | 284,860 | All corrected boundaries traversed |
| Associated BAI files passing structural traversal | Not valid interoperability evidence because BAMs failed | 20 / 20 | Supported |
Finding: every inspected legacy BAM had the same one-byte BSIZE boundary error. The corrected writer stored the specification-defined block size minus one and passed the local independent boundary checks.
4.2 Variant-dose accuracy
Across 19 libraries that completed the same six events in both implementations, the mean absolute requested-VAF error decreased from 0.000915 to 0.000663 (0.0915 to 0.0663 percentage points), a descriptive reduction of 27.6%.
| Event | Requested VAF | Legacy error | Corrected error | Direction |
|---|---|---|---|---|
| EGFR T790M | 0.005 | 0.000710 | 0.000659 | Lower |
| EGFR L858R | 0.010 | 0.000426 | 0.000341 | Lower |
| EGFR exon-19 deletion | 0.020 | 0.000972 | 0.000607 | Lower |
| KRAS G12C | 0.050 | 0.001288 | 0.000755 | Lower |
| BRAF V600E | 0.100 | 0.001144 | 0.000725 | Lower |
| PIK3CA H1047R | 0.250 | 0.000951 | 0.000888 | Lower |
| Overall | Six-event ladder | 0.000915 | 0.000663 | 27.6% lower |
This is a descriptive comparison conditioned on successful completion in both implementations. It is not an independent cohort estimate or a clinical-performance result. In the historical-only subset, error decreased 24.1%, but the exon-19 deletion subgroup was slightly worse after correction.
4.3 Fail-closed feasibility
| Cohort | Completed all events | Failed closed | Interpretation |
|---|---|---|---|
| Historical | 11 / 12 | 1 / 12 | One input already had 24.0877% T790M support; an add-only 0.5% target was impossible |
| Stress, biological libraries | 8 / 20 | 12 / 20 | At least one requested event had no physically valid edit set |
Finding: the corrected program withheld outputs instead of inventing support or marking zero-edit events as PASS. These are fixed-ladder feasibility results—not crash rates, sensitivity or specificity.
4.4 Record audit and fusion realism
| Input records | Output records | Identical | Modified | Added | Removed | Unexpected |
|---|---|---|---|---|---|---|
| 1,076,077 | 1,076,339 | 1,075,397 | 680 | 262 | 0 | 0 |
The output contained 60 split-support fragments, 110 split-aligned read ends and 16 physically placeable spanning pairs. The exported ledger and record digests accounted for every difference.
AS and XS tags occurred on 100% of nearby real reads and 0% of planted reads. The synthetic records were therefore distinguishable. The BAM-level no-aligner fusion is retained as a structural challenge, not as a blind-realistic control.
4.5 Independent release acceptance
| Check | Observed result | Status |
|---|---|---|
| Focused pytest suite | 182 passed; 1 Windows directory-symlink case skipped | Pass |
| Original custom registry | 48 passed; 0 failed | Pass |
| Independent exact-count parse | 3,270 input and output records; 3,260 byte-identical; exact ALT delta +10; 0 unexpected changes | Pass |
| Independent index use | Bamnostic loaded the generated BAI and fetched the edited interval | Pass |
| HTTPS input acceptance | Official 13,337-byte HTSlib BAM validated; 112 records in/out; 111 unchanged; exact +1 ALT edit | Pass |
| Release reproducibility | 55 archive files; 54 internal checksums matched; wheel installed in isolation and CLI started | Pass |
Bamnostic is an independent Python BAM reader, not an independent biological experiment and not the production HTSlib stack.
5
Conclusions
- The legacy implementation should not be used as validation evidence; all 34 inspected legacy BAMs had invalid BGZF framing.
- The corrected variant path produced structurally valid files in the reported checks, improved requested-VAF accuracy on the matched successful subset and correctly rejected infeasible controls.
- Record-level ledgers and digests accounted for all differences in the representative audit, with no unexpected additions, removals or modifications.
- Exact-count mutation insertion is supported by focused tests and independent parser acceptance when molecular-family constraints permit the requested count.
- The fusion-realism hypothesis was not supported. BAM-level no-aligner fusion outputs should not be used as blind-realistic controls.
6
Limitations
- The VAF comparison includes only events that completed successfully in both implementations; observations within a library are correlated.
- Native
samtools, Picard, IGV and the intended production variant caller were not run in the final Windows acceptance environment. - Bamnostic provides independent parsing and index use, but does not replace validation with the production HTSlib/Picard toolchain.
- BAM editing evaluates the aligned-read stage. It does not test extraction, library preparation, sequencing, trimming or alignment.
- The aggregated cohort results are not analytical sensitivity, specificity, limit of detection, clinical sensitivity or clinical utility.
- Validation BAMs are intentionally excluded from the public release to avoid distributing operational or potentially identifying sequencing data.
- The release was accepted on Windows. The Python design is portable, but equivalent macOS and Linux acceptance runs remain outstanding.
7
Future directions
- Production-stack interoperability: run representative outputs through
samtools quickcheck,samtools flagstat, HTSlib re-indexing, PicardValidateSamFile, IGV and the intended caller. - Blinded recovery study: lock truth before analysis, spike replicated VAF ladders across depths and library types, and measure caller recovery with confidence intervals.
- Full-pipeline controls: create FASTQ-level controls and pass them through trimming, alignment, duplicate handling and calling.
- Fusion development: use the production aligner to generate truthful alignment scores and validate multiple fusion architectures.
- Molecular feasibility: quantify exact-count feasibility by depth, UMI structure, duplicate-family size and baseline ALT burden.
- Cross-platform reproducibility: add locked Windows, Linux and macOS acceptance manifests with native-tool outputs.
8
Software and reproducibility
The report describes the downloadable 1.1.0rc2 artifact. The local application accepts either a BAM path inside a selected working folder or an anonymous direct HTTPS BAM link. Linked BAMs download and validate on the user’s computer; the public report never receives BAM data.
Download and validate SpikeForge
ZIP size: 374,774 bytes. Python 3.10+ is required; there are no third-party runtime packages.
SHA-256: 8dec28c1234503d5fc2ac3658f745e89bf324c891f420db4b9f3095e2ae0f5df
Reproduce the software checks
- Download the ZIP and verify its SHA-256 against the value above.
- Extract it, then run
python -B tests/test_spikeforge.pyandpython -B -m pytest -q -p no:cacheprovider. - On Windows, double-click
Launch SpikeForge.cmdand select a working folder. - For the retained HTTPS acceptance example, use the official HTSlib range.bam, choose custom variant
CHROMOSOME_III:2476 T>C, select Add ALT reads, request1and require an exact count. - Confirm 112 records in and out, 111 byte-identical records, 1 authorized edit, final ALT count 1, and a PASS allele-count gate.
- Before pipeline use, repeat validation with the laboratory’s native samtools/Picard/caller/viewer stack.
Download the aggregate study results
These machine-readable summaries contain aggregate comparison results only; no validation BAMs or patient-level sequencing data are included.
Expected output
A successful BAM job produces a modified BAM, BAI index for coordinate-sorted input, truth VCF, edit ledger, planted-record digests and a machine-readable manifest. Keep the truth directory with the BAM.
9