assemblytrace 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. assemblytrace-1.1.0/CHANGELOG.md +129 -0
  2. assemblytrace-1.1.0/CITATION.cff +19 -0
  3. assemblytrace-1.1.0/LICENSE +21 -0
  4. assemblytrace-1.1.0/MANIFEST.in +13 -0
  5. assemblytrace-1.1.0/PKG-INFO +198 -0
  6. assemblytrace-1.1.0/README.md +165 -0
  7. assemblytrace-1.1.0/docs/DESIGN.md +57 -0
  8. assemblytrace-1.1.0/docs/LIMITATIONS.md +10 -0
  9. assemblytrace-1.1.0/docs/ROADMAP.md +17 -0
  10. assemblytrace-1.1.0/docs/SCAN_EXECUTION.md +118 -0
  11. assemblytrace-1.1.0/docs/SCIENTIFIC_METHODS.md +403 -0
  12. assemblytrace-1.1.0/docs/SPECIFICATION.md +123 -0
  13. assemblytrace-1.1.0/docs/SUPPORTED_INPUTS.md +86 -0
  14. assemblytrace-1.1.0/docs/VALIDATION_PROTOCOL.md +731 -0
  15. assemblytrace-1.1.0/docs/VERSION_POLICY.md +18 -0
  16. assemblytrace-1.1.0/docs/archive/ACCEPTANCE_MATRIX_1.0.0.tsv +66 -0
  17. assemblytrace-1.1.0/docs/archive/ENGINEERING_AUDIT_0.3.1.md +49 -0
  18. assemblytrace-1.1.0/docs/archive/INSTALL_PL.md +46 -0
  19. assemblytrace-1.1.0/docs/archive/JOSS_READINESS.md +9 -0
  20. assemblytrace-1.1.0/docs/archive/KNOWN_ISSUES_20261016.md +43 -0
  21. assemblytrace-1.1.0/docs/archive/REPRODUCIBILITY_0.5.0.md +71 -0
  22. assemblytrace-1.1.0/docs/archive/VALIDATION_0.3.0.md +55 -0
  23. assemblytrace-1.1.0/docs/archive/VALIDATION_0.3.1.md +56 -0
  24. assemblytrace-1.1.0/docs/archive/VALIDATION_0.3.2.md +80 -0
  25. assemblytrace-1.1.0/docs/archive/VALIDATION_0.3.2_PL.md +85 -0
  26. assemblytrace-1.1.0/docs/archive/VALIDATION_0.4.0_PL.md +59 -0
  27. assemblytrace-1.1.0/docs/archive/VALIDATION_0.4.1_PL.md +64 -0
  28. assemblytrace-1.1.0/docs/archive/VALIDATION_0.5.0.md +54 -0
  29. assemblytrace-1.1.0/docs/archive/VALIDATION_0.5.0_PL.md +43 -0
  30. assemblytrace-1.1.0/docs/archive/VALIDATION_0.6.0_PL.md +56 -0
  31. assemblytrace-1.1.0/docs/archive/VALIDATION_0.6.1_PL.md +67 -0
  32. assemblytrace-1.1.0/docs/archive/VALIDATION_0.6.2.md +91 -0
  33. assemblytrace-1.1.0/docs/archive/VALIDATION_0.6.2_PL.md +50 -0
  34. assemblytrace-1.1.0/docs/archive/VALIDATION_1.0.0_release_acceptance.md +68 -0
  35. assemblytrace-1.1.0/docs/archive/VALIDATION_20261101_judge.md +83 -0
  36. assemblytrace-1.1.0/docs/archive/VALIDATION_SUMMARY_0.3.0.json +52 -0
  37. assemblytrace-1.1.0/docs/archive/VALIDATION_SUMMARY_0.6.2.json +98 -0
  38. assemblytrace-1.1.0/docs/archive/VALIDATION_SUMMARY_1.0.0.json +54 -0
  39. assemblytrace-1.1.0/examples/assembly_after.fa +4 -0
  40. assemblytrace-1.1.0/examples/assembly_before.fa +4 -0
  41. assemblytrace-1.1.0/examples/busco_summary.txt +4 -0
  42. assemblytrace-1.1.0/examples/genes.gff3 +4 -0
  43. assemblytrace-1.1.0/examples/illumina.sam +4 -0
  44. assemblytrace-1.1.0/examples/proteins.faa +2 -0
  45. assemblytrace-1.1.0/examples/quast_report.tsv +2 -0
  46. assemblytrace-1.1.0/examples/repeat_reads.sam +5 -0
  47. assemblytrace-1.1.0/examples/repeat_ref.fa +2 -0
  48. assemblytrace-1.1.0/examples/repeat_variants.json +1 -0
  49. assemblytrace-1.1.0/pyproject.toml +45 -0
  50. assemblytrace-1.1.0/setup.cfg +4 -0
  51. assemblytrace-1.1.0/src/assemblytrace/__init__.py +1 -0
  52. assemblytrace-1.1.0/src/assemblytrace/__main__.py +4 -0
  53. assemblytrace-1.1.0/src/assemblytrace/annotation.py +307 -0
  54. assemblytrace-1.1.0/src/assemblytrace/attribute.py +1388 -0
  55. assemblytrace-1.1.0/src/assemblytrace/change.py +221 -0
  56. assemblytrace-1.1.0/src/assemblytrace/claims.py +612 -0
  57. assemblytrace-1.1.0/src/assemblytrace/cli.py +230 -0
  58. assemblytrace-1.1.0/src/assemblytrace/core.py +100 -0
  59. assemblytrace-1.1.0/src/assemblytrace/curation.py +155 -0
  60. assemblytrace-1.1.0/src/assemblytrace/formats.py +957 -0
  61. assemblytrace-1.1.0/src/assemblytrace/identity.py +74 -0
  62. assemblytrace-1.1.0/src/assemblytrace/indels.py +95 -0
  63. assemblytrace-1.1.0/src/assemblytrace/inventory.py +379 -0
  64. assemblytrace-1.1.0/src/assemblytrace/io_safety.py +69 -0
  65. assemblytrace-1.1.0/src/assemblytrace/lift.py +467 -0
  66. assemblytrace-1.1.0/src/assemblytrace/localmatch.py +51 -0
  67. assemblytrace-1.1.0/src/assemblytrace/project.py +494 -0
  68. assemblytrace-1.1.0/src/assemblytrace/prov.py +277 -0
  69. assemblytrace-1.1.0/src/assemblytrace/provenance.py +183 -0
  70. assemblytrace-1.1.0/src/assemblytrace/py.typed +0 -0
  71. assemblytrace-1.1.0/src/assemblytrace/release.py +432 -0
  72. assemblytrace-1.1.0/src/assemblytrace/report.py +1046 -0
  73. assemblytrace-1.1.0/src/assemblytrace/scan.py +538 -0
  74. assemblytrace-1.1.0/src/assemblytrace/segments.py +348 -0
  75. assemblytrace-1.1.0/src/assemblytrace/seqcol.py +161 -0
  76. assemblytrace-1.1.0/src/assemblytrace/shellexp.py +229 -0
  77. assemblytrace-1.1.0/src/assemblytrace/sparsediff.py +905 -0
  78. assemblytrace-1.1.0/src/assemblytrace/summary.py +146 -0
  79. assemblytrace-1.1.0/src/assemblytrace/variant_input.py +91 -0
  80. assemblytrace-1.1.0/src/assemblytrace/versions.py +583 -0
  81. assemblytrace-1.1.0/src/assemblytrace.egg-info/PKG-INFO +198 -0
  82. assemblytrace-1.1.0/src/assemblytrace.egg-info/SOURCES.txt +212 -0
  83. assemblytrace-1.1.0/src/assemblytrace.egg-info/dependency_links.txt +1 -0
  84. assemblytrace-1.1.0/src/assemblytrace.egg-info/entry_points.txt +2 -0
  85. assemblytrace-1.1.0/src/assemblytrace.egg-info/requires.txt +17 -0
  86. assemblytrace-1.1.0/src/assemblytrace.egg-info/top_level.txt +1 -0
  87. assemblytrace-1.1.0/tests/test_acceptance_boundaries.py +138 -0
  88. assemblytrace-1.1.0/tests/test_annotation_ncbi_v060.py +49 -0
  89. assemblytrace-1.1.0/tests/test_annotation_stop_boundaries.py +54 -0
  90. assemblytrace-1.1.0/tests/test_annotation_stop_oracle.py +38 -0
  91. assemblytrace-1.1.0/tests/test_annotation_unmapped_cds_final.py +41 -0
  92. assemblytrace-1.1.0/tests/test_attribution_audit_repairs.py +182 -0
  93. assemblytrace-1.1.0/tests/test_attribution_calibration.py +393 -0
  94. assemblytrace-1.1.0/tests/test_attribution_scoring_repairs.py +81 -0
  95. assemblytrace-1.1.0/tests/test_audit_contract.py +98 -0
  96. assemblytrace-1.1.0/tests/test_audit_integrity_repairs.py +152 -0
  97. assemblytrace-1.1.0/tests/test_census_verifier_repairs.py +261 -0
  98. assemblytrace-1.1.0/tests/test_cli_input_safety.py +183 -0
  99. assemblytrace-1.1.0/tests/test_cli_result_preservation.py +56 -0
  100. assemblytrace-1.1.0/tests/test_completion_freshness.py +167 -0
  101. assemblytrace-1.1.0/tests/test_core.py +23 -0
  102. assemblytrace-1.1.0/tests/test_core_review_regressions.py +40 -0
  103. assemblytrace-1.1.0/tests/test_curation.py +37 -0
  104. assemblytrace-1.1.0/tests/test_empty_comparison_inputs.py +47 -0
  105. assemblytrace-1.1.0/tests/test_environment_matrix.py +54 -0
  106. assemblytrace-1.1.0/tests/test_external_public_data_20261008.py +24 -0
  107. assemblytrace-1.1.0/tests/test_frame_fit.py +104 -0
  108. assemblytrace-1.1.0/tests/test_frames.py +228 -0
  109. assemblytrace-1.1.0/tests/test_gff3_escaped_parent_v061.py +32 -0
  110. assemblytrace-1.1.0/tests/test_hardening.py +223 -0
  111. assemblytrace-1.1.0/tests/test_indel_exhaustive_oracle_v060.py +38 -0
  112. assemblytrace-1.1.0/tests/test_independent_validation.py +94 -0
  113. assemblytrace-1.1.0/tests/test_lineage_links.py +202 -0
  114. assemblytrace-1.1.0/tests/test_localmatch_exact.py +38 -0
  115. assemblytrace-1.1.0/tests/test_modules.py +77 -0
  116. assemblytrace-1.1.0/tests/test_orientation_and_attribution_fit.py +249 -0
  117. assemblytrace-1.1.0/tests/test_output_safety.py +153 -0
  118. assemblytrace-1.1.0/tests/test_project_acceptance.py +91 -0
  119. assemblytrace-1.1.0/tests/test_project_cli.py +93 -0
  120. assemblytrace-1.1.0/tests/test_project_control.py +269 -0
  121. assemblytrace-1.1.0/tests/test_project_scan.py +242 -0
  122. assemblytrace-1.1.0/tests/test_prov_directional_relations.py +53 -0
  123. assemblytrace-1.1.0/tests/test_provenance_contract.py +87 -0
  124. assemblytrace-1.1.0/tests/test_publication_tables.py +309 -0
  125. assemblytrace-1.1.0/tests/test_published_truth_windows.py +24 -0
  126. assemblytrace-1.1.0/tests/test_readme_repeat_demo.py +25 -0
  127. assemblytrace-1.1.0/tests/test_refseq_integration_script_v060.py +20 -0
  128. assemblytrace-1.1.0/tests/test_regression.py +239 -0
  129. assemblytrace-1.1.0/tests/test_release_acceptance.py +110 -0
  130. assemblytrace-1.1.0/tests/test_release_benchmarks.py +60 -0
  131. assemblytrace-1.1.0/tests/test_repeat_normalization_v060.py +42 -0
  132. assemblytrace-1.1.0/tests/test_replay_attribution.py +254 -0
  133. assemblytrace-1.1.0/tests/test_report_bundle_safety.py +111 -0
  134. assemblytrace-1.1.0/tests/test_report_html.py +144 -0
  135. assemblytrace-1.1.0/tests/test_review_regressions.py +97 -0
  136. assemblytrace-1.1.0/tests/test_scan_runner.py +260 -0
  137. assemblytrace-1.1.0/tests/test_sdist_metadata.py +15 -0
  138. assemblytrace-1.1.0/tests/test_seqcol_compliance.py +42 -0
  139. assemblytrace-1.1.0/tests/test_sequence_audit_repairs.py +169 -0
  140. assemblytrace-1.1.0/tests/test_sketch_scoring_repairs.py +58 -0
  141. assemblytrace-1.1.0/tests/test_sparsediff_rebuild.py +126 -0
  142. assemblytrace-1.1.0/tests/test_v040.py +66 -0
  143. assemblytrace-1.1.0/tests/test_validation_repairs.py +43 -0
  144. assemblytrace-1.1.0/tests/test_whole_genome_benchmark.py +46 -0
  145. assemblytrace-1.1.0/tests/test_whole_genome_paf_fixture.py +25 -0
  146. assemblytrace-1.1.0/validation/__init__.py +0 -0
  147. assemblytrace-1.1.0/validation/attribution_ablation.py +127 -0
  148. assemblytrace-1.1.0/validation/attribution_benchmark.py +169 -0
  149. assemblytrace-1.1.0/validation/attribution_real.py +140 -0
  150. assemblytrace-1.1.0/validation/benchmark_bouras_full.py +323 -0
  151. assemblytrace-1.1.0/validation/benchmark_discovery.py +236 -0
  152. assemblytrace-1.1.0/validation/census_fetch.py +82 -0
  153. assemblytrace-1.1.0/validation/census_select.py +83 -0
  154. assemblytrace-1.1.0/validation/census_summary.py +128 -0
  155. assemblytrace-1.1.0/validation/census_verify.py +437 -0
  156. assemblytrace-1.1.0/validation/check_environment_matrix.py +223 -0
  157. assemblytrace-1.1.0/validation/check_sdist_readme.py +186 -0
  158. assemblytrace-1.1.0/validation/continuation_prefix_sha256.json +8 -0
  159. assemblytrace-1.1.0/validation/data/NA12892_excerpt.sam +6 -0
  160. assemblytrace-1.1.0/validation/diff_compare.py +118 -0
  161. assemblytrace-1.1.0/validation/draft_lift_compare.py +202 -0
  162. assemblytrace-1.1.0/validation/external/README.md +23 -0
  163. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/NC_000913.3_thrL.faa +2 -0
  164. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/NC_000913.3_thrL.fasta +2 -0
  165. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/missing_parent.gff3 +3 -0
  166. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/original.gff3 +3 -0
  167. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/out_of_bounds.gff3 +3 -0
  168. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/strand_mismatch.gff3 +3 -0
  169. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/thrL.gff3 +3 -0
  170. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/unknown_contig.gff3 +3 -0
  171. assemblytrace-1.1.0/validation/external_20261008/fixtures/RefSeq_NC_000913.3_thrL/validation.json +68 -0
  172. assemblytrace-1.1.0/validation/external_20261008/fixtures/SRR26899115_real_subset.sam.gz +0 -0
  173. assemblytrace-1.1.0/validation/external_20261008/fixtures/real_snv_variants.json +1 -0
  174. assemblytrace-1.1.0/validation/extract_medaka_subset.py +18 -0
  175. assemblytrace-1.1.0/validation/fetch_continuation_reads.py +37 -0
  176. assemblytrace-1.1.0/validation/fetch_public_medaka.py +39 -0
  177. assemblytrace-1.1.0/validation/figures.py +62 -0
  178. assemblytrace-1.1.0/validation/final_euk_20261014/scripts/check_negative_controls.py +98 -0
  179. assemblytrace-1.1.0/validation/final_euk_20261014/scripts/fetch_reference.py +57 -0
  180. assemblytrace-1.1.0/validation/final_euk_20261014/scripts/independent_check.py +259 -0
  181. assemblytrace-1.1.0/validation/final_euk_20261014/scripts/write_manifest.py +39 -0
  182. assemblytrace-1.1.0/validation/frame_background.py +94 -0
  183. assemblytrace-1.1.0/validation/gatk_refcompat.py +74 -0
  184. assemblytrace-1.1.0/validation/hg002_compare.py +192 -0
  185. assemblytrace-1.1.0/validation/independent_pseudoterranova_v061.py +45 -0
  186. assemblytrace-1.1.0/validation/lineage_content.py +136 -0
  187. assemblytrace-1.1.0/validation/lineage_eval.py +63 -0
  188. assemblytrace-1.1.0/validation/make_example_project.py +189 -0
  189. assemblytrace-1.1.0/validation/prepare_continuation_alignments.py +110 -0
  190. assemblytrace-1.1.0/validation/publication_tables.py +628 -0
  191. assemblytrace-1.1.0/validation/published_truth/SOURCE_MANIFEST.tsv +9 -0
  192. assemblytrace-1.1.0/validation/published_truth/ont_errors_aligned.tsv +31 -0
  193. assemblytrace-1.1.0/validation/recovery_artifact_audit.py +113 -0
  194. assemblytrace-1.1.0/validation/refseq_oracle.py +71 -0
  195. assemblytrace-1.1.0/validation/replay_attribution.py +278 -0
  196. assemblytrace-1.1.0/validation/results_v050/whole_genome_alignment.paf +16 -0
  197. assemblytrace-1.1.0/validation/results_v050/whole_genome_bouras_summary.json +33 -0
  198. assemblytrace-1.1.0/validation/review_practical_20261016.py +108 -0
  199. assemblytrace-1.1.0/validation/run_recovery.py +33 -0
  200. assemblytrace-1.1.0/validation/run_release_acceptance.py +345 -0
  201. assemblytrace-1.1.0/validation/scan_runner.py +243 -0
  202. assemblytrace-1.1.0/validation/synthetic_attribution.py +315 -0
  203. assemblytrace-1.1.0/validation/synthetic_lift_compare.py +111 -0
  204. assemblytrace-1.1.0/validation/synthetic_lineage.py +173 -0
  205. assemblytrace-1.1.0/validation/synthetic_suite.py +648 -0
  206. assemblytrace-1.1.0/validation/validate_clean_install.py +47 -0
  207. assemblytrace-1.1.0/validation/validate_independent_alignment_pipeline.py +63 -0
  208. assemblytrace-1.1.0/validation/validate_medaka_change_example.py +60 -0
  209. assemblytrace-1.1.0/validation/validate_project_acceptance.py +377 -0
  210. assemblytrace-1.1.0/validation/validate_published_truth_windows.py +106 -0
  211. assemblytrace-1.1.0/validation/validate_real.py +155 -0
  212. assemblytrace-1.1.0/validation/validate_refseq_full_v060.py +76 -0
  213. assemblytrace-1.1.0/validation/validate_release_benchmarks.py +203 -0
