AssemblyTrace user guide

AssemblyTrace finds the assembly versions of a genome project, shows exactly how they differ, and tells you which version each annotation, alignment, variant call set and QC report was made from. This guide explains how to use it in a web browser, on the command line and from Python, and how to read its report.

This guide describes AssemblyTrace 1.1.0. Every command and every output excerpt below was run on the example data that comes with the source code.

Contents

  1. What AssemblyTrace does
  2. Three ways to use it
  3. Key ideas
  4. Step by step in the browser
  5. Step by step on the command line
  6. How to read the report
  7. Typical scenarios
  8. Outputs reference
  9. Limits and good practice
  10. Troubleshooting and FAQ
  11. How to cite
  12. Acknowledgements

What AssemblyTrace does

A genome project rarely has a single assembly. There is a first draft, one or more polishing rounds, a scaffolded or curated version, and often a copy with renamed contigs made for submission. Around them grows a folder of files made from one version or another: gene annotations, predicted proteins, read alignments, variant calls, QUAST and BUSCO reports. File names and notes do not always say which version a file belongs to, and they are sometimes wrong.

AssemblyTrace reads the files themselves and answers three questions:

  1. Which assembly versions does the project hold, and how exactly do they differ? Every FASTA file gets a checksum of its sequences (a GA4GH seqcol digest), so copies of one version are recognised whatever their file names. Versions are compared without an external aligner, and the differences rebuild one version from the other exactly.
  2. Which version is each file consistent with? Annotations, proteins, alignments, variant calls and QC reports are compared with every version, using evidence that depends on the reference sequence. A file that fits no version is flagged; a file whose evidence cannot separate the versions is reported as undecided.
  3. Where does an annotation go in another version? GFF3, GTF, BED and VCF records can be moved exactly from one version to another.

It is meant for anyone who assembles, polishes, annotates or submits genomes, for sequencing and bioinformatics core facilities that hand over assemblies with their files, and for data stewards or reviewers who need to check that the files deposited together really belong together.

AssemblyTrace does not assemble, map, polish or call variants, and it does not decide which version is biologically right. It states what the files show, and it says so when they do not show enough.

Workflow: a project folder goes through four steps: find the assembly versions with seqcol digests, compare the versions, attribute every file to a version, and write the report, provenance records and lockfile

Figure 1. One scan of a project folder. The same four steps run in the browser and on the command line.

Three ways to use it

Browser Command line Python
Install nothing python -m pip install assemblytrace the same package
Runs scan and diff all commands every command's functions
Best for a first look, small and medium projects, people who do not use a terminal large genomes, pipelines, clusters, declaring the release with --latest, lift, verify notebooks and your own scripts
Data read in the browser tab, never uploaded read from disk read from disk

Browser. Open the browser app. The page runs the unchanged AssemblyTrace package in Python compiled to WebAssembly (Pyodide). Your files are read inside the tab and are never uploaded. The first visit downloads about 20 MB, which the browser keeps for later visits.

Command line. AssemblyTrace needs Python 3.10 or newer and runs on Linux, macOS and Windows. Its dependencies, Biopython and (except on Windows) pysam, are installed with it. A Bioconda package is coming soon.

python -m pip install assemblytrace
assemblytrace --version
assemblytrace 1.1.0

Python. The package that provides the command also provides the functions behind it; see Use AssemblyTrace from Python.

Key ideas

Assembly versions and seqcol digests

AssemblyTrace treats every FASTA file in the project as an assembly and computes its GA4GH refget sequence-collection (seqcol) digest: a short checksum of the contig names, their lengths and their sequences, identical to the GA4GH reference implementation.

You can compute the digest of any FASTA file yourself with assemblytrace seqcol.

Comparing versions

Every pair of versions is compared contig by contig, without minimap2, MUMmer or any other aligner. The result is a list of events: substitutions (SNV), insertions, deletions and replaced stretches. Applied to the earlier version, the events of a resolved comparison give the later version exactly. Contigs that were renamed, rotated, reverse complemented, merged or split are paired by their content first.

For every step of the lineage, a scan also writes the events as a VCF file in the earlier version's coordinates (ready for bcftools consensus) and as BED tracks for both versions.

Attributing files to a version

For every other file AssemblyTrace asks: which version is this file consistent with? It uses only evidence that depends on the reference sequence:

