Skip to content

fix(longread): refuse short reads in Sniffles2 and give it a tandem-repeat map - #441

Open
geiresx wants to merge 6 commits into
GeiserX:mainfrom
geiresx:pgp/i411-longread-sv-smoke
Open

geiresx wants to merge 6 commits into
GeiserX:mainfrom
geiresx:pgp/i411-longread-sv-smoke

Conversation

@geiresx

@geiresx geiresx commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #411: sv-17, sv-18, sv-41, sv-43, and owner decision D14.

The problem

Step 04c ran Sniffles2 on whatever BAM it was given. Pointed at a short-read BAM, Sniffles2 finds no structural variant and still exits 0. So the step reported success with an empty VCF. Sniffles2 also ran without a tandem-repeat map, which it uses to place breakpoints and merge calls inside repeats. The step's closing hint said duphold adds a GQ to long-read SVs. It does not, and step 15 reads Manta's calls only. The long-read guide repeated that duphold "re-genotypes" SVs and listed SV counts and repeat accuracy with no source.

The tests only checked wiring. The SV smoke rows passed on any record near the planted deletion, of any type, size or filter. No test ran Delly's --sex option with the real binary.

The fix

  • Step 04c reads the mean length of the first 10,000 primary reads with the pinned samtools image before Sniffles2 runs. Below 1,000 bp it stops with exit 1 and names the long-read BAM to use (aligned_longread/<sample>_sorted.bam). A BAM with no primary read also stops it.
  • setup.sh installs GIAB's GRCh38 tandem-repeat stratification (v3.6, NIST data, free to reuse), pinned by TANDEM_REPEATS_URL and TANDEM_REPEATS_SHA256 in versions.env, and keeps it unpacked as reference/GRCh38_AllTandemRepeats.bed. Step 04c passes it as --tandem-repeats when present, and prints a note when not.
  • The closing hint now says Sniffles2 writes its own QUAL and GQ, and that step 15 reads Manta's calls only.
  • The long-read guide says what duphold really does, describes the read-length check and the map, and gives our measured run next to the Sniffles2 paper. docs/testing.md says what the smoke rows and fake-docker cases cover.
  • Smoke rows: Sniffles2, Manta, Delly and TIDDIT now need exactly one PASS deletion of 2.7-3.3 kb at the planted 3 kb deletion. Sniffles2 also needs no PASS record elsewhere. A second Sniffles2 row runs with --tandem-repeats, as step 04c does. GRIDSS keeps the loose check, because it writes breakends, not deletion records.
  • A new Delly smoke row moves the mini BAM onto a chrX of GRCh38's length, past PAR1. With --sex male the deletion must be haploid (1), with --sex female 1/1, the log must name the sex, and an unknown value must fail. Delly ignores --sex without a message on a chrX of any other length.

Decisions:

  • We use GIAB's tandem-repeat map, not the one Sniffles ships. That file comes from PacBio's pbsv under a licence that allows PacBio data only, so ONT users could not use it. On our test slice both gave the same result (50 of 64).
  • The threshold is a mean of 1,000 bp over the first 10,000 primary reads. Short reads average 100-300 bp; ONT and HiFi average well above 1,000 bp. Reading 10,000 reads takes under a second.
  • Outputs: no output file changes name or format. Setup writes one new reference file. Step 04c now fails where it used to "succeed" with an empty VCF.

How it was checked

Beads: sv-17, sv-18, sv-41, sv-43, D14.

…peat map

The fake-docker cases fail on main: step 04c runs Sniffles2 on a
short-read BAM and exits 0, never passes --tandem-repeats, and its
closing hint sends long-read SVs to duphold for a GQ.

Bead: sv-18
Bead: sv-17
…epeat map

Step 04c ran Sniffles2 on any BAM. On short reads Sniffles2 finds no SV
and still exits 0, so the step reported success with an empty VCF. It
now reads the mean length of the first 10,000 primary reads with the
pinned samtools image and stops below 1,000 bp, naming the long-read
BAM to use.

setup.sh installs GIAB's GRCh38 tandem-repeat stratification (v3.6,
NIST data, pinned by sha256) and keeps it unpacked; step 04c passes it
as --tandem-repeats when present and says so when not. Sniffles' own
file comes from PacBio's pbsv under a licence limited to PacBio data,
so it could not serve ONT reads.

The closing hint no longer sends long-read SVs to duphold for a GQ:
Sniffles2 writes its own, and step 15 reads Manta's calls only.

Bead: sv-18
Bead: sv-17
Bead: D14
…l on chrX

The SV rows passed on any record within 500 bp of the planted deletion,
of any type, size or filter, and nothing caught false calls elsewhere.
Sniffles2, Manta, Delly and TIDDIT now need one PASS deletion of 2.7 to
3.3 kb there; Sniffles2 also needs no PASS record elsewhere, and a
second row runs it with --tandem-repeats as step 04c does. GRIDSS keeps
the loose check: it writes breakends, not DEL records.

A new DELLY_IMAGE row runs delly sr --sex male and female on mini.bam
moved onto a chrX of GRCh38's length past PAR1 (input chrx): the male
genotype must be haploid, the female 1/1, and an unknown value must
fail. Delly ignores --sex without a word on a chrX of another length;
the row goes red when the chrX is one base longer.

The self-test plants records for each rule of the new checks.

Bead: sv-43
Bead: sv-41
The long-read guide said duphold re-genotypes SVs and that Sniffles2's
QUAL is reliable, and listed SV counts and repeat accuracy with no
source. It now says what duphold really reads, describes the read-length
check and the tandem-repeat map, and gives the run we measured on a
public HG002 HiFi slice next to the Sniffles2 paper. testing.md says
what the smoke rows and fake-docker cases cover.

Bead: sv-17
Bead: sv-43
Bead: sv-41
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 26 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9078a1d and 0f7898f.

Files ignored due to path filters: 1

  • tests/smoke/commands.tsv is excluded by !**/*.tsv
Files selected for processing: 10

  • CHANGELOG.md
  • docs/long-read-guide.md
  • docs/testing.md
  • scripts/04c-sniffles2.sh
  • scripts/ci/image-smoke.sh
  • scripts/setup.sh
  • tests/fake-docker/bash-step-partial-outputs.sh
  • tests/fake-docker/bash-step-sv.sh
  • tests/smoke/delly_sex.sh
  • versions.env
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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.

2 participants