@@ -0,0 +1,129 @@
1
+ # 1.1.0 — clearer HTML report (2026-11-30)
2
+
3
+ - The `report.html` written by `assemblytrace scan` is rewritten for readers who do not program. It opens with the result (PASS, REVIEW or FAIL), its meaning in one sentence and the next steps to take, followed by key counts.
4
+ - Findings are grouped into problems, points to review and notes, and each comes with a suggested action, for example declaring the release with `--latest`.
5
+ - A table of assembly versions gives the file names, total length, number of sequences, a shortened seqcol digest with the full value, and which version is taken as the latest and why.
6
+ - Differences between versions are summarised per pair in plain words (substitutions, insertions, deletions, identical contigs, contigs not compared).
7
+ - A table of files gives each file's type, version (or undecided), strength of evidence, status and a short reason. Status colours carry text labels and border styles that remain distinguishable in greyscale.
8
+ - A collapsible provenance section gives the run id, creation time (UTC), tool version and source hash, the command line and the SHA-256 of the input files; a glossary explains every status word used.
9
+ - The probability matrix, content-class resolution, inventory, integrity, reference indexes, raw reads, declared versus observed provenance, derivation chains, stages per version and evidence per file remain under Technical details.
10
+ - The page stays one self-contained file: inline CSS, no scripts, fonts or network resources, `<details>` for collapsing, print styles, light and dark colour schemes, scrollable tables on small screens. Every value from the project is HTML-escaped.
11
+ - Severities and actions come from the same logic that writes the verdict (`project.assess`); `scan.json`, the TSV files, the other outputs, the CLI options and the exit codes are unchanged. `run_project` takes an optional `command`, shown in the report only.
12
+ - New tests cover the report sections, escaping of hostile file names, the run identity and the absence of external resources.
13
+
14
+ # 1.0.1 — audited repair (2026-11-11)
15
+
16
+ Baseline: freeze-12, upstream commit `8b50b8e1f457768dc3528853daefefdbe45ecd9e`.
17
+
18
+ - Separate likelihood-ratio Bayes factors from posterior odds and report version and content-class resolution independently. Equivalent copies cannot manufacture confident attribution.
19
+ - Reject incomplete integrity verification as full success; validate known FASTA extensions and duplicate coordinate identifiers; refresh sequence data across public API calls.
20
+ - Protect inputs from all static and dynamic export paths, and preserve directed PROV edges, relation labels and insertion/deletion counts in either pair order.
21
+ - Produce a controlled report when no candidate assembly exists. Publish an explicit incomplete marker before exports and the completed compact summary last.
22
+ - Add exact local-matching and crosswalk optimizations, checked against independent implementations. Component timing improvements do not establish that every large-project timeout is resolved.
23
+ - Repair tri-state independent verification, including malformed or unreadable reference discovery. Record execution status separately from the audit verdict.
24
+ - Add immutable-input benchmark replay, source/environment/run identities, complete cohort accounting and publication tables with distinct truth strata and whole-unit uncertainty.
25
+ - Version the repair as 1.0.1, preserve byte-pinned fixtures across platforms, and identify historical results separately from new regression evaluation.
26
+
27
+ The final Linux application/validation suite passed all 681 tests with unchanged
28
+ source bytes during execution. Full-corpus validation has a separate run record;
29
+ historical freeze-12 results are not presented as measurements of repaired code.
30
+
31
+ # Historical changes (freezes 3 to 12, 2026-11-01 to 2026-11-08)
32
+
33
+ Scope reduced to versions, exact differences, attribution of files, exact lift
34
+ and provenance records: the read-based judge of changes (`judge`, ledger,
35
+ reconciled sequence, copy-number model, impact classes, gene history,
36
+ `read-evidence`) is removed; tag `v0.9-with-judge` keeps it.
37
+
38
+ - `diff`: rotated and reverse-complemented contigs are oriented before the walk and the orientation is stored with the pair; exact inversions are one event marked `inversion`; an anchorless remainder before the common suffix is one replacement instead of an unresolved contig, unless it is most of the contig; pairings by name, unique length or elimination that the diff contradicts are repaired by k-mer containment.
39
+ - `lift`: follows orientations (features change strand on a reversed contig, spans across a rotated origin are unmapped) and mirrors features inside exact inversions (`at_lift=inverted`); changed CDS are marked `at_orf=intact` or `at_orf=broken`.
40
+ - Attribution: proteins, CDS and protein MD5s are compared with what each version encodes through gene models moved into each version; gene models from Prodigal headers or from the GFF that reproduces the sequences; initiator codons read as methionine; a confident label needs content evidence (layout-only files are capped at substantial, with `basis` and `capped_from` in the record); MD tags read for every BAM; VCF records at changed sites always checked; fit samples away from changed sites; M5 and sequence digests as their own group.
41
+ - `diff` (freeze 7): contigs merged, split or moved between versions are diffed through frames, blocks of the earlier version between 40-mer anchors unique in both versions joined in the order a contig of the later version holds them; rotated and reversed contigs are frames too, stored with the pair as `frames` (replacing `transforms`).
42
+ - `lift` (freeze 7): moves records through frames (a merged contig's features land on the scaffold, a split contig's on each part; spans across a block end are unmapped, and so is a CDS whose segments land on different contigs); `lift_pair` lifts from a stored pair; curation BED tracks are on each version's own contigs and the changes VCF states the blocks of each frame.
43
+ - Attribution (freeze 8): the numbering of a protein file's gene models is chosen on every gene when versions tie on the sample; a protein that fits no listed version counts at an error of 1e-5 (set on development data), so files of a missing version of the same layout are reported inconsistent with every version.
44
+ - pysam is a dependency except on Windows.
45
+ - Attribution (freeze 12, from the census pilot): GFF reading frames as published annotations write them: CDS segments grouped by transcript when each exon's CDS has its own ID (AUGUSTUS, BRAKER); a phase column holding the frame on the contig (RAST) read from the first base; a stop split by an intron does not break a model; code 4 or 6 when most models open only under it, or `transl_table`; models over ambiguous bases or of no whole number of codons are no observation; the fit of models away from changed sites (`cds_fit`) is judged against every model checked at an item error of 0.002 instead of counting only broken ones; `##sequence-region` lines are lower bounds when one does not start at 1 (TriTrypDB). `validation/frame_background.py` measures the background rate.
46
+ - Lineage (freeze 11): a parent is taken only from records or the declared release, no longer from a spanning tree over sequence differences (polished siblings are closer to each other than to their source); shell scripts are read with assignments, arithmetic, `basename`/`dirname`, `for` loops and globs spelled out, a step through files outside the project (a work directory copied into it) is followed, and a version recorded as made from reads alone is a root; where nothing records a source the versions it can have been made from are listed (`parent_candidates`, from contig names, dropped contigs and the header marks of Polypolish and Racon), and a recorded parent that the layout rules out is reported; FASTA header descriptions are kept in the descriptor (`DESCRIPTOR_VERSION` 6). `latest_status` is declared, recorded, single or ambiguous.
47
+ - Attribution (freeze 10): a CDS whose length is not a multiple of three (a Liftoff model carried onto a draft through an indel) is translated to its last complete codon before the comparison with the protein file, as gffread writes it, and a gene with an ambiguous base is no observation; `DESCRIPTOR_VERSION` is 5, so descriptors cached by earlier builds (QUAST transposed misassembly reports split into one artefact per column) are recomputed.
48
+ - Attribution (freeze 9): a `.` in a protein FASTA is a stop codon (gffread `-y` writes it), so protein files made by gffread from spliced gene models are read instead of raising an error; GFFs of protein-to-genome alignments (a `Target=` attribute: miniprot, compleasm, spaln, exonerate) give no reading-frame evidence, as Liftoff and LiftOn models already did; a QUAST transposed report is recognised by its metric columns, so `transposed_report_misassemblies.tsv` is one file rather than one artefact per column.
49
+ - `diff` (freeze 7): the bases a draft assembler repeats at the ends of two contigs are shared by their blocks, so features in them lift from and to either contig.
50
+ - `diff` (freeze 7): a re-aligned cluster is kept only when the alignment matches at least 80% of its span (unrelated sequence stays one replacement).
51
+ - Validation (freeze 11): `synthetic_lineage.py` (projects of known lineage with each polisher's header and layout behaviour, left-out versions and shuffled file times), `lineage_eval.py`, and `lineage_content.py` (haplotype windows over all versions, behind the finding that sequence similarity does not give lineage).
52
+ - Validation: `synthetic_suite.py` (32 diff and lift hard cases, eight of them for merged, split and moved contigs, with a truth that follows a split contig into each part); `draft_lift_compare.py` (genes lifted between a SPAdes draft and the closed genome by AssemblyTrace, Liftoff and LiftOn, scored by the exact occurrence of each gene in the target); and `synthetic_attribution.py` (10 attribution hard cases); `diff_compare.py` rebuilds through orientations and renamed contigs; `attribution_real.py` separates undecided files whose set covers the true version.
53
+
54
+ # 1.0.0, project layer (2026-11)
55
+
56
+ New in this build: the project layer. One command, `assemblytrace scan`,
57
+ identifies the assembly versions in a directory, diffs them, attributes every
58
+ other artefact to a version and records the project in standard provenance
59
+ formats.
60
+
61
+ - GA4GH refget seqcol digests (`seqcol`), passing the GA4GH compliance vectors; comparisons in the specification's form.
62
+ - Alignment-free diff of near-identical assemblies with left-aligned events (`diff`).
63
+ - Attribution of alignments (names, lengths, M5, @PG, MD tags at shared coordinates and over sampled reads), VCF, GFF3/GTF, proteins, BUSCO, compleasm, QUAST, BED, PAF and AGP, with bounded evidence groups, Bayes factors, goodness of fit (`inconsistent_with_every_version`, `matches_no_version`) and `conflicting_evidence`; raw reads are not version-bound.
64
+ - Project control: workflow records (scripts, logs, header command lines, Snakemake metadata) checked against content, derivation links attributed jointly with break detection, file integrity, stale reference indexes, read pairs and QC reports, stage coverage; lineage from a declared release, recorded edges or inference, with its basis reported.
65
+ - `judge`: reads judge every change between versions with tract-exact k-mer panels, template counting, internal controls, beta-binomial errors per context, tract length and direction, four hypotheses (old, new, both, a third allele) fitted by EM, accurate sources alone at tract indels, a copy-number model for changes inside repeats, and an exact ledger of errors fixed and introduced with bounds for unjudged changes; mates joined with `--reads R1,R2`; `--reconcile` writes the assembly the reads support.
66
+ - Curation files per transition: the changes as VCF (FILTER from the call, posteriors in INFO; for `bcftools consensus` or Merfin), the reverts as VCF, BED tracks coloured by call and an IGV batch script.
67
+ - `diff`: edits that touch after left alignment, with an empty side, are one event, and left alignment never crosses the previous event, so reverting the events always rebuilds the first version (two deletions sharing one anchor in B had an undefined order).
68
+ - Ledger call bounds, which hold whenever confident calls are right, beside the posterior intervals.
69
+ - `lift`: exact GFF3/GTF, BED12 and VCF transfer between versions (whole-CDS unmapping, recomputed phases, INFO/END); `history`: consequence of every round for every CDS.
70
+ - Impact classes per transition for annotated CDS.
71
+ - Outputs: self-contained HTML report, PROV-JSON, detached RO-Crate 1.2 with a Process Run Crate action, lockfile with `verify` (new and drifted files fail).
72
+ - VCF accepted by `normalize-indels` and `read-evidence`, with BGZF detected by content.
73
+ - Linux, macOS and Windows in the CI matrix; `pysam` optional.
74
+ - Benchmarks: judging by stratum against planted correct, wrong, both-allele and third-allele changes with systematic ONT errors, and attribution with negative controls (`validation/judge_benchmark.py`); real polishing rounds against curated truth with Merfin side by side (`validation/truth_benchmark.py`); example project with a hidden truth (`validation/make_example_project.py`).
75
+
76
+ Earlier 1.0.0 builds (2026-10-15 and 2026-10-16) added input protection, atomic
77
+ publication, component-level audit records, repeat-example packaging and the
78
+ corrections of zero-record FASTA handling and terminal STOP normalisation; their
79
+ dated acceptance reports remain valid for those builds.
80
+ # 0.6.2 — 2026-10-14
81
+
82
+ - Require explicit CRAM references and reject missing CRAM EOF containers.
83
+ - Reject missing BAM/BGZF EOF markers in fallback and preflight paths.
84
+ - Account explicitly for CDS groups without protein mappings.
85
+ - Correct a test fixture that accidentally recompressed BAM as plain gzip.
86
+ - Add real codec/CLI, corrupt-input and version-specific EOF tests.
87
+ - Include small fixtures and validation imports in source distributions.
88
+ - Add retained public ONT/Illumina counting validation and full yeast annotation checks; synchronize documentation with demonstrated scope.
89
+
90
+ ## 0.6.1 (2026-10-12)
91
+
92
+ - Fixed GFF3 `Parent` attribute parsing when an identifier contains a percent-encoded comma (`%2C`). List separators are now recognized before percent-decoding, preventing false `MISSING_PARENT` errors.
93
+ - Added independent validation of authentic public ONT FASTQ (634 bp), Medaka consensus BAM (25 alignments, 7 zero-length query records), and 14 Illumina alignments from SRR26899115, with pinned SHA-256 values.
94
+ - Re-ran Identity Engine on three real *Pseudoterranova decipiens* assemblies and independently verified results with Biopython/BLAKE2b-256.
95
+ - Audited historical BUSCO JSON against two assemblies: no authenticated input fingerprint or comparable metrics, correctly reported as `unknown` rather than proof of consistency.
96
+ - No new claim of biological ONT read-level sensitivity, full RefSeq integration, or CRAM CLI validation.
97
+ - Public Medaka fixtures are deliberately excluded from the redistributable source release due to their separate upstream license; download with `validation/fetch_public_medaka.py`.
98
+
99
+ ## 0.6.0 (2026-10-12)
100
+
101
+ - Reference-normalized INS/DEL alleles across repeat-shifted CIGAR placements, with explicit 4096-shift fail-closed behavior and a new `normalize-indels` command.
102
+ - NCBI translation tables and valid alternative initiation codons in protein concordance; special translation exceptions and incomplete CDS are explicitly not evaluable.
103
+ - Safely skip real zero-query-length BAM alignments instead of terminating evidence analysis; count these as unusable data.
104
+ - Release Guardian warns when protein concordance is only partially evaluable.
105
+ - Added independent small-haplotype normalization oracle, public authentic ONT-read semi-synthetic SAM/BAM checks, and real Illumina SAM independent oracle.
106
+ - Added full RefSeq integration workflow (requires network and is not claimed as executed in this release environment).
107
+
108
+ # Changelog
109
+
110
+ ## 0.5.0 — 2026-10-08
111
+
112
+ - Added reproducible validation of published biological error windows with independent Biopython alignment and 31 negative controls.
113
+ - Added 160-window semi-synthetic challenge from authentic *Pseudoterranova decipiens* genome sequences (40 SNV, 40 INS, 40 DEL, 40 unchanged).
114
+ - Added a conservative, bounded, independent whole-genome comparison benchmark for nine published ONT-only versus curated bacterial genomes (31,261,168 bp; 32 events; 37 changed bases).
115
+ - Validated AssemblyTrace's PAF event extraction on the independently generated full-genome alignment representation (32/32).
116
+ - Rechecked identity on actual *Pseudoterranova* assembly versions (5,934 and 5,901 exact matches in two distinct comparisons).
117
+ - Added external pysam SAM/BAM/CRAM round-trip validation record (4/4 alignment records; library-level, not full AssemblyTrace CRAM integration).
118
+ - Prepared JOSS-format manuscript, verified bibliography, source hashes, and scientific validation dossier.
119
+ - Added ten regression tests for the external benchmark utilities; core functional modules otherwise preserved.
120
+
121
+ ### Scope warning
122
+
123
+ This release is not a validated universal polishing caller. PAF extraction depends on supplied alignment quality. No matched project-specific ONT/Illumina BAMs were publicly accessible; CRAM CLI integration and general biological sensitivity remain open.
124
+
125
+ ## External validation addendum — 2026-10-08 (software code remains 0.5.1)
126
+
127
+ - Two public *Campylobacter* ONT-only assemblies were polished with independently subsampled 5x and 25x Illumina reads using Polypolish 0.7.1.
128
+ - Independent whole-genome comparisons, public RefSeq annotation checks, refget/SeqKit functional comparisons, and two real-read/real-gene AssemblyTrace CLI integration tests were added.
129
+ - No new software capability is claimed. Full BAM/CRAM/ONT biological validation and indel normalization remain open.
@@ -0,0 +1,19 @@
1
+ cff-version: 1.2.0
2
+ message: "Cite the archived software release DOI when available."
3
+ title: "AssemblyTrace"
4
+ type: software
5
+ authors:
6
+ - family-names: Kochanowski
7
+ given-names: Maciej
8
+ orcid: https://orcid.org/0000-0002-9982-3028
9
+ affiliation: "Department of Bacteriology and Bacterial Animal Diseases, National Veterinary Research Institute, 57 Partyzantów Avenue, 24-100 Puławy, Poland"
10
+ version: 1.1.0
11
+ date-released: 2026-11-30
12
+ license: MIT
13
+ repository-code: https://github.com/maciejkochanowski/AssemblyTrace
14
+ keywords:
15
+ - genome assembly
16
+ - provenance
17
+ - refget sequence collections
18
+ - RO-Crate
19
+ - polishing
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Maciej Kochanowski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ include README.md LICENSE CITATION.cff CHANGELOG.md
2
+ recursive-include docs *.md *.tsv *.json
3
+ recursive-include examples *.fa *.fasta *.gff3 *.faa *.sam *.paf *.txt *.tsv *.json *.md
4
+ recursive-include tests *.py
5
+ include validation/*.py
6
+ recursive-include validation/final_euk_20261014/scripts *.py
7
+ include validation/continuation_prefix_sha256.json
8
+ recursive-include validation/data *.sam
9
+ recursive-include validation/published_truth *.tsv
10
+ recursive-include validation/external_20261008/fixtures *.json *.sam.gz *.gff3 *.fasta *.faa
11
+ include validation/results_v050/whole_genome_alignment.paf
12
+ include validation/results_v050/whole_genome_bouras_summary.json
13
+ include validation/external/README.md
@@ -0,0 +1,198 @@
1
+ Metadata-Version: 2.4
2
+ Name: assemblytrace
3
+ Version: 1.1.0
4
+ Summary: Assembly-version compatibility, seqcol identity, reconstructable differences, annotation transfer, PROV and RO-Crate exports
5
+ Author-email: Maciej Kochanowski <maciej.kochanowski@piwet.pulawy.pl>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/maciejkochanowski/AssemblyTrace
8
+ Project-URL: Issues, https://github.com/maciejkochanowski/AssemblyTrace/issues
9
+ Keywords: bioinformatics,genome assembly,provenance,refget,seqcol,RO-Crate,PROV,FASTA,GFF3,annotation lift
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
16
+ Classifier: Operating System :: OS Independent
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: biopython<2,>=1.81
21
+ Requires-Dist: pysam>=0.22; platform_system != "Windows"
22
+ Provides-Extra: bam
23
+ Requires-Dist: pysam>=0.22; extra == "bam"
24
+ Provides-Extra: validation
25
+ Requires-Dist: biopython>=1.81; extra == "validation"
26
+ Requires-Dist: scipy>=1.10; extra == "validation"
27
+ Requires-Dist: requests>=2.28; extra == "validation"
28
+ Requires-Dist: matplotlib>=3.7; extra == "validation"
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest>=8; extra == "test"
31
+ Requires-Dist: coverage>=7; extra == "test"
32
+ Dynamic: license-file
33
+
34
+ # AssemblyTrace
35
+
36
+ A genome project accumulates assembly versions (a draft, polishing rounds,
37
+ curated and renamed copies for submission) and a directory of files made from
38
+ one of them. Their metadata can be missing or inconsistent. AssemblyTrace
39
+ examines the files to answer:
40
+
41
+ 1. **Which versions does the project hold, and how exactly do they differ?**
42
+ Every FASTA receives GA4GH refget sequence-collection digests; versions are
43
+ diffed without an external aligner, and events from resolved comparisons
44
+ rebuild the target sequence exactly.
45
+ 2. **Which versions are consistent with each file?** Annotations, proteins,
46
+ alignments, variant calls and QC reports are assessed from reference-bound
47
+ evidence, with separate likelihood ratios and posterior probabilities.
48
+ Files incompatible with every candidate are flagged; insufficient evidence
49
+ remains unresolved.
50
+ 3. **Where does an annotation go in another version?** GFF3/GTF, BED and VCF
51
+ records are moved exactly through the events of the pair.
52
+
53
+ Install from PyPI, or from a source checkout or unpacked source archive
54
+ (`python -m pip install .`):
55
+
56
+ ```bash
57
+ python -m pip install assemblytrace
58
+ assemblytrace --version
59
+ assemblytrace scan /path/to/project --out-dir audit
60
+ ```
61
+
62
+ The package version is `1.1.0`; the source commit and distribution hashes
63
+ identify the evaluated build. Installing an unpinned package from a public
64
+ index does not select this checkout.
65
+
66
+ Linux, macOS and Windows, Python 3.10 or newer; Biopython and, except on
67
+ Windows, pysam (MD tags of indexed BAM) are the dependencies.
68
+
69
+ ## Use it in your browser
70
+
71
+ <https://maciejkochanowski.github.io/AssemblyTrace/> runs `scan` and `diff`
72
+ without installing anything: choose a project folder, several files or two
73
+ FASTA files, or try the bundled example, and download the report and all
74
+ outputs as a ZIP. Your files are read inside the browser tab by Python
75
+ compiled to WebAssembly (Pyodide) and are never uploaded. Browser memory
76
+ limits the data size, so use the command-line tool for large genomes. The page
77
+ lives in `web/` and is published by `.github/workflows/pages.yml`.
78
+
79
+ ## Commands
80
+
81
+ | Command | What it does |
82
+ |---|---|
83
+ | `scan PROJECT --out-dir DIR` | versions, their differences, attribution of every file, provenance records, HTML report |
84
+ | `diff A.fa B.fa` | alignment-free events between two versions of one assembly |
85
+ | `lift FILE --from A.fa --to B.fa --output OUT` | exact transfer of GFF3/GTF, BED or VCF coordinates between versions |
86
+ | `seqcol A.fa` | GA4GH refget sequence-collection digests |
87
+ | `verify PROJECT --lock FILE` | verify pinned files; exit 2 on drift, unreadable content or incomplete verification |
88
+ | `identity`, `annotation`, `release-check`, `changes`, `paf-changes`, `normalize-indels`, `snapshot`, `capture-run`, `resolve` | single-artefact checks and provenance manifests |
89
+
90
+ ## How it works
91
+
92
+ **Versions.** Every FASTA receives refget seqcol digests (identical to the
93
+ GA4GH reference implementation). Files with the same digest are one version;
94
+ files with the same sequences under other names form one content class. The
95
+ lineage of versions is taken from workflow records (shell scripts are read
96
+ with their variables and loops spelled out) or from the release you declare;
97
+ it is not guessed from sequence similarity, which places polished siblings
98
+ closer to each other than to their source. Where no record names a version's
99
+ source, the versions it can have been made from are listed.
100
+
101
+ **Differences.** Paired contigs are diffed by an anchored walk that
102
+ resynchronises on exact 40-mers; indels are left-aligned, and in tandem
103
+ arrays the anchor with the longest exact match is preferred so a unit
104
+ inserted in a satellite stays one event. A stretch with no shared anchor
105
+ within 128 kb (a rebuilt rDNA array, a large insertion) becomes one
106
+ replacement event, and the walk continues behind it; an exact inversion is
107
+ one event. A contig rotated to a new start or reverse complemented (a circular
108
+ replicon reoriented to dnaA) is oriented before the walk, contigs whose
109
+ names were swapped or reused are paired by content, and contigs merged, split
110
+ or moved between versions (scaffolding, a closed genome made from a draft) are
111
+ diffed through frames: blocks of the earlier version, between anchors unique
112
+ in both versions, joined in the order the later contig holds them. The events turn one
113
+ version into the other exactly; `curation/` holds them as VCF, ready for
114
+ `bcftools consensus`, and as BED tracks.
115
+
116
+ **Attribution.** Reads carry the sample's alleles whichever version they were
117
+ aligned to, so read sequences never decide provenance. The evidence is
118
+ reference-bound: @SQ names, lengths and M5 digests, @PG command lines,
119
+ reference bases implied by MD tags, VCF REF alleles, proteins against what
120
+ each version encodes (gene models moved exactly into every version), CDS
121
+ reading frames and QC statistics. Evidence comes in groups whose weight is
122
+ bounded (one header stated a thousand times is still one header). Version
123
+ selection and Bayes factors use likelihoods; posterior probabilities use an
124
+ equal prior mass for each content class, split among its versions. A difference
125
+ in prior mass is not evidence, and identical likelihoods stay undecided.
126
+ Content-class resolution is reported separately: the sequence content may be
127
+ resolved while its renamed versions remain indistinguishable. All probabilities
128
+ are conditional on the listed candidates and the model. Incompatible or
129
+ conflicting evidence is reported explicitly. Names, lengths and statistics fit any version of the same layout,
130
+ listed or not, so an attribution resting on them alone is never reported as
131
+ confident. Workflow records (scripts, job logs, command lines in headers,
132
+ Snakemake metadata) are checked against the content, and files linked by a
133
+ derivation are attributed jointly, so a regenerated file that broke a chain
134
+ is found.
135
+
136
+ **Lift.** Coordinates move through the events of the pair, so a feature lands
137
+ exactly where its sequence went; a feature an event touches is marked (a CDS
138
+ also with the state of its reading frame in the target), a feature inside an
139
+ exact inversion is mirrored onto the other strand, and one whose end falls in
140
+ a deleted span is reported unmapped.
141
+
142
+ **Outputs.** `report.html` (the result in plain language with what to do
143
+ next, the versions, the version of every file and the provenance of the run;
144
+ self-contained, no network access), `scan.json`, `attribution.tsv`, `events.tsv`,
145
+ `claims.tsv`, `inventory.tsv`, per lineage transition in `curation/` the
146
+ changes as VCF and BED, `prov.json` (W3C PROV-JSON),
147
+ `assemblytrace-ro-crate-metadata.json` (a detached RO-Crate 1.2 with a
148
+ Process Run Crate action) and `assemblytrace.lock.json`. A compact
149
+ `scan-summary.json` records completion independently of the audit verdict.
150
+ After path-safety checks, an incomplete marker is written before any export
151
+ is replaced; the completed record is published last. A completed scan can
152
+ correctly return `fail` and exit 2.
153
+
154
+ **Integrity.** `verify` reports `pass` only when every pinned entry can be
155
+ verified and no drift is found. Damaged or unreadable pinned content gives
156
+ `fail`; an entry without a pinned digest gives `partial` unless another
157
+ failure is present. Both `fail` and `partial` exit with code 2. The `coverage`
158
+ fields show how many pinned entries were verified. A project without an
159
+ assembly produces a controlled report with no candidate versions. Coordinate
160
+ operations reject duplicate contig identifiers, and output paths are checked
161
+ against inputs before reports and change tracks are written.
162
+
163
+ ## Validation
164
+
165
+ `validation/make_example_project.py` builds a small project that the test
166
+ suite scans end to end. `validation/attribution_benchmark.py` scores
167
+ attribution on a real genome with negative controls;
168
+ `validation/attribution_real.py` scores projects whose files were made by real
169
+ tools from known versions; `validation/diff_compare.py` compares the diff with
170
+ minimap2/paftools and MUMmer dnadiff and checks that each method's changes
171
+ rebuild the later version; `validation/hg002_compare.py` compares diff and
172
+ lift with the official HG002 Q100 patches. The data, the development and
173
+ held-out sets and the results are in `docs/SPECIFICATION.md` and
174
+ `docs/VALIDATION_PROTOCOL.md`. A held-out claim applies to its named frozen
175
+ commit; rerunning a previously inspected dataset after a code change is a
176
+ regression check. File-level percentages describe those files, while
177
+ generalization to new projects requires project-level validation.
178
+
179
+ `validation/publication_tables.py` validates row-level scoring outputs and
180
+ source hashes, reconciles listed, omitted and mixed-origin denominators, and
181
+ writes JSON, CSV and Markdown tables with project/seed summaries. Optional
182
+ confidence intervals resample whole projects or seeds. It can update the
183
+ canonical manuscript's managed blocks from supplied results; the protocol
184
+ contains the reproducible command and interpretation rules.
185
+
186
+ ```bash
187
+ python -m pip install -e '.[test,bam]'
188
+ python -m pytest -q
189
+ ```
190
+
191
+ ## Scope
192
+
193
+ AssemblyTrace does not assemble, map or polish reads, and does not say which
194
+ version is right. Attribution states what the files show; a file without
195
+ informative evidence stays unattributed. See `docs/SPECIFICATION.md` and
196
+ `docs/LIMITATIONS.md`.
197
+
198
+ MIT licence.
@@ -0,0 +1,165 @@
1
+ # AssemblyTrace
2
+
3
+ A genome project accumulates assembly versions (a draft, polishing rounds,
4
+ curated and renamed copies for submission) and a directory of files made from
5
+ one of them. Their metadata can be missing or inconsistent. AssemblyTrace
6
+ examines the files to answer:
7
+
8
+ 1. **Which versions does the project hold, and how exactly do they differ?**
9
+ Every FASTA receives GA4GH refget sequence-collection digests; versions are
10
+ diffed without an external aligner, and events from resolved comparisons
11
+ rebuild the target sequence exactly.
12
+ 2. **Which versions are consistent with each file?** Annotations, proteins,
13
+ alignments, variant calls and QC reports are assessed from reference-bound
14
+ evidence, with separate likelihood ratios and posterior probabilities.
15
+ Files incompatible with every candidate are flagged; insufficient evidence
16
+ remains unresolved.
17
+ 3. **Where does an annotation go in another version?** GFF3/GTF, BED and VCF
18
+ records are moved exactly through the events of the pair.
19
+
20
+ Install from PyPI, or from a source checkout or unpacked source archive
21
+ (`python -m pip install .`):
22
+
23
+ ```bash
24
+ python -m pip install assemblytrace
25
+ assemblytrace --version
26
+ assemblytrace scan /path/to/project --out-dir audit
27
+ ```
28
+
29
+ The package version is `1.1.0`; the source commit and distribution hashes
30
+ identify the evaluated build. Installing an unpinned package from a public
31
+ index does not select this checkout.
32
+
33
+ Linux, macOS and Windows, Python 3.10 or newer; Biopython and, except on
34
+ Windows, pysam (MD tags of indexed BAM) are the dependencies.
35
+
36
+ ## Use it in your browser
37
+
38
+ <https://maciejkochanowski.github.io/AssemblyTrace/> runs `scan` and `diff`
39
+ without installing anything: choose a project folder, several files or two
40
+ FASTA files, or try the bundled example, and download the report and all
41
+ outputs as a ZIP. Your files are read inside the browser tab by Python
42
+ compiled to WebAssembly (Pyodide) and are never uploaded. Browser memory
43
+ limits the data size, so use the command-line tool for large genomes. The page
44
+ lives in `web/` and is published by `.github/workflows/pages.yml`.
45
+
46
+ ## Commands
47
+
48
+ | Command | What it does |
49
+ |---|---|
50
+ | `scan PROJECT --out-dir DIR` | versions, their differences, attribution of every file, provenance records, HTML report |
51
+ | `diff A.fa B.fa` | alignment-free events between two versions of one assembly |
52
+ | `lift FILE --from A.fa --to B.fa --output OUT` | exact transfer of GFF3/GTF, BED or VCF coordinates between versions |
53
+ | `seqcol A.fa` | GA4GH refget sequence-collection digests |
54
+ | `verify PROJECT --lock FILE` | verify pinned files; exit 2 on drift, unreadable content or incomplete verification |
55
+ | `identity`, `annotation`, `release-check`, `changes`, `paf-changes`, `normalize-indels`, `snapshot`, `capture-run`, `resolve` | single-artefact checks and provenance manifests |
56
+
57
+ ## How it works
58
+
59
+ **Versions.** Every FASTA receives refget seqcol digests (identical to the
60
+ GA4GH reference implementation). Files with the same digest are one version;
61
+ files with the same sequences under other names form one content class. The
62
+ lineage of versions is taken from workflow records (shell scripts are read
63
+ with their variables and loops spelled out) or from the release you declare;
64
+ it is not guessed from sequence similarity, which places polished siblings
65
+ closer to each other than to their source. Where no record names a version's
66
+ source, the versions it can have been made from are listed.
67
+
68
+ **Differences.** Paired contigs are diffed by an anchored walk that
69
+ resynchronises on exact 40-mers; indels are left-aligned, and in tandem
70
+ arrays the anchor with the longest exact match is preferred so a unit
71
+ inserted in a satellite stays one event. A stretch with no shared anchor
72
+ within 128 kb (a rebuilt rDNA array, a large insertion) becomes one
73
+ replacement event, and the walk continues behind it; an exact inversion is
74
+ one event. A contig rotated to a new start or reverse complemented (a circular
75
+ replicon reoriented to dnaA) is oriented before the walk, contigs whose
76
+ names were swapped or reused are paired by content, and contigs merged, split
77
+ or moved between versions (scaffolding, a closed genome made from a draft) are
78
+ diffed through frames: blocks of the earlier version, between anchors unique
79
+ in both versions, joined in the order the later contig holds them. The events turn one
80
+ version into the other exactly; `curation/` holds them as VCF, ready for
81
+ `bcftools consensus`, and as BED tracks.
82
+
83
+ **Attribution.** Reads carry the sample's alleles whichever version they were
84
+ aligned to, so read sequences never decide provenance. The evidence is
85
+ reference-bound: @SQ names, lengths and M5 digests, @PG command lines,
86
+ reference bases implied by MD tags, VCF REF alleles, proteins against what
87
+ each version encodes (gene models moved exactly into every version), CDS
88
+ reading frames and QC statistics. Evidence comes in groups whose weight is
89
+ bounded (one header stated a thousand times is still one header). Version
90
+ selection and Bayes factors use likelihoods; posterior probabilities use an
91
+ equal prior mass for each content class, split among its versions. A difference
92
+ in prior mass is not evidence, and identical likelihoods stay undecided.
93
+ Content-class resolution is reported separately: the sequence content may be
94
+ resolved while its renamed versions remain indistinguishable. All probabilities
95
+ are conditional on the listed candidates and the model. Incompatible or
96
+ conflicting evidence is reported explicitly. Names, lengths and statistics fit any version of the same layout,
97
+ listed or not, so an attribution resting on them alone is never reported as
98
+ confident. Workflow records (scripts, job logs, command lines in headers,
99
+ Snakemake metadata) are checked against the content, and files linked by a
100
+ derivation are attributed jointly, so a regenerated file that broke a chain
101
+ is found.
102
+
103
+ **Lift.** Coordinates move through the events of the pair, so a feature lands
104
+ exactly where its sequence went; a feature an event touches is marked (a CDS
105
+ also with the state of its reading frame in the target), a feature inside an
106
+ exact inversion is mirrored onto the other strand, and one whose end falls in
107
+ a deleted span is reported unmapped.
108
+
109
+ **Outputs.** `report.html` (the result in plain language with what to do
110
+ next, the versions, the version of every file and the provenance of the run;
111
+ self-contained, no network access), `scan.json`, `attribution.tsv`, `events.tsv`,
112
+ `claims.tsv`, `inventory.tsv`, per lineage transition in `curation/` the
113
+ changes as VCF and BED, `prov.json` (W3C PROV-JSON),
114
+ `assemblytrace-ro-crate-metadata.json` (a detached RO-Crate 1.2 with a
115
+ Process Run Crate action) and `assemblytrace.lock.json`. A compact
116
+ `scan-summary.json` records completion independently of the audit verdict.
117
+ After path-safety checks, an incomplete marker is written before any export
118
+ is replaced; the completed record is published last. A completed scan can
119
+ correctly return `fail` and exit 2.
120
+
121
+ **Integrity.** `verify` reports `pass` only when every pinned entry can be
122
+ verified and no drift is found. Damaged or unreadable pinned content gives
123
+ `fail`; an entry without a pinned digest gives `partial` unless another
124
+ failure is present. Both `fail` and `partial` exit with code 2. The `coverage`
125
+ fields show how many pinned entries were verified. A project without an
126
+ assembly produces a controlled report with no candidate versions. Coordinate
127
+ operations reject duplicate contig identifiers, and output paths are checked
128
+ against inputs before reports and change tracks are written.
129
+
130
+ ## Validation
131
+
132
+ `validation/make_example_project.py` builds a small project that the test
133
+ suite scans end to end. `validation/attribution_benchmark.py` scores
134
+ attribution on a real genome with negative controls;
135
+ `validation/attribution_real.py` scores projects whose files were made by real
136
+ tools from known versions; `validation/diff_compare.py` compares the diff with
137
+ minimap2/paftools and MUMmer dnadiff and checks that each method's changes
138
+ rebuild the later version; `validation/hg002_compare.py` compares diff and
139
+ lift with the official HG002 Q100 patches. The data, the development and
140
+ held-out sets and the results are in `docs/SPECIFICATION.md` and
141
+ `docs/VALIDATION_PROTOCOL.md`. A held-out claim applies to its named frozen
142
+ commit; rerunning a previously inspected dataset after a code change is a
143
+ regression check. File-level percentages describe those files, while
144
+ generalization to new projects requires project-level validation.
145
+
146
+ `validation/publication_tables.py` validates row-level scoring outputs and
147
+ source hashes, reconciles listed, omitted and mixed-origin denominators, and
148
+ writes JSON, CSV and Markdown tables with project/seed summaries. Optional
149
+ confidence intervals resample whole projects or seeds. It can update the
150
+ canonical manuscript's managed blocks from supplied results; the protocol
151
+ contains the reproducible command and interpretation rules.
152
+
153
+ ```bash
154
+ python -m pip install -e '.[test,bam]'
155
+ python -m pytest -q
156
+ ```
157
+
158
+ ## Scope
159
+
160
+ AssemblyTrace does not assemble, map or polish reads, and does not say which
161
+ version is right. Attribution states what the files show; a file without
162
+ informative evidence stays unattributed. See `docs/SPECIFICATION.md` and
163
+ `docs/LIMITATIONS.md`.
164
+
165
+ MIT licence.
@@ -0,0 +1,57 @@
1
+ # Design
2
+
3
+ AssemblyTrace has two layers. The project layer (`scan`, `diff`, `lift`,
4
+ `seqcol`, `verify`) works on the versions of an assembly and the files made
5
+ from them. The artefact layer keeps the single-file checks of earlier
6
+ releases (`identity`, `annotation`, `changes`, `paf-changes`,
7
+ `normalize-indels`, `release-check`, provenance manifests); their
8
+ contracts are in [SUPPORTED_INPUTS.md](SUPPORTED_INPUTS.md). The methods
9
+ and their parameters are in [SCIENTIFIC_METHODS.md](SCIENTIFIC_METHODS.md).
10
+
11
+ ## Project layer
12
+
13
+ | Module | Responsibility |
14
+ |---|---|
15
+ | `scan.py` | walk the directory, classify files by extension and content, compute descriptors (seqcol digests, per-contig MD5, header names, lengths, M5 and @PG lines, QC statistics), cache them by content under `.assemblytrace/cache` |
16
+ | `seqcol.py` | GA4GH refget seqcol digests, comparison and relation naming |
17
+ | `sparsediff.py` | alignment-free diff of versions of one assembly, left-aligned events, replaced stretches, liftover, reversal of an event list |
18
+ | `versions.py` | group FASTA files into versions, pair contigs across versions, diff every pair, infer the lineage (declared, recorded, inferred) |
19
+ | `attribute.py` | reference-bound evidence per artefact, grouped and bounded, with goodness of fit |
20
+ | `claims.py` | commands from workflow records, declared versus observed provenance, derivation links and their joint attribution |
21
+ | `inventory.py` | integrity of every file, stage coverage per version, reference indexes against the FASTA beside them |
22
+ | `curation.py` | VCF of the changes and BED tracks per transition |
23
+ | `lift.py` | exact transfer of GFF3/GTF, BED and VCF between versions |
24
+ | `prov.py` | W3C PROV-JSON, detached RO-Crate 1.2 with a Process Run Crate action, lockfile and `verify` |
25
+ | `report.py` | self-contained HTML report |
26
+ | `project.py` | the driver: scan, graph, attribution, change tracks, control, verdict, outputs |
27
+
28
+ ## Evidence
29
+
30
+ Provenance (which version a file was made from) is answered only from
31
+ evidence that depends on the reference: headers, coordinates, REF alleles,
32
+ translated proteins and statistics. Sequencing reads carry the sample's
33
+ alleles whichever version they were aligned to, so read sequences are never
34
+ scored; an alignment contributes through its header and MD tags.
35
+
36
+ ## Data flow of `scan`
37
+
38
+ 1. Scan and classify files; read descriptors from the cache when unchanged.
39
+ 2. Group assemblies into versions; diff every pair; infer the lineage and the latest version.
40
+ 3. Attribute every version-bound file.
41
+ 4. Write the changes VCF and BED tracks of every lineage transition.
42
+ 5. Check the project's control: file integrity, workflow claims against content, derivation chains, reference indexes, read pairs and QC reports, stage coverage.
43
+ 6. Write the report, tables, PROV-JSON, RO-Crate and lockfile.
44
+
45
+ The verdict concerns provenance and integrity: `fail` when a version-bound
46
+ file decisively belongs to an earlier version than a declared or recorded
47
+ release, a workflow record is contradicted by content, a derivation chain is
48
+ broken, an index serves an older sequence or a file is corrupt; `review` when
49
+ attribution is undecided, missing, inconsistent or conflicting, the latest
50
+ version was only inferred or is ambiguous, or a chain is possibly broken;
51
+ otherwise `pass`.
52
+
53
+ ## Output safety
54
+
55
+ Every command checks that its outputs alias none of its inputs, including
56
+ through links, and publishes files atomically. Multi-file bundles roll back
57
+ on ordinary write errors but are not crash-atomic.
@@ -0,0 +1,10 @@
1
+ # Scope and limitations
2
+
3
+ 1. **Attribution is evidence, not provenance.** A file attributed to a version carries that version's names, lengths, alleles or statistics. Files made from two versions that are identical at every evidence site cannot be separated (a small VCF whose records miss every changed site stays undecided; proteins that every version encodes alike do not choose between versions), a file made from a version that is not in the project is recognised only where its evidence touches a site where that version differs, and nothing proves which program produced a file. Layout alone (names, lengths, QC statistics, intact frames) never gives a confident attribution, because a version that is not listed can share it: a QC report (QUAST, BUSCO) is therefore at most `substantial`, and a QC report of a missing version that matches no listed version stays undecided rather than being flagged.
4
+ GFF files can also contribute content evidence through complete CDS models; their confidence depends on the available evidence and model assumptions, not only on the format extension.
5
+
6
+ 2. **Renamed or reordered copies** of one sequence are separated only by names, M5 tags or file names in headers. The report names them as the same content.
7
+ 3. **Versions of one assembly.** The diff assumes the two FASTA files are versions of one assembly. Rotated and reverse-complemented contigs are oriented before the walk, and an exact inversion is one event; an inversion with changes at its breakpoints, or a stretch with no shared exact 40-mer anchor within 128 kb, becomes one replacement event (marked `stretch`), which still rebuilds the later version exactly but is not resolved into small edits. A rest of a contig without a unique shared anchor is reported unresolved when it is most of the contig. Contigs merged, split or moved between versions (scaffolding, a closed genome from a draft, a broken misassembly) are placed by frames of blocks between anchors unique in both versions; a piece without four such anchors (shorter than a few hundred bases in a bacterial genome, a few kilobases in a 100 Mb one) or made only of copies of a repeat (a repeat contig of a draft) is unmatched, and its features are unmapped, never misplaced. A frame the walk cannot follow to its end is dropped and its contigs keep their one-to-one pairing. A repeat that the later version holds in several copies and the earlier one collapsed into a contig of its own (an rRNA operon, an insertion sequence in a SPAdes draft) has no unique anchor, so features of its copies are not lifted onto the collapsed contig; Liftoff and LiftOn place them there. Where two near-identical copies exist (repeat copies, the two haplotypes of a diploid that a draft assembler kept apart), a feature follows the unique sequence around it to the syntenic copy and is marked `changed_inside` if that copy differs, even when the other copy holds its exact sequence. Different individuals need an aligner (`paf-changes` takes a minimap2 alignment).
8
+ 4. **Lift** moves coordinates exactly but does not re-predict gene models: a feature an event touches is marked `changed_inside` (a CDS also `at_orf=intact` or `broken`), a feature with an end in a deleted or replaced span, or across a block end of a frame (the origin of a rotated contig, the join or break of contigs), is unmapped, and a CDS with any segment unmapped, or with segments on different contigs, is unmapped as a whole. On a reversed contig, VCF indels are unmapped.
9
+ 5. **Platforms.** pysam is installed with AssemblyTrace except on Windows, where it is not available; there alignments are read sequentially and MD-tag evidence is not used, so BAM attributions rest on layout and are not confident. CRAM MD tags are not evaluated, because they are regenerated from whatever reference decodes the file.
10
+ 6. **What it does not do.** AssemblyTrace does not assemble, map, polish or call variants, and it does not judge which version is right at a site.