Sequencing reads carry the sample's alleles whichever version they were aligned to, so read sequences are never used as evidence, and raw read files (FASTQ) are listed as not tied to a version.

The strength of an attribution follows Jeffreys' scale of Bayes factors: substantial (at least about 3 to 1), strong (10 to 1), very strong (about 30 to 1) and decisive (100 to 1 or more). Names, lengths and summary numbers fit any version with the same layout, including one that is not in the project, so a file that could only be compared by them is never called more than substantial.

Example project: a draft, a polished version and a renamed submission copy declared as the release; annotation and QUAST report fit the draft, variant calls fit the draft and are a problem, the alignment and proteins fit the release, a small VCF is undecided and the raw reads are not tied to a version

Figure 2. A typical project. Arrows show how the versions were made; lines join each file to the version its content fits. The polished version and the submission copy hold the same sequences, so files that fit one fit the other.

The latest version

Files are checked against the latest version, the one that should be used or submitted. AssemblyTrace takes it, in this order of preference:

  1. from you: the release declared with --latest FILE (command line and Python only);
  2. from the workflow records: the end of the recorded lineage, for example the output of the last polishing command in a script kept in the project;
  3. from the project: the only version, if there is one;
  4. otherwise from file times: the newest file, marked as ambiguous. The report then asks you to declare the release.

The lineage of versions is never guessed from sequence similarity: versions polished side by side from one draft are closer to each other than to their draft, so similarity would mislead.

PASS, REVIEW and FAIL

Every finding of a scan is a problem, a point that needs review, or a note. The result of the whole scan follows from them:

Decision: if any finding is a problem the result is FAIL; otherwise if any finding needs review the result is REVIEW; otherwise PASS. Each card lists what the result means, typical causes, what to do and the exit code

Figure 3. How the result is chosen and what to do about it.

On the command line scan exits with code 0 for PASS and REVIEW and 2 for FAIL; with --fail-on-review a REVIEW exits with 3. A FAIL is a completed scan with a negative result, not a crash: the outputs are all written.

Why undecided is a valid answer

A file is undecided when its evidence fits two or more versions equally well. This is a correct answer, not an error. Two common cases:

AssemblyTrace will not turn a tie into a guess. If you need to know where an undecided file came from, keep the command or log that made it in the project (AssemblyTrace reads them), or re-create the file from the release.

Step by step in the browser

1. Open the page. Go to maciejkochanowski.github.io/AssemblyTrace. Wait until the status line below the page header says Ready: AssemblyTrace 1.1.0 is loaded. The first visit downloads the Python runtime (about 20 MB) from the jsDelivr CDN and AssemblyTrace itself from the site; nothing else is loaded and nothing is sent.

The status line "Ready: AssemblyTrace 1.1.0 is loaded" and the "Audit a project" section: a short description, two file choosers (A project folder, Or individual files) and the buttons "Run the audit" and "Try the example project"

Figure 4. The status line and the "Audit a project" section. Click a box to choose a project folder or individual files; the box then names what was chosen.

2. Try the example project. Click Try the example project. The page scans the small example bundled with AssemblyTrace (three FASTA files and six other files) and shows the verdict, key numbers and findings within a second or two.

Verdict REVIEW, the boxes Assembly versions 3 (latest v3), Files examined 10, Run ID and Time, and the first findings

Figure 5. Result of the example project: REVIEW, with 12 findings (the first four are shown here).

3. Download the results. Download all outputs (ZIP) saves every file that the command-line scan writes; Download report.html saves the report alone. The line below the buttons gives the equivalent command.

Buttons "Download all outputs (ZIP)" and "Download report.html" and the line "13 output files. Equivalent command: assemblytrace scan example_project --out-dir example_project-audit"

Figure 6. Downloads and the equivalent command line.

4. Read the report in the page. Further down, the page shows the report itself. It starts with the result, its meaning in one sentence and the steps to take next, followed by the findings, each with a suggested action. How to read the report explains every part.

Report shown in the page: header with run id, links to the sections, and the Result box REVIEW with "What to do next"

Figure 7. The report in the page. The preview runs without scripts or external content; the downloaded report.html is the same file.

Findings that need review, each with a "What to do" line, for example "Declare the release by running the scan again with --latest FILE"

Figure 8. Findings marked "Needs review", each with what to do.

