scverse / scverse/rustar-aligner

outFilterMismatchNoverLmax is applied to the read length, not the mapped length

Open
#238 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
75
Forks
7
Avg merge
8m
Merged PRs (30d)
1

Description

ReadAlign_mappedFilter.cpp applies outFilterMismatchNoverLmax to the mapped length of the alignment, while outFilterMismatchNoverReadLmax is the one applied to the read length.

In src/align/read_align.rs both are currently divided by read_seq.len():

let read_length = read_seq.len() as f64;
...
let mismatch_rate = t.n_mismatch as f64 / read_length;
if mismatch_rate > params.out_filter_mismatch_nover_lmax { ... }

Consequence: for a soft-clipped alignment the denominator is too large, so the filter is more permissive than STAR's. A 100 bp read mapping 50 bp with 12 mismatches gives 0.12 here (kept at the 0.3 default) against STAR's 0.24 (also kept), but at 20 mismatches over 50 mapped bases it is 0.20 here and 0.40 in STAR, which STAR rejects and this does not.

The fix is to divide by the summed mapped length of the alignment's exons. It is deliberately not bundled into the PR that adds outFilterMismatchNoverReadLmax, because changing the denominator moves the yeast benchmark and wants its own before/after measurement.

Until then the two parameters share a denominator, so outFilterMismatchNoverLmax and outFilterMismatchNoverReadLmax behave identically.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/align/read_align.rs, where both mismatch rates currently use read_seq.len(), and inspect how the alignment’s exons expose their mapped lengths. Update the mapped-length calculation for outFilterMismatchNoverLmax, then run the relevant tests and compare the yeast benchmark before and after to confirm the denominator change.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
bioinformatics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.