Skip to content

Releases

v0.53.1: org move, LICENSE, dependency security updates

Choose a tag to compare

@berntpopp berntpopp released this 13 Nov 12:11
1a6154d

Changed

Added

  • LICENSE file with the MIT terms already declared in pyproject.toml (#222).

Dependencies

  • Security and maintenance updates: urllib3 2.8.0, idna 3.15, requests
    2.33.0, certifi 2026.10.18, pygments 2.20.0; dev: pytest 9.0.3,
    pymdown-extensions 11.0.1.

🤖 Generated with Claude Code

v0.53.0: ont_r10_sup_amplicon_v4 (span shape and per-strand errors pass)

Choose a tag to compare

@berntpopp berntpopp released this 10 Nov 09:42
940f8ee

Added

  • Read profile ont_r10_sup_amplicon_v4: _v3 with errors.strand_rates
    and the whole-unit stutter refitted (#131). On the MucSim-Bench standard set
    (30 cases, MucOneSpan's symmetric realism scoring from MucOneSpan #93) the
    span-offset Jensen-Shannon distance falls from 0.086 / 0.107 to
    0.075 / 0.076 (< 55 / ≥ 55 units; limit 0.1), and every per-strand error
    rate is within 2% of its target (_v3: + deletions +7%). _v1–_v3
    are unchanged.
  • helpers/calibrate_read_profile.py --fit-unit-stutter ROUNDS --vntr START END
    refits the unit stutter by simulation, so that simulated reads measured with
    the real profiler's anchor rule reproduce its per-allele stutter ratios
    (provenance.unit_stutter_fit.refit). calibration_report.strand_fit
    records the template's homopolymer runs against the target's
    (runs_per_60bp) (#131).

Fixed

  • The _v2/_v3 per-strand rates were fitted on a template with fewer C7
    runs than real alleles (0.54 against 0.62 per 60 bp), so + reads lost too
    many bases on real-like alleles; _v4 fits on a template with real-like
    runs. The _v3 unit stutter read the real profiler's −1 unit ratio, which
    also counts the main peak's left edge, as pure slippage; _v4 fits
    0.0016 instead of 0.0024 per unit (#131).

Documentation

  • The quick start, home page and README point at the read profiles; the
    realistic-reads guide has a calibration-status table for every profile
    (#212, #213).

v0.52.0: whole-unit PCR stutter (ont_r10_sup_amplicon_v3)

Choose a tag to compare

@berntpopp berntpopp released this 10 Nov 07:50
3651a36

Added

  • Whole-repeat-unit PCR stutter in the molecule model (#131):
    molecules.unit_stutter_rate (per VNTR unit) and unit_stutter_pmf
    (signed units). A full amplicon product deletes or duplicates whole repeat
    units at the haplotype's real unit boundaries. Stutter products have truth
    kind smear and detail unit_stutter:k:a-b. Off by default, so seeded
    outputs without it are unchanged.
  • Read profile ont_r10_sup_amplicon_v3: _v2 plus unit stutter fitted from
    the PRJEB92208 per-allele stutter ratios (0.0024 per unit; −1/−2/+1 units
    78/16/6%). On the MucSim-Bench standard set (30 cases) the span-offset
    Jensen-Shannon distance falls from 0.186 / 0.187 to 0.162 / 0.181
    (< 55 / ≥ 55 units; target ≤ 0.1); per-strand error rates are unchanged.
    _v1 and _v2 are unchanged. There is no genomic _v3: WGS has no PCR and
    its target has 27 on-peak reads.
  • helpers/calibrate_read_profile.py --fit-unit-stutter fits the unit stutter
    from per_allele_stutter_and_length_noise and records it in
    provenance.unit_stutter_fit (#131).

v0.51.0: per-strand ONT profiles, profile integrity, Illumina vntr default

Choose a tag to compare

@berntpopp berntpopp released this 10 Nov 07:13
e85ccdf

Added

  • Read profiles ont_r10_sup_amplicon_v2 and ont_r10_genomic_v2 with
    per-strand error rates (#131). Real R10.4.1 errors are strand-asymmetric
    (amplicon deletions 1.14% on +, 0.49% on -), but the _v1 error
    channel was symmetric: on the MucSim-Bench standard set (30 cases each),
    _v1 missed + mismatches by -30% and - deletions by +39% (genomic:
    - mismatches -27%, - insertions +40%). With _v2, every per-strand
    mismatch, insertion and deletion rate is within 11% of its target. The
    _v1 profiles are unchanged, so runs made with them reproduce. Use _v2
    for new work.
  • errors.strand_rates in read profiles: optional +/- overrides of the
    empirical channel's mismatch, insertion and deletion rates (#131).
  • helpers/calibrate_read_profile.py --fit-strand-rates ROUNDS fits
    errors.strand_rates against error_rates_per_ref_base["<strand>:<type>"]
    and records the rounds in calibration_report.strand_fit (#131).

Changed

  • config.json uses downsample_mode: "vntr", the code default. Its
    non_vntr setting gave a 697.5x VNTR against 150.7x on the capture BED;
    vntr gives 204.2x against 150.7x (#88).
  • Library API: simulate_reads() now applies a read_model profile's
    config_overrides and platform check, as the CLI does. Configs that
    relied on these being skipped give different reads (#128).

Fixed

  • A read profile is now loaded once per run and checked against the
    read_model.sha256 recorded when it was applied; a profile edited on disk
    mid-run raises an error instead of being used silently (#128).
  • A read_model in a config passed to simulate_reads() (library API) now
    gets the same platform check and config_overrides as the CLI (#128).
  • reads ont --simulator pbsim3-fragments rejects a profile with amplicon-only
    molecule rates (smear, chimera, concatemer, off-target), which fragment mode
    would ignore (#128).

Documentation

  • The genomic profiles' read lengths are a generic default, not a fit, so
    their VNTR-spanning fraction is not calibrated (#131).
  • The Illumina downsampling keys (downsample_mode, sample_target_bed,
    vntr_to_flanking_ratio, downsample_seed) are documented, with measured
    depths and the settings that match real Twist v2 exomes. There are still
    no off-target reads, so the read count stays about 5x lower (#88).

v0.50.1: Vrbacká L/R/S units and C:60dupA (#201)

Choose a tag to compare

@berntpopp berntpopp released this 10 Nov 00:09
04a018d

Seeded outputs change for haplotypes that contain L or R repeats.

Fixed

  • Repeat units L, R and S now use the sequences from Vrbacká et al. 2025
    (pristanna/muc1repeats). They came from the VNtyper motif set and each
    differed by 1 bp (#201).

Changed

  • dupA (60dupA) is also allowed on repeat C, where Vrbacká et al. 2025
    report it (C:60dupA). Random dupA targets can now land on C (#201).

Tests

  • The real-tool e2e golden checksums are re-measured for the new seed-42
    haplotype (#179, #201). Reads from the same FASTA are byte-identical to
    0.49.0. The read-tracking e2e test sets its molecule count in
    ont_amplicon_params (#181).

v0.50.0: resolve follow-up audit issues #159-#200

Choose a tag to compare

@berntpopp berntpopp released this 09 Nov 23:45
3842e6f

Resolves the 2026-11-09 follow-up audit (issues #159–#201).

Seeded outputs change.

  • The VNTR end block is now drawn from the transition table: V always
    precedes 6/6p, and 6p can skip to 8 (#179).
  • Amplicon and fragment long-read modes default to 30 molecules, using the
    platform's own *_params.coverage instead of the Illumina target of 150
    (#181).
  • The Vrbacká variants insG_pos58, insG_pos54, insA_pos54 and
    ins16bp now insert at the published position. insG_pos54 and
    insA_pos54 target the new units bJ and aH (#190).
  • The benign controls delCCC_benign and del3bp_pos30_benign delete
    3 bp, not 4 (#159).

Breaking

  • Duplicate mutation targets are now an error. The CLI used to drop them
    silently, and the Python API applied them twice (#166).
  • Config validation is stricter: only distribution: "normal" is accepted
    ("uniform" never worked; it gave fixed lengths), mutation positions
    must be ≥ 1, transition weights must be > 0, and transition targets must
    be known repeats or END (#180).
  • --coverage must be > 0, and --threads, --read-number, --n-reads
    and --min-read-length must be ≥ 1 (#169).
  • ONT without a human reference returns FASTQ instead of aligning to the
    simulated haplotypes (#183).

Fixed

  • The benign deletion controls were frameshifts and were flagged as toxic
    (#159).
  • hg19 runs use the hg19 VNTR region for capture bias instead of the
    hard-coded hg38 region, which dropped the reads (#160).
  • Dual mode with --input-structure reuses the file's targets and writes
    correct structure files (#161).
  • Ctrl-C and SIGTERM stop the external tools instead of leaving them
    running (#162). A failed pipe reports the stage that really failed (#165).
  • A dead end in the repeat chain, or an end block that cannot reach 9,
    raises SimulationError instead of returning a truncated haplotype
    (#167, #179).
  • Kept ONT haplotype FASTQs are prefixed with the sample name, so samples
    no longer overwrite each other (#168).
  • Docker: NanoSim models load again (scikit-learn 0.23.2), pbsim3 model
    paths resolve, and the image installs from uv.lock (#175, #177, #191).
  • A missing explicit human_reference fails before simulation, and PacBio
    no longer deletes the HiFi FASTQ when alignment fails (#176).
  • An unknown ReSeq version is treated as ReSeq2, so input is not chunked
    (#182). The metadata Seed row records the seed actually used (#185).
  • snapshot-validate no longer crashes on PCR failure, and 0 products are
    reported as a PCR failure instead of normal (#184).
  • pbsim3 accepts accuracy_mean < 0.75 and validates length_sd (#186).
  • The Vrbacká citation DOI is corrected (#178).
  • PacBio and ONT amplicon defaults agree (threads 8, a clear error for a
    missing PacBio model_type), and analyze stats reads .gz (#187).

Performance

  • Read-source tracking streams its manifest: peak memory at 1M read pairs
    drops from 743 MB to 46 MB, with byte-identical output (#189).
  • The homopolymer scan is about 4x faster (#188).

CI and tests

  • The e2e tests detect the real simulator.py and pbsim binaries, and
    all 7 pass with the real tools (#163, #192).
  • The Docker image is tested with a real simulate + reads run (#163).
  • Version tags on the image are set only on releases (#164).
  • The scikit-learn CVEs that NanoSim cannot avoid are documented in
    .trivyignore, with expiry dates (#175).

v0.49.0: resolve 2026-11-09 codebase audit, ReSeq2 via bioconda

Choose a tag to compare

@berntpopp berntpopp released this 09 Nov 19:34
29ac94a

Resolves the 2026-11-09 codebase audit
(.planning/reports/2026-11-09-codebase-audit.md) in six workstreams.

Seeded outputs change. Repeat counts are now rounded instead of
truncated. Random SNP counts use stochastic rounding, so low densities no
longer give 0 SNPs every time. ONT pbsim3-fragments now treats --coverage
as the total over both haplotypes (it used to give about 2.3x the request)
and weights haplotypes by length. The empirical error model no longer
lengthens protected homopolymers without recording it. Unseeded runs now
draw a seed and record it in provenance.

Fixed

  • Illumina simulation works again with real tools:
    • Gapped pblat matches no longer make insert-length sampling impossible.
    • The conda env, Docker image and config.json ran the legacy bioconda
      ReSeq 1.1 (since #156), which deadlocks above 10,000 fragments. They
      now use bioconda reseq2=2.0.3. If tools.reseq still points at
      ReSeq 1.x, seqToIllumina input is fed in batches of at most 10,000
      fragments. The old 600 s cap on that step is gone. Existing env_wessim
      environments need mamba install -n env_wessim -c bioconda reseq2=2.0.3.
  • All pipelines now resolve the alignment reference once, in one order:
    human_reference_<asm>, then human_reference, then
    reference_genomes.<asm>.fasta_path.
  • VNTR downsampling and the VNTR capture model now keep read pairs together
    (no orphan mates). The VNTR BED is now correctly 0-based.
  • Truth manifests:
    • ONT read end coordinates come from the aligned length.
    • Illumina reads are matched to fragments by name.
    • A HiFi read takes the strand of its first subread.
  • CLI:
    • A duplicate --mutation-targets is no longer applied twice.
    • Conflicting or ignored option combinations now exit 1.
    • Batch output-name collisions are rejected.
    • --random-snp-output-file is written under --out-dir.
    • reads --track-read-source no longer crashes when --out-dir does not
      exist yet.
  • keep_intermediate_files now works in the amplicon and ONT pipelines.
    Illumina --no-align --track-read-source now writes a manifest.
  • Config:
    • The fingerprint no longer depends on the working directory and is
      computed once per run.
    • The schema rejects repeat counts below 10 and non-integer mutation
      positions.
  • Subprocesses:
    • Timeouts now kill the whole process group.
    • The failing pipeline stage's stderr is kept.
    • The bwa and reseq timeouts default to none; the new
      read_simulation.alignment_timeout sets one.
  • The minimap2 index check now matches the index the aligner actually reuses.
  • Reference helpers:
    • Downloads and extractions are atomic and MD5-checked.
    • Existing verified downloads are skipped.
    • The GATK .dict file name is correct.

Changed

  • CI installs from uv.lock, installs samtools, and pins mypy and setup-uv.
  • The sdist shrank from 41 MB to 1.6 MB.
  • The snapshot integration tests now run on simulated data instead of
    skipping.
  • pysam is a new optional tracking extra.
  • Test-data tarballs moved from git to GitHub Releases (testdata-v0.25.0);
    data/testdata_releases/ is now gitignored. make publish-testdata uploads a
    new dataset with a .sha256 file, and the generator no longer writes an
    in-repo _latest/ copy. Old blobs remain in git history.

Removed

  • About 1,800 lines of dead or duplicated code: unused type aliases, a
    test-only ORF pipeline, duplicate samtools and reverse_complement
    helpers, unused constants and helpers, and no-op tests.

v0.48.0: resolve audit issues #127 and #147-#156

Choose a tag to compare

@berntpopp berntpopp released this 19 Oct 05:56

What's Changed

Resolves 11 verified codebase audit issues (#127 and #147–#156) across PacBio/ONT amplicon and long-read simulation pipelines, external tool wrappers, CLI read simulation options, SNP integration and coordinate translation, haplotype assembly and config validation, ORF and SNaPshot analysis, Illumina fragment simulation, reference helper security hardening, and packaging/CI/documentation.

Fixed

  • Amplicon simulation pipelines (#147):
    • Prevent duplicate read IDs in diploid PacBio/ONT amplicon runs when --seed is set by deriving distinct per-haplotype seeds (seed + 1, seed + 2) and prefixing diploid pbsim3/empirical amplicon reads (hap1_, hap2_).
    • Reject polyploid FASTAs (>2 records) in diploid amplicon pipelines instead of silently dropping haplotype 3+; reject --coverage < 2 in diploid amplicon runs before extraction.
    • Propagate original ExternalToolError exceptions without double-wrapping, honour OutputConfig.out_dir / out_base, and clean up all pbsim3 multi-template sidecars (*.fq.gz, *.maf.gz, *.ref).
  • External tool wrappers & VNTR efficiency (#148):
    • Pass --id-prefix to pbsim3 to avoid read-ID collisions across diploid splits; remove duplicate coverage logging; validate min_Bind (0.0 <= min_Bind <= 1.0) and min_fragment_size <= max_fragment_size in prepare_fragments; validate threads >= 1 in reseq_wrapper.
    • Stream FASTA split output in nanosim_wrapper.split_fasta_for_diploid via SeqIO.parse; surface actual samtools stderr on empty BAM/FASTQ outputs instead of masking with generic errors; remove redundant samtools index subprocess invocation after samtools sort --write-index.
    • Include temp directory in VNTREfficiencyModel cache path to prevent multi-user /tmp collisions and add retry backoff when removing transient temp directories.
  • CLI read simulation options & pipeline routing (#149):
    • Propagate reads pacbio --coverage into config["pacbio_params"]["coverage"]; inherit root config["seed"] when --seed and read_simulation.seed are omitted; accept float --coverage across reads illumina, reads ont, and reads pacbio.
    • Wire --threads (-t) and --no-align on reads amplicon through pacbio_params and read_simulation; remove dead legacy simulate_reads dispatcher and simplify simulate_reads_pipeline signature.
  • Long-read pipelines, parsers & truth tracking (#127, #150):
    • Honour keep_intermediate_files in pacbio_pipeline and ont_pipeline; remove CCS report/metrics sidecars (*ccs_report.txt, *ccs_metrics.json, *.zmw_metrics.json.gz) during intermediate cleanup.
    • Reconcile PacBio HiFi and ONT source-tracking manifests with the final surviving FASTQ reads (preventing inflated manifest rows after CCS filtering or NanoSim split merging) and support post-filtering in ReadSourceTracker.write_read_manifest.
    • Stream FASTQ reading/writing in renumber_fastq_reads and parse_pacbio_reads without buffering whole files in memory; reject polyploid (>2 record) FASTAs in split_diploid_fasta; guard empty reference dicts in annotate_reads_from_umi.
  • SNP integration & coordinate translation (#151):
    • Eliminate unconditional set(range(seq_length)) memory spike in generate_random_snps by passing Sequence[int] ranges directly (_SampledPositions exclusions + binary search over VNTR bounds).
    • Preserve HaplotypeResult._repeat_lengths through integrate_snps_unified.
    • Translate --snp-input-file coordinates across indel mutations in single-mutation mode and support multi-repeat indels in fallback repeat-length calculation via shared _translate_snps_to_mutated; accept haplotype indices >= 3 in parse_snp_file for polyploid simulations.
  • Haplotype simulation, assembly & configuration (#152):
    • Align simulate_single_haplotype dead-end retry semantics with from_predefined_chains; validate mutation_targets syntax (haplotype_index >= 1, repeat_index >= 1) and fixed_lengths positivity before simulation.
    • Reject path separators and traversal in --out-base (validate_out_base); validate --reference-assembly against configured reference assemblies before simulation; replace fragile sys.path.insert hacks in tests/conftest.py.
  • ORF analysis, translation & SNaPshot validation (#153):
    • Use orfipy_core.orfs() in-memory in run_orf_finder instead of spawning orfipy CLI subprocesses and temp directories; forward loaded config into analyze orfs; strip trailing * stop codons in translate_dna before regex matching.
    • Propagate non-zero exit codes when analyze orfs or analyze stats fails across all inputs; clean up SnapshotValidator.validate() temporary directories using tempfile.TemporaryDirectory.
  • Illumina fragment simulation & empirical error model (#154):
    • Slice Wessim2 fragment start/end tendency arrays by actual nucleotide coordinates (frag_start:frag_end) rather than repeat-symbol indices (range(len(hr.chain))).
    • Raise ValueError on out-of-range nucleotide offsets in EmpiricalErrorModel.sample_indel; surface OSError failures during cleanup_intermediates; reduce unit test subprocess overhead.
  • Reference helper security hardening (#155):
    • Validate download URLs (https:// scheme and trusted domain allowlist), enforce SHA-256 verification, stream downloads with a 500 MB size cap, and apply filter="data" on tarfile.extractall() in helpers/download_references.py.
    • Add --preset (map-ont, map-hifi, asm20) to helpers/install_references.py so pre-built minimap2 .mmi indexes match runtime preset filenames ({stem}_{preset}.mmi).
  • Packaging, CI & documentation (#156):
    • Change default reseq command in config.json from a hardcoded conda binary path to "reseq"; fix Makefile targets (format, security, docs-serve) to use uv run and muc_one_up; run pytest -m "not slow" in the CI coverage job so codecov uploads complete on schedule; update .trivyignore and installation/quickstart documentation.

Full Changelog: v0.47.0...v0.48.0

v0.47.0: resolve audit issues #126, #129, and #134-#145

Choose a tag to compare

@berntpopp berntpopp released this 18 Oct 21:35

What's Changed

Resolves 14 verified codebase audit issues (#126, #129, and #134–#145) across haplotype mutation/assembly, VNTR boundary and repeat-length tracking, dual-mode SNP coordinate translation, read simulation pipelines, external tool wrappers, subprocess process-group timeout cleanup, and dead-code removal (#146).

Fixed

  • Mutation & sequence assembly (#134, #135):
    • Preserve prior mutations and live per-repeat lengths across multiple targets and sequential apply_mutations calls via HaplotypeResult._repeat_lengths; update repeat length after each step in multi-operation mutations; replace only the target repeat slice on non-strict symbol conversion.
    • Bound normal repeat-count rejection sampling (1,000,000 draws) and reject min_rep > max_rep; validate fixed_lengths count in simulate_diploid; assemble haplotype sequences in $O(N)$.
  • ORF & toxic protein detection (#136, #137):
    • Clamp composition_similarity to [0.0, 1.0]; enforce min_nt_length = max(min_len, orf_min_aa * 3) in run_orf_finder; strip constant flanks per ORF record so multi-ORF FASTAs in different frames or with SNP-modified flanks score identically regardless of record order.
    • Support configurable snapshot.primary_primer and verify expected fluorophores in SnapshotValidator.
  • VNTR boundaries, repeat lengths & source tracking (#126, #138):
    • Propagate exact mutated repeat lengths through generate_simulation_statistics, write_simulation_statistics, ReadSourceTracker.from_simulation_results, and companion_stats_fields; unify VNTR boundary calculation (get_haplotype_vntr_bounds) across simulation_statistics and snp_integrator, handling early-9 termination without right flank and 0-bp repeat deletions.
  • Configuration, CLI RNG threading & dual-mode SNPs (#139, #140):
    • Enforce single-CLI-entry config loading boundary; resolve relative NanoSim training_data_path prefixes; expand CONFIG_SCHEMA with read_simulation, nanosim_params, pacbio_params, snapshot.primary_primer, and validation.mutant_extension.
    • Thread seeded rng across CLI simulation, mutation, and SNP integration (honoring both --seed and config["seed"]); implement exact per-repeat coordinate translation for dual-mode SNPs across indels and enforce 1-based SNP input coordinates.
  • Read simulator pipelines, truth tracking & wrappers (#129, #142, #143, #144, #145):
    • Guard negative start coordinates in amplicon_Clip, preserve diploid amplicon templates when only one haplotype extracts, make StutterTable, MoleculeModel, and ReadProfile hashable, and validate 2-record diploid FASTAs.
    • Compute minimum fragment probe overlap via math.ceil(plen * bind), guard invalid bind/insert bounds, deduplicate reverse_complement and IUPAC primer matching (including ambiguous template bases) into sequence_utils.py, and fix EmpiricalErrorModel weighted sampling boundary.
    • Split VNTR and non-VNTR reads in a single samtools view -L -U pass, honor seed across VNTREfficiencyModel and Stage 10/11 downsampling, and stream samtools depth in check_vntr_coverage.
    • Route ONT alignment through minimap2_wrapper.align_reads_with_minimap2(..., exclude_flags=4), clamp extreme diploid PCR bias counts to [1, total - 1], and stream FASTA parsing in amplicon_extractor and diploid_handler.
    • Escalate subprocess and pipeline timeouts (SIGTERM -> SIGKILL) across the entire process group (os.killpg), preserve upstream pipeline stage error messages, and validate tool parameters and non-empty outputs across bwa, ccs, pbsim3, ucsc, and samtools wrappers.

Removed

  • Deleted dead modules and duplicate helpers (#134, #135, #137, #141, #142, #144, #145): muc_one_up/validation.py, muc_one_up/bioinformatics/validation.py, muc_one_up/probabilities.py, muc_one_up/cli/source_tracking_setup.py, rebuild_haplotype_sequence, estimate_hifi_yield, _count_fastq_reads, align_ont_reads_with_minimap2, and duplicate reverse_complement/comp implementations.

Full Changelog: v0.46.0...v0.47.0

v0.46.0: fix homopolymer stutter coverage

Choose a tag to compare

@berntpopp berntpopp released this 24 Sep 14:52
86334cf

Homopolymer runs without a stutter-table entry (e.g. the dupC C8 run) were
simulated error-free by the ONT read profiles (#132); they are now stuttered
at a realistic rate. Breaking change for custom read profiles with an
errors section:
they now need molecules.stutter_fallback. See the
Homopolymer stutter coverage
guide section. Simulations without a read profile are unaffected (seeded
legacy ONT/HiFi amplicon FASTQs stay byte-identical to 0.45.0).

Breaking change: read profile format

Custom read profiles with an errors section (empirical error channel) must
be updated (#132). Without these, homopolymer runs could be simulated
error-free, so such profiles are now rejected with a message that points to
the calibration helper and the guide section above:

  • molecules.stutter and molecules.stutter_fallback are required, with
    rule (log_odds_interpolate), log_odds_slope_per_base,
    max_extrapolation_bases and generic (ref_len, pmf);
  • a fitted stutter entry for a protected run (length >= errors.hp_min_len)
    must have P(delta = 0) < 1, and the generic pmf must keep error mass at the
    table's minimum run length;
  • errors.hp_min_len must not be below the stutter table's minimum run length.

Regenerate with helpers/calibrate_read_profile.py --engine empirical, or
copy stutter_fallback from a built-in profile. Profiles without errors
(pbsim3 path) are unaffected.

Fixed

  • Homopolymer runs without a stutter entry were simulated error-free
    (#132). The empirical error channel protects every run >= hp_min_len from
    base-level errors, and a missing stutter key drew no length change, so the
    dupC C8 run, all A/T runs and G runs >= 5 of the ONT profiles were read
    perfectly. Now:
    • ont_r10_sup_amplicon_v1 fits every per-strand key of the PRJEB92208
      amplicon target with n >= 500, adding C8|+ and C8|- (p_correct 0.362
      and 0.747); ont_r10_genomic_v1 is refit from the WGS target (n >= 300),
      which has no C8 key;
    • new molecules.stutter_fallback (rule log_odds_interpolate) resolves
      runs without a fitted entry: it interpolates the error log-odds between
      the nearest fitted lengths of the same base and strand, extrapolates
      beyond the fitted range (at most max_extrapolation_bases, 3 in the
      built-ins, so long flank runs such as T19 are not almost always
      misread), or uses a generic pmf with a warning (once per base) when the
      base has no fitted entries;
    • profiles with an errors model are validated so no protected run is
      error-free by construction (see Breaking change above);
    • homopolymer runs ignore case (a soft-masked cccC is C4 and keeps its
      case when stuttered); runs of N get no stutter and are not protected
      from base-level errors;
    • provenance.stutter_fit records the fitted and excluded keys, the minimum
      n and the fallback derivation; runs resolved by interpolation or
      extrapolation are logged at INFO once per profile load.
  • helpers/calibrate_read_profile.py validates the simulated observed-minus-
    true pmf against the target for every base/length/strand
    (calibration_report.validation_round*.per_key) and gains --min-target-n
    (default now 500), --max-delta (default now 6, was 3),
    --min-lengths-for-slope, --generic-ref-len, --max-extrapolation-bases
    and --tolerance; --model-file is only required for --engine pbsim3.
    With --engine pbsim3 it drops an inherited errors model and
    stutter_fallback; with --engine empirical it requires
    errors.hp_min_len to equal the stutter table's minimum run length (3).
    Fitting fails with a message instead of dividing by zero when a target key
    has no mass within --max-delta, and rounding never makes P(0) negative.

Changed (intentional output differences)

  • Reads simulated with ont_r10_sup_amplicon_v1 or ont_r10_genomic_v1
    change for the same seed: all homopolymer runs are now stuttered and the
    refit tables keep deltas up to ±6. Simulations without a read profile are
    unchanged (seeded legacy ONT and HiFi amplicon FASTQs are byte-identical to
    0.45.0). User profiles with an errors section but no stutter_fallback
    are now rejected (see Breaking change above).

Tests

  • Legacy byte-identity guard: a unit test pins the template FASTA md5s and
    tool argument lists of seeded legacy ONT and HiFi amplicon runs (tools
    mocked), and an integration test checks the golden FASTQ md5s with real
    pbsim3/ccs/samtools (skips when they are missing).
  • make ci-check equivalent: ruff, format and mypy clean; 1657 passed, 13
    skipped
    , coverage 91%.
  • C8 realism (truth-tracked CLI run, dupC amplicon): C8|+ 0.369 vs target
    0.362 (n=537), C8|− 0.740 vs target 0.747 (n=539) — down from 0.990/0.991
    before the fix.
  • Known residual: ont_r10_genomic_v1 has no WGS target for C8; C6|+
    resolves to 0.965 against a noisy target of 0.897 (n=97).

Closes #132

Full changelog: v0.45.0...v0.46.0