5. Audit your own project. Under Audit a project, choose a project folder (your browser may ask whether to "upload" its files: that only lets the page read them) or select several files. Then click Run the audit. Every file in the folder and its subfolders is read; FASTA files may be gzipped.

6. Compare two versions. Under Compare two assembly versions, choose the earlier and the later FASTA file and click Compare, or click Compare the example pair. The page lists every event with its position in both versions and offers diff.json and events.tsv for download.

Comparison of the example pair: 1 event, a substitution A to G at position 5 of contig ctgA, with download buttons and the equivalent command

Figure 9. Comparing two versions: one substitution between the example FASTA files.

The browser page has no option to declare the release. When the report asks you to run the scan again with --latest FILE, use the command line, which is described next.

Step by step on the command line

Install

python -m pip install assemblytrace
assemblytrace --help

assemblytrace --help lists every command, and assemblytrace COMMAND --help lists the options of one command. The commands used in this guide are:

Command What it does
scan PROJECT --out-dir DIR versions, their differences, the version of every file, report, provenance records and lockfile
diff A.fa B.fa the events between two versions of one assembly
lift FILE --from A.fa --to B.fa --output OUT moves GFF3/GTF, BED or VCF records from one version to another
seqcol A.fa the seqcol digests of one FASTA file
verify PROJECT --lock FILE checks the files pinned in a lockfile; exit code 2 on any change

Other commands (identity, annotation, release-check, changes, paf-changes, normalize-indels, snapshot, capture-run, resolve) check single files and write provenance manifests; see their --help.

Get the example data

The source code holds two examples. examples/ is the tiny project used by the browser's Try the example project. validation/make_example_project.py writes a richer project: a draft, a polished version, a copy of the polished version with renamed contigs, an annotation made on the draft, proteins and an alignment made from the polished sequences, variant calls against the draft, QUAST and BUSCO reports and the script that polished the draft.

git clone https://github.com/maciejkochanowski/AssemblyTrace.git
cp -r AssemblyTrace/examples examples
python AssemblyTrace/validation/make_example_project.py project
find project -type f | sort
example project written to project
project/annotation/genes.gff3
project/annotation/proteins.faa
project/assembly/draft.fasta
project/assembly/final_renamed.fa
project/assembly/polished.fa.gz
project/qc/quast_report.tsv
project/qc/short_summary.busco.txt
project/reads/aligned.sam
project/reads/calls.vcf
project/reads/illumina.fastq.gz
project/workflow/polish.sh

The script also writes project_truth.fasta next to the folder: the true genome, kept outside the project as the answer key.

Scan a project

assemblytrace scan project --out-dir audit

Progress goes to the terminal (standard error); the last line is a one-line JSON summary (standard output):

assemblytrace: scanning /tmp/demo/project
assemblytrace: 11 files: 3 assembly, 1 busco, 1 fastq, 1 gff, 1 protein, 1 quast, 1 sam, 1 vcf, 1 workflow_script
assemblytrace: 3 assembly version(s); 3 pair(s) compared, 40 events; latest v2
assemblytrace: annotation/genes.gff3: substantial v1
assemblytrace: annotation/proteins.faa: undecided ['v2', 'v3']
assemblytrace: qc/quast_report.tsv: substantial v1
assemblytrace: qc/short_summary.busco.txt: undecided ['v2', 'v3']
assemblytrace: reads/aligned.sam: substantial v3
assemblytrace: reads/calls.vcf: substantial v1
assemblytrace: reads/illumina.fastq.gz: not_version_bound None
assemblytrace: control: 0 integrity notes, 2 recorded commands, 0 declared versions, 1 derivation links, 0 chain breaks
assemblytrace: verdict fail: At least one file is damaged, stale or contradicts its declared or linked provenance; see findings.
{"status": "fail", "versions": 3, "artefacts": 7, "out_dir": "audit"}

The exit code is 2 because the result is FAIL. In this run v1 is draft.fasta, v2 is final_renamed.fa and v3 is polished.fa.gz (the labels follow file times, so yours may differ). The script workflow/polish.sh records that the draft was polished and the polished file renamed; the end of that lineage, v2, which holds the same sequences as polished.fa.gz, is taken as the latest version. The variant calls were made against the draft: their REF alleles rule the latest version out, which is a problem. The annotation and the QUAST report also fit the draft. Open audit/report.html in a web browser to read the whole result.

Useful options of scan:

