Skip to content

Reject --align-chain up front where seed chaining cannot work - #693

Merged
adamant-pwn merged 1 commit into
masterfrom
fix/align-chain-requirements
Oct 28, 2026
Merged

adamant-pwn merged 1 commit into
masterfrom
fix/align-chain-requirements

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Problem

metagraph align --align-chain printed nothing for any read whenever seed chaining could not run.

Seed chaining needs seed coordinates. The labeled aligner has them only with an annotation with coordinates, and only on a BASIC-mode graph: AnnotationBuffer disables coordinates on CANONICAL and PRIMARY graphs. In every other case, align_both_directions:

  • logged "Chaining only supported for seeds with coordinates. Skipping seed chaining.";
  • then called exit(1) from a worker thread.

So the run aborted with no output, and the message claimed the opposite of what happened. The broken cases:

  • no annotation;
  • an annotation without coordinates;
  • any CANONICAL or PRIMARY graph.

Fix

  • align_to_graph checks the requirements right after loading the graph and annotation. If they aren't met, it fails with: --align-chain requires a BASIC-mode graph and an annotation with coordinates (e.g., annotate --coordinates, then transform_anno --anno-type column_coord).
  • The message in the aligner no longer claims to skip chaining.
  • Making chaining work on CANONICAL graphs would need coordinate support in AnnotationBuffer for those modes. That is out of scope.

Test

Integration test TestDNAAlign.test_align_chain_requires_coordinates:

graph annotation expected
BASIC plain column rejected, with the message, no stdout
CANONICAL column_coord rejected
BASIC column_coord accepted; one line per read

It passes locally (filtered run only).

Before / after

Setup: 24-genome k=31 graph, 30 ONT reads.

case master 8b77fc8f9 this PR
BASIC, plain annotation exit 1 after loading; 0 lines; "Skipping seed chaining" exit 1 in 0.12 s; clear requirement message
CANONICAL, plain annotation exit 1; 0 lines; same misleading message exit 1 in 0.15 s; clear requirement message
BASIC, column_coord annotation exit 0; 30 lines exit 0; 30 lines (unchanged)

No effect on normal alignment. metagraph align -p 8, CANONICAL, 945 long reads, 3 interleaved repeats each, median wall, master → this PR:

  • labeled seed 19: 47.4 → 46.5 s;
  • labeled full k: 28.3 → 25.7 s;
  • unlabeled seed 19: 42.0 → 38.8 s.

Spreads overlap on all three; peak RSS is the same; output checksums are identical in all 18 runs.

Related observation, not addressed here: on BASIC graphs with a coordinate annotation, labeled alignment of reads with indels mostly fails, with or without --align-chain. ONT 400 bp at 3% error: 23/100 aligned, vs. 97/100 with the plain column annotation. Illumina-like reads with substitutions only are unaffected (95/100 either way). The coordinate-consistency check in LabeledExtender probably requires exact coordinate distances, so indels break it.

🤖 Generated with Claude Code


Summary by cubic

Fixes metagraph align --align-chain so unsupported configurations fail up front with a clear message instead of printing no reads and aborting with a misleading error.

Seed chaining needs seed coordinates, and the labeled aligner only has them with a coordinate annotation on a BASIC-mode graph. CANONICAL and PRIMARY graphs disable coordinates, so --align-chain previously logged "Skipping seed chaining" and then exited from a worker thread. align_to_graph now validates the graph mode and annotation type right after loading and returns --align-chain requires a BASIC-mode graph and an annotation with coordinates (...). The message in the aligner no longer claims it is skipping chaining. Adds an integration test covering the rejected and accepted cases.

Written for commit 29083db. Summary will update on new commits.

View guided diff Turn on auto-fix

Seed chaining needs seed coordinates, which the labeled aligner has only
with an annotation with coordinates on a BASIC-mode graph (the annotation
buffer disables coordinates on CANONICAL and PRIMARY graphs). Otherwise,
align_both_directions logged "Skipping seed chaining" and then called
exit(1) from a worker thread, so align printed nothing for any read.

align_to_graph now checks these requirements after loading the graph and
the annotation and fails with an error saying what --align-chain needs.
The message in the aligner no longer claims to skip chaining.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@adamant-pwn
adamant-pwn merged commit fa64328 into master Oct 28, 2026
52 checks passed
@adamant-pwn
adamant-pwn deleted the fix/align-chain-requirements branch October 28, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant