Skip to content

feat: WASP allele-specific-mapping filter (SE + PE) - #108

Closed
BenjaminDEMAILLE wants to merge 7 commits into
scverse:mainfrom
BenjaminDEMAILLE:bd/wasp
Closed

feat: WASP allele-specific-mapping filter (SE + PE)#108
BenjaminDEMAILLE wants to merge 7 commits into
scverse:mainfrom
BenjaminDEMAILLE:bd/wasp

Conversation

@BenjaminDEMAILLE

@BenjaminDEMAILLE BenjaminDEMAILLE commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Port STAR-rs's WASP allele-specific-mapping filter (--waspOutputMode SAMtag, --varVCFfile) for both single-end and paired-end reads.
  • Split out of the original bundled PR into a themed PR per docs-old/dev/porting-from-star-rs.md — this PR is now WASP-only. Clipping, signal tracks, genome transforms, and STARlong now have their own PRs (see stack below).

Stack

Test plan

  • cargo build / test / clippy -D warnings / fmt --check all green
  • 447+ unit tests passing

BenjaminDEMAILLE and others added 3 commits July 23, 2026 20:00
CI's clippy advanced to 1.97 (new lints fail the `-D warnings` gate) and rustsec
flagged several advisories in the dependency tree. Both block all PRs.

Clippy:
- src/index/suffix_array.rs: assert!(x == 0) -> assert_eq! (manual_assert_eq)
- src/io/sam.rs, tests/alignment_features.rs: byte-slice literals -> byte
  strings, e.g. [b'S', b'M'] -> *b"SM" (byte_char_slices)
- src/quant/transcriptome.rs: if-let/else-return-None -> `?` (question_mark)

Security audit (Cargo.lock only, no manifest change):
- memmap2 0.9.10 -> 0.9.11 (RUSTSEC-2026-0186, out-of-bounds pointer offset)
- crossbeam-epoch 0.9.18 -> 0.9.20 (RUSTSEC-2026-0204, invalid pointer deref)
- anyhow 1.0.102 -> 1.0.104 (RUSTSEC-2026-0190, unsound downcast_mut)

No behavioural change. Unblocks CI for open and future PRs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add LICENSES/STAR_RS_LICENSE (STAR-rs MIT notice, Copyright (c) 2026 Benjamin
Demaille) and note it in LICENSES/README.md, for attribution of modules ported
from STAR-rs. STAR-rs is dual MIT-OR-Apache; ported code is taken under its MIT
option, compatible with this repo's MIT license.

Add docs-old/dev/porting-from-star-rs.md documenting the STAR-rs to
rustar-aligner type/module mapping, the licensing and cellranger reference-only
caveat, the determinism decision (adopt STAR-rs's thread-invariant, no-rand
model), and how to validate ports against native STAR via the existing test/
harness with DIVERGENCES.md as the acceptance spec.

This is the base of a series of themed, dependency-stacked PRs bringing the
STAR-rs feature surface (WASP, clipping, signal tracks, genome transforms,
STARlong, STARsolo, ...) into rustar-aligner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Port STAR's WASP filter (--waspOutputMode SAMtag, --varVCFfile) from STAR-rs
`crates/star-align/src/star_wasp.rs`. A uniquely-mapped read overlapping
heterozygous SNVs is re-mapped with every alternative-allele combination; if all
re-maps land on the identical locus it passes (vW:i:1), otherwise a failure code
(2..7) is reported. Emits vW, and vA/vG when requested in --outSAMattributes.

- src/wasp/mod.rs: load_vcf, wasp_type (re-map decision), wasp_variants (vG/vA),
  and record annotation. Works in base-code space; variant/read overlap is
  computed by walking the transcript CIGAR (same convention as build_md_tag), so
  it does not depend on the exon read-coordinate frame.
- src/params: add --waspOutputMode (None|SAMtag) and --varVCFfile, validation
  (SAMtag requires a VCF), and vW/vA/vG in --outSAMattributes.
- src/lib.rs: load the VCF once per run, re-map with a WASP-relaxed parameter set
  (match_nmin=0, multimap_score_range=1, multimap_nmax=10, matching STAR), and
  stamp vW/vA/vG onto the SAM records in the single-end path.

Paired-end WASP is a follow-up. See docs-old/dev/porting-from-star-rs.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
BenjaminDEMAILLE and others added 4 commits July 24, 2026 00:27
Replace the single giant phase-log paragraph and the stale hardcoded test
count / known-issues list with a short faithfulness summary and a pointer to
ROADMAP.md / CHANGELOG.md / docs-old for per-phase history. Refresh the source
layout (params/ split, cpu.rs, sa_build.rs, sjdb_insert.rs, transcriptome.rs,
log.rs) and the dependency list (caps-sa, mimalloc, rand 0.10, tempfile as a
runtime dep) to match the current tree. Documentation only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Complete the WASP filter for paired-end reads, the documented follow-up to the
single-end port (3e84d97). Ports STAR-rs `wasp_type_pe` / `wasp_variants_pe`
into rustar-aligner's two-transcript-per-pair model.

- src/wasp/mod.rs: add wasp_variants_pe (combined vG/vA over mate1 then mate2,
  STAR's `mate1 ++ rc(mate2)` combined-transcript order), wasp_type_pe (single
  vW code: walk each mate's variants in its SAM frame, apply every allele
  combination, map back to forward mates, and re-map the pair via
  align_paired_read with the WASP-relaxed params; a combination passes only if
  exactly one both-mapped pair lands on the same exons for both mates), and
  annotate_records_pe (both mate records share vW/vA/vG; multimapped pairs
  overlapping variants get vW:i:2).
- src/lib.rs: build the WaspContext once in align_reads_paired_end and stamp
  vW/vA/vG onto the built pair records, mirroring the single-end path.

Gate green: cargo build, clippy -D warnings, fmt, 464 tests (2 new PE
variant-frame unit tests). Byte-level validation against native STAR via the
test/ harness is a separate step.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@BenjaminDEMAILLE BenjaminDEMAILLE changed the title feat: WASP allele-specific-mapping filter (single-end) feat: WASP allele-specific-mapping filter (SE + PE) Jul 24, 2026
@Psy-Fer Psy-Fer mentioned this pull request Jul 27, 2026
@Psy-Fer Psy-Fer closed this in #137 Jul 27, 2026
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