Option Effect
--latest FILE declare the release (see the next section)
--fail-on-review exit with code 3 instead of 0 when the result is REVIEW
--threads N number of worker threads
--full-hash SHA-256 every file, including reads and alignments above 512 MB, so the lockfile pins them too
--quiet no progress lines; only the JSON summary
--name NAME, --license URL dataset name and data licence for the RO-Crate
--k K k-mer size of the discriminating panels (default 31)

Put the output folder outside the project folder. AssemblyTrace never scans its own output folder, but keeping them apart avoids confusion. A scan does not change your files; it keeps a cache in .assemblytrace/ inside the project when the folder is writable, so a second scan is faster.

Declare the release with --latest

Tell AssemblyTrace which assembly is the release. Give the FASTA file's path inside the project folder (or its file name, if that is unique). A version label such as v2 also works, but labels can change when files change, so the path is safer:

assemblytrace scan project --out-dir audit-release --latest assembly/final_renamed.fa
assemblytrace: 3 assembly version(s); 3 pair(s) compared, 40 events; latest v2
...
assemblytrace: verdict fail: At least one file is damaged, stale or contradicts its declared or linked provenance; see findings.
{"status": "fail", "versions": 3, "artefacts": 7, "out_dir": "audit-release"}

The findings now say v2 is declared as the release, and every file is checked against it. The path is relative to the project folder, not to your current folder:

$ assemblytrace scan project --out-dir audit-x --latest project/assembly/final_renamed.fa
assemblytrace: ValueError: --latest project/assembly/final_renamed.fa: no assembly version of the project has this file

Declaring a different release changes the answer. With --latest assembly/draft.fasta the same project gives REVIEW: the variant calls, annotation and QUAST report now fit the release, the alignment and the proteins exist only for the polished sequences (points to review), and a note says that the alignment was made from another version.

Compare two versions with diff

assemblytrace diff examples/assembly_before.fa examples/assembly_after.fa --output diff.json
assemblytrace diff project/assembly/draft.fasta project/assembly/polished.fa.gz --output draft-vs-polished.json

Without --output the JSON is printed. The comparison of the draft with the polished version finds 20 events on 3 paired contigs ("event_counts": {"SNV": 13, "INS": 6, "DEL": 1, "COMPLEX": 0}); each event looks like this:

{
 "contig": "ctg1",
 "type": "SNV",
 "ref_pos": 4700,
 "alt_pos": 4700,
 "ref": "T",
 "alt": "G",
 "contig_b": "ctg1"
}

ref_pos is the position in the first file and alt_pos in the second (1-based); contig_b is the contig's name in the second file. The JSON also holds the seqcol comparison of the two files, the pairing of contigs, identical and renamed contigs, and any stretch that could not be resolved into small events.

Move an annotation with lift

lift moves GFF3/GTF, BED or VCF records through the events between two versions, so each feature lands exactly where its sequence went:

assemblytrace lift project/annotation/genes.gff3 \
  --from project/assembly/draft.fasta --to project/assembly/polished.fa.gz \
  --output genes.polished.gff3 --unmapped genes.unmapped.gff3
{"lifted": {"exact": 27, "changed_inside": 27}, "unmapped": 0, "events": 20}
ctg1    .   gene    500 2287    .   +   .   ID=gene1;at_lift=exact
ctg1    .   mRNA    500 2287    .   +   .   ID=rna1;Parent=gene1;at_lift=exact
ctg1    .   CDS 500 2287    .   +   0   ID=cds1;Parent=rna1;protein_id=prot1;at_lift=exact
ctg1    .   gene    3000    4787    .   +   .   ID=gene2;at_lift=changed_inside
ctg1    .   mRNA    3000    4787    .   +   .   ID=rna2;Parent=gene2;at_lift=changed_inside
ctg1    .   CDS 3000    4787    .   +   0   ID=cds2;Parent=rna2;protein_id=prot2;at_lift=changed_inside;at_orf=intact

at_lift=exact means no event touches the feature; changed_inside means at least one does. For a changed CDS, at_orf=intact or at_orf=broken gives the state of its reading frame in the target version. A feature whose end falls into deleted sequence cannot be placed and goes to the --unmapped file. Lift does not re-predict gene models: check features marked changed_inside, especially those with at_orf=broken.

Digests with seqcol

