Repository navigation
fix(sj): outFilterType BySJout and SJ.out.tab filtering as STAR (outputSJ, two-stage held reads) - #316
Open
BenjaminDEMAILLE wants to merge 1 commit into
Open
fix(sj): outFilterType BySJout and SJ.out.tab filtering as STAR (outputSJ, two-stage held reads)#316BenjaminDEMAILLE wants to merge 1 commit into
BenjaminDEMAILLE wants to merge 1 commit into
Conversation
…utSJ, two-stage held reads) - SJ.out.tab filter ported from outputSJ.cpp: intronMax buckets (the gap was off by one), STAR's unsigned cast of -1 (never passes), per-junction overhang, distance-to-other-junction filter over sorted donors and acceptors with annotated junctions as neighbours but exempt. - --outFilterType BySJout as STAR's two stages: reads with an unannotated junction are held, the surviving novel junctions come from all reads' counts, and held reads are mapped again with only those allowed and written after the others. - Junction overhangs end at indels; annotation by sjdb coordinates or the stitcher flag (non-canonical annotated junctions such as HAC1 were missed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #315.
Finding
With
--outFilterType BySJoutthe genomic output and SJ.out.tab differed from STAR 2.7.11b on the yeast 200k pairs (e.g. 802 mates STAR keeps that rustar dropped, 502 diffs). SJ.out.tab also differed with Normal filtering (missing and extra rows, wrong overhang and annotation columns).Cause (STAR source)
outputSJ.cpp: the count filter casts thresholds to uint (-1 never passes); the overhang test is per junction;outSJfilterIntronMaxVsReadNis indexed by the read count and compared with the gap (end - start + 1); the distance filter works on the sorted list of junctions that passed the count filter (annotated ones included as neighbours, exempt themselves), donor and acceptor. rustar used fixed indices, gap off by one, a donor/acceptor test on intron end vs next start, and -1 as "no limit".ReadAlign_outputAlignments.cpp(outFilterBySJout),ReadAlignChunk_processChunks.cpp: reads with an unannotated junction are held, the others are output at once. After the first stage the novel junctions (count + distance filter over the junctions of ALL reads,chunkOutSJ1) are fixed, and the held reads are mapped again (stitch rejects other unannotated junctions) and output after all other reads. The final SJ.out.tab (outFilterBySJoutStage==2) uses the junctions of the output reads only, with no distance filter. rustar instead dropped reads whose primary alignment had a non-surviving junction.ReadAlign_outputTranscriptSJ.cpp: overhang is the shorter adjacent exon, and indels and insertions end an exon; annotation is by sjdb coordinates whatever the strand (non-canonical annotated junctions, e.g. HAC1, were missed).Fix
junction/sj_output.rs:surviving_junctionsported fromoutputSJ;first_stagestats andbysjout_novel_junctions; no distance filter in the last BySJout stage.lib.rs(SE and PE): the per-batch aligner is nowprocess(base, reads, stage2); first stage holds reads and records their junctions in the first-stage stats; the writer then maps held reads again with the novel set (same code path, so stats, SJ, WASP, transcriptome draws follow STAR order). The temp-file buffering and the post-hoc drop are gone (also saves disk and RAM).Results (yeast 200k pairs, sidx, vs STAR 2.7.11b, --runThreadN 1)
Tests
Unit tests for the intron-length filter, the uint cast of -1 and the distance filter (annotated neighbours, last stage); BySJout integration test now checks the second-stage log.
cargo test --release,clippy -D warnings,fmtpass.Checked again by the main session
200k yeast pairs, annotated index, rustar on 8 threads against STAR 2.7.11b
--runThreadN 1:Not covered: the two-pass novel-junction filter (
--twopassMode Basic) still has its own filter.Part of #298.
🤖 Generated with Claude Code