assemblytrace seqcol --level 0 project/assembly/polished.fa.gz
{
  "seqcol_digest": "SRbUiQlfY5dNNj6xXA5OkbYcYEbD7oKP"
}

Without --level 0 the output also gives the level 1 digests of the names, lengths and sequences separately; see Renamed contigs.

Pin the files and verify them later

Every scan writes assemblytrace.lock.json, which pins the SHA-256 of every file and the seqcol digest of every version. verify recomputes them, for example before a submission or after copying the project to an archive:

assemblytrace verify project --lock audit-release/assemblytrace.lock.json
{
  "checked": 11,
  "ok": 11,
  "missing": [],
  "changed": [],
  "unverifiable": [],
  "new_files": [],
  "new_versions": [],
  "status": "pass",
  "coverage": {
    "required": 11,
    "verified": 11,
    "fraction": 1.0
  }
}

After one line was added to qc/quast_report.tsv, the same command reports the change and exits with code 2:

  "changed": [
    {
      "path": "qc/quast_report.tsv",
      "expected": "a3f168fe68084d54a08558aa01c994d5b0a15da36490cb9953c460359f6fe826",
      "observed": "d42b59dd9db261e26b2419340de2866d21cc3f491aecd1d53a180194ad03a241",
      "what": "sha256"
    }
  ],
  ...
  "status": "fail",

verify gives pass only when every pinned file could be checked and nothing changed. A missing, changed or unreadable file, or a FASTA file that is a new assembly version, gives fail; a pinned entry without a digest (a large alignment scanned without --full-hash) gives partial. Both exit with code 2. New files that are not assemblies are listed in new_files for review. Without --lock, verify looks for assemblytrace.lock.json in the project folder.

Use AssemblyTrace from Python

import json
from assemblytrace.project import run_project
from assemblytrace.seqcol import digest_fasta
from assemblytrace.prov import verify_lock

result = run_project("project", "audit-api", latest="assembly/final_renamed.fa", quiet=True)
print(result["verdict"]["status"])                       # fail
print(result["graph"]["latest"], result["graph"]["latest_status"])   # v2 declared
for a in result["attributions"]:
    print(a["relpath"], a["attribution"]["status"], a["attribution"].get("best"))

print(digest_fasta("project/assembly/draft.fasta")["seqcol_digest"])  # bbfk2e3q8OFOr8nBkrxBKDlDGYuDhrhk

lock = json.load(open("audit-api/assemblytrace.lock.json"))
print(verify_lock("project", lock)["status"])            # pass
fail
v2 declared
annotation/genes.gff3 substantial v1
annotation/proteins.faa undecided ['v2', 'v3']
qc/quast_report.tsv substantial v1
qc/short_summary.busco.txt undecided ['v2', 'v3']
reads/aligned.sam substantial v3
reads/calls.vcf substantial v1
reads/illumina.fastq.gz not_version_bound None

run_project writes the same outputs as assemblytrace scan and returns the content of scan.json as a dictionary. For tables, read attribution.tsv or events.tsv with any TSV reader.

How to read the report

report.html is one self-contained file: no scripts, no fonts or other files from the internet. It opens in any browser, prints well and follows the light or dark setting of your system. The screenshots below come from the scan of the example project made by validation/make_example_project.py (result FAIL). Numbers in blue circles were added for this guide.

Header, result and key numbers.

Report header, the Result box FAIL with its meaning and "What to do next", and the Key numbers, marked with callouts 1 to 6

Figure 10. The top of the report.

  1. The result: PASS, REVIEW or FAIL.
  2. What the result means, in one sentence.
  3. What to do next: the actions behind all findings, most important first.
  4. The identity of this run: run id, creation time (UTC) and AssemblyTrace version. The same run id is in scan.json and scan-summary.json.
  5. Links to every section of the report.
  6. Key numbers: files, versions, the latest version, and how many files fit it, were made from another version or are undecided.

Findings.

Findings grouped as Problems and Needs review, each with a "What to do" line, marked with callouts 1 to 3

Figure 11. Findings and what to do.

  1. A problem: it makes the result FAIL. Here the variant calls were made from v1, the draft, not from the latest version.
  2. What to do about it.
  3. Points that need review. A third group, Notes, gives information that changes nothing (for example that two versions hold the same sequences).

Assembly versions.

Assembly versions: lineage graph, the latest version and why, and a table with file names, total length, number of sequences, seqcol digest, source and role, marked with callouts 1 to 5

Figure 12. The versions found in the project.

  1. The lineage graph. A solid arrow is a recorded step (a command in a script or log); a dashed arrow joins versions with the same sequences; the latest version has a thick border. For two copies with the same sequences, the arrow runs from the older file to the newer one by file time; it does not say which copy was written from which.
  2. The latest version and why it was taken: declared, recorded by the workflow, the only version, or ambiguous.
  3. The seqcol digest, shortened; show full gives the whole value.
  4. Where the version came from, and a warning when the sequences do not support a recorded source.
  5. The role of the version, such as the latest or a copy of it.

Differences between versions.

Differences between versions: for each pair, how they relate, the changes, identical contigs, bases inserted or deleted and contigs not compared, marked with callouts 1 to 3

Figure 13. Every pair of versions in plain words. All events are listed in events.tsv.

  1. How the two versions relate: same sequences with renamed contigs, or different sequences.
  2. The changes, counted from the first version of the pair to the second.
  3. Contigs that could not be compared. "none" means every contig was paired.

Which version each file was made from.

Table of files with type, version, strength of evidence, status and the reason, marked with callouts 1 to 5

Figure 14. The version of every file.

  1. The version the file fits best, "v2 or v3 (same sequences)" for a tie between copies, or "none" for raw reads.
  2. How clearly the evidence separates the versions: substantial, strong, very strong or decisive, or tie.
  3. The status relative to the latest version: fits the latest version, other version, undecided or not tied to a version. A coloured bar and the link under the label mark files that a finding is about.
  4. Why: which evidence was used, and why the strength is capped when only names, lengths or summary numbers could be compared.
  5. A file that makes the result FAIL: its REF alleles rule out the latest version.

In the bundled example (examples/, result REVIEW) several files are undecided:

Table of files where the BUSCO summary, annotation, alignment and QUAST report are "undecided: v1 or v2" with strength "tie"

Figure 15. Undecided files.

  1. "undecided: v1 or v2": the file fits both versions equally.
  2. "tie": the evidence does not favour either. The two FASTA files of this example differ in one base, and these files never touch it.

Technical details, provenance and glossary. Below the tables, Technical details holds the numbers behind them for specialists: the probability of each version for each file, content classes, every file by stage, integrity, raw reads, declared against observed provenance, derivation chains and the evidence per file. Provenance of this report gives the run id, the command line, the tool version and source hash, and the SHA-256 of every input file. The Glossary explains every status word that the report uses:

Glossary of the status words: PASS, REVIEW, FAIL, Problem, Needs review, Note, Fits the latest version, Other version, Not tied to a version, substantial, tie, Latest version, seqcol digest, Same sequences, log10 BF

Figure 16. The glossary at the end of the report.

Typical scenarios

Do the annotation and its proteins match the assembly being submitted?

You polished a draft, annotated "the assembly" and are about to submit the polished version with its annotation and proteins. Put the assemblies, the GFF3 and the protein FASTA in one folder and declare the release. With the example project from Get the example data:

mkdir -p polish/assembly polish/annotation polish/reads polish/qc
cp project/assembly/draft.fasta project/assembly/polished.fa.gz polish/assembly/
cp project/annotation/genes.gff3 project/annotation/proteins.faa polish/annotation/
cp project/reads/aligned.sam polish/reads/
cp project/qc/short_summary.busco.txt polish/qc/
assemblytrace scan polish --out-dir polish-audit --latest polished.fa.gz

Here the GFF3 was made on the draft and the proteins on the polished version:

assemblytrace: scanning /tmp/demo/polish
assemblytrace: 6 files: 2 assembly, 1 busco, 1 gff, 1 protein, 1 sam
assemblytrace: 2 assembly version(s); 1 pair(s) compared, 20 events; latest v2
assemblytrace: annotation/genes.gff3: substantial v1
assemblytrace: annotation/proteins.faa: substantial v2
assemblytrace: qc/short_summary.busco.txt: substantial v2
assemblytrace: reads/aligned.sam: substantial v2
assemblytrace: control: 0 integrity notes, 0 recorded commands, 0 declared versions, 1 derivation links, 1 chain breaks
assemblytrace: verdict review: Some relations could not be settled from the evidence, or a stage lacks the latest version; see findings.
{"status": "review", "versions": 2, "artefacts": 4, "out_dir": "polish-audit"}

The report lists three points to review. The first names the mismatch between the two files:

Needs review: Derivation link possibly broken (protein): annotation/proteins.faa is on v2 and annotation/genes.gff3 on v1 (probability 0.676 that they lie on different versions); one of the two was regenerated against another version without the other.
What to do: Find out which of annotation/proteins.faa and annotation/genes.gff3 is out of date and re-create it from the same version as the other (normally the release).

Needs review: Stage "annotation" exists only for v1, not for the latest version v2.
Needs review: annotation/genes.gff3 belongs to v1 (substantial), not to the latest version v2.

What to do: annotate the release again, or move the existing annotation with lift and check the features marked changed_inside. Proteins give evidence through gene models: those of a GFF in the project that reproduces them, or the coordinates in Prodigal headers. A protein file alone, with neither, gives no evidence.

Renamed contigs

Submission often requires new contig names. A renamed copy has a new seqcol digest, but its level 1 digest of the sequences stays the same:

assemblytrace seqcol project/assembly/polished.fa.gz
assemblytrace seqcol project/assembly/final_renamed.fa

Three of the values from the two outputs, side by side:

polished.fa.gz final_renamed.fa
seqcol_digest SRbUiQlfY5dNNj6xXA5OkbYcYEbD7oKP 4IEnYo8hi-mKaIeGpioAQj4QYuZu9Q51
level1.names YPdXbTWJMCRwK_5XG0tSDUp2iXGl69dQ YBq2et47UqJaBJSXlSy9PvZZfl5GJjP_
level1.sequences -BdZH39Pm3vgDH7VOGYKD9AE8puqR_3d -BdZH39Pm3vgDH7VOGYKD9AE8puqR_3d

assemblytrace diff project/assembly/polished.fa.gz project/assembly/final_renamed.fa reports no events, 3 identical and 3 renamed contigs. In a scan the two files are one content class ("same sequences"), and the report notes v3 has the same sequences as v2 under different names or order. Files that do not mention contig names (proteins, a BUSCO summary) fit both equally and are reported as a tie between the copies; files that do (an alignment header, a VCF) show which naming they use. Make all files you submit with the names of the submitted copy.

Polishing rounds

Several polishing rounds leave several versions that differ in a few hundred bases. Keep the commands that made them (a shell script, a Snakemake or Nextflow record, a job log) in the project: AssemblyTrace reads them to build the lineage, and then knows which round is the latest. Otherwise declare it with --latest.

A QC report made from an older version

QUAST and BUSCO reports are often run once and forgotten. In the example project the QUAST report gives a total length of 59,994 bp, which is the draft, not the release (59,999 bp):

qc/quast_report.tsv belongs to v1 (substantial), not to the latest version v2.
What to do: Re-create this file from the latest version v2; if v1 is the real release, declare it with --latest FILE.

Run the QC again on the release before you report its numbers. Because summary numbers fit any version with the same layout, a QC report is never attributed more strongly than substantial, and a QC report of a version that is not in the project stays undecided rather than being flagged.

Outputs reference

A scan writes these files into the --out-dir folder (the browser puts the same files into the ZIP):

File What it is for
report.html the result in plain language with what to do next; versions, differences, the version of every file, technical details, provenance and glossary; self-contained
scan.json the complete result: every file, version, comparison, event, attribution with its evidence, and the verdict with all findings; for programs
scan-summary.json a compact record of the run: run id, source identity, versions, attributions, verdict, and the list of outputs with their sizes; "complete": true only after every output was written
attribution.tsv one row per file: best version, status, log10 Bayes factor, probability of each version, evidence groups, content class
events.tsv every event between every pair of versions: versions, contig, type, positions in both versions, REF and ALT
inventory.tsv every file: stage, kind, size, SHA-256, integrity, version and status
claims.tsv versions declared by workflow records or file headers, set against what the content shows
prov.json W3C PROV-JSON provenance: which file was derived from which version
assemblytrace-ro-crate-metadata.json a detached RO-Crate 1.2 with a Process Run Crate action, for archives and workflow registries
assemblytrace.lock.json SHA-256 of every file and seqcol digest of every version, for verify
curation/<from>_to_<to>.changes.vcf the events of one lineage step as VCF in the earlier version's coordinates; bcftools consensus applied to the earlier version gives the later one
curation/<from>_to_<to>.a.bed, .b.bed the same events as BED tracks on the earlier and on the later version, for a genome browser

The curation/ files are written for each step of the recorded lineage, or, when no source is recorded, between a version and the most similar one. Other commands write: diff, a JSON file (--output) or JSON on the screen; lift, the moved records (--output) and the records that could not be placed (--unmapped); seqcol and verify, JSON. In the project folder, a scan keeps a cache in .assemblytrace/cache when the folder is writable.

Limits and good practice

Memory and speed in the browser. The browser app works in the memory of one tab, which WebAssembly limits to a few gigabytes, and on one processor core, several times slower than the command line. Bacterial, fungal and other small or medium genome projects work well. For large genomes (hundreds of megabases or more) and large BAM files use the command line.

Large genomes on the command line. Use --threads on a machine with several cores. Reads and alignments above 512 MB are not hashed by default, because hashing them is slow; add --full-hash when the lockfile should pin them. validation/scan_runner.py in the source code wraps a scan for batch systems such as Slurm, with a time limit and an execution record; see SCAN_EXECUTION.md.

Raw reads are not attributed. Reads carry the sample's alleles, not the assembly's, so a FASTQ file belongs to no version. Alignments are attributed through their headers and MD tags, never through the read sequences.

BAM on Windows. pysam is not available on Windows, so MD tags are not read there and BAM attributions rest on headers alone. Use Linux, macOS or WSL for BAM evidence. MD tags in CRAM files are not evaluated, because they are regenerated from whatever reference decodes the file.

What evidence can and cannot do. Files made from two versions that are identical at every evidence site cannot be separated. Renamed copies are told apart only by names, M5 tags or file names in headers. 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. Attribution is evidence, not proof of which program made a file. See LIMITATIONS.md.

Good practice.

Troubleshooting and FAQ

"--latest ...: no assembly version of the project has this file". The path must be relative to the project folder (assembly/final_renamed.fa), not to your current folder. A unique file name or a version label such as v2 also works.

The result says the latest version is ambiguous. Nothing in the project records which version is the newest, so AssemblyTrace took the newest file. Run the scan again with --latest FILE.

Many files are undecided. The versions may differ at very few sites, or the files carry little evidence (only summary numbers, no contig names). This is a correct answer; see Why undecided is a valid answer. Keep the commands that made the files in the project, or re-create the files from the release.

The scan exits with code 2 although it finished. A FAIL exits with code 2 by design. scan-summary.json with "complete": true shows that the scan itself finished. An input error (for example a --latest file that is not in the project) also exits with code 2, with a message starting assemblytrace:.

"No assembly FASTA found in the project". AssemblyTrace recognises FASTA files by content and by extensions such as .fa, .fasta, .fna and .fas, gzipped or not. Check that the assemblies are in the folder you scanned.

verify fails after I edited a file on purpose. The lockfile pins the old content. Run the scan again to write a new lockfile.

"Lockfile not found". Give the lockfile with --lock, for example --lock audit/assemblytrace.lock.json.

The browser page stays at "Starting the Python runtime". The first visit needs to download the runtime from the jsDelivr CDN. Check that your network or browser extensions allow it, then reload. Later visits use the browser's cache.

The browser tab runs out of memory or is very slow. Use the command line for this project.

The browser asks whether to "upload" the folder. That is the browser's wording for letting the page read the files. Nothing leaves your computer.

Does AssemblyTrace change my files? No. It writes only into the output folder, plus the cache in .assemblytrace/ inside the project.

Can it tell me which version is correct? No. It tells you which version each file belongs to and how the versions differ, not which bases are right.

How to cite

Please cite the archived software. The concept DOI always resolves to the newest version:

Kochanowski, M., & Dąbrowska, J. AssemblyTrace [software]. Zenodo. https://doi.org/10.5281/zenodo.24668118

For full reproducibility, cite the version DOI of the release you used, listed on the Zenodo page, and give the version number (assemblytrace --version). CITATION.cff in the repository holds the same information; GitHub shows it under "Cite this repository". AssemblyTrace is also listed in bio.tools as assemblytrace.

AssemblyTrace is released under the MIT licence.

Acknowledgements

AssemblyTrace is in part an outcome of genome assembly work on Anisakidae carried out in the research action MINIATURA 6 of the National Science Centre, Poland (2022/06/X/NZ6/00427), at the National Veterinary Research Institute, Puławy, Poland.