Repository navigation
Unmapped.out.mate* names and sequences as STAR writes them - #364
Open
BenjaminDEMAILLE wants to merge 1 commit into
Open
BenjaminDEMAILLE wants to merge 1 commit into
BenjaminDEMAILLE wants to merge 1 commit into
Conversation
`@q9` becomes `@q9 0:N: `, and pairs get `@p 0:N: 10` / `@p 1:N: 10`: the 0-based mate, the FASTQ filter flag, an empty field, and whether each mate mapped. A FASTQ mate 2 record carries mate 1's name and flag; a FASTA one keeps its own name. Half-mapped pairs are written as read, not clipped. Format observed in STAR 2.7.11b's output, source not read. 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.
Part of #354 (the
Unmapped.out.mate*name difference reported in #358; it has no finding number in the audit report).Stacked on #358, because this touches the same FASTQ code and uses the FASTA reads it adds. Only the last commit is this PR. Its base branch here is
fix/input-output-small, and #358 is itself stacked on #353 and #352.Problem
--outReadsUnmapped Fastxwrote@q9where STAR writes@q9 0:N:, so the files differed on every record. Measuring this turned up three more differences in the same files:What STAR does
Observed output of Homebrew STAR 2.7.11b, source not read.
<m>is@or>. The text between the flag's:and the status is empty in every run I could make, so there are two spaces before the status in pairs, and a trailing space in single-end. The audit calls that the barcode field. I could not confirm that, see "Not matched".--readNameSeparatoras elsewhere. With--outSAMreadID Number, the number, on both mates@d.0.1 1:N: 00ford.0.1/d.0.2>d.0.2 1:N: 00Yif the first word after the name has:Y:at its second byte, elseNN, even for>c1 1:Y:01:Y:0/2:N:0givesYon both, and1:N:0/2:Y:0givesNon both10mate 1 mapped,01mate 2 mapped,00otherwise, including a pair over--outFilterMultimapNmax+line is bare, also for+q14Flag on single-end FASTQ, as written by STAR:
@a1 1:Y:0:ACGT,@a3 2:Y:18:GG,@a12 1:Y:0 2:N:0,@a13 1:Y:,@a9/1/x y:Y:Y@a8<TAB>b:Y:cY@a2 1:N:0:ACGT,@a4 Y,@a5 :Y:,@a6 1:Y,@a10 ab:Y:,@a11 1:y:0N@a7 x<TAB>y:Y:zNChange
EncodedRead.filter_flag, set by the newfilter_flagfor FASTQ andNfor FASTA. Reading it costs one short scan per read and a byte in the struct. Its only use is here.unmapped_namebuilds the name, and the four call sites insrc/lib.rsuse it.UnmappedFastqWriteritself did not need to change.paired_read.mate*rather than the clipped copies.Other
EncodedReadconstructors are test code insrc/solo/mod.rs; each gains one line.Measured against STAR
cmponUnmapped.out.mate*. Exit codes were 0 on both tools unless shown./1, tab,+q141:Y:0--readNameSeparator _(pair);qand-(SE)--outSAMreadID Number, SE and pair10, with--clip5pNbases 3 3 --clip3pNbases 2 201, same clipping10and01, FASTA--outSAMreadID Number--outFilterMultimapNmax 1, both mates mapped--outFilterType BySJout, pair--outFilterMultimapNmax 1I did not re-run #358's own binary for a before column. Its description records
>junkagainst STAR's>junk 0:N:, andmaingave@q9against@q9 0:N:here.Not matched
--outFilterMultimapNmax: STAR writes@multi_polyA 0:N: 00, this writes10. On this branch a half-mapped pair always has one result, so it is never seen as over the limit. That is finding 2 of Tracking: fixes from the whole-repo audit (main at 32fbbc1) #354, and I left it there.--soloTyperuns withcould not open input file /geneInfo.tab. So I do not know what STAR writes there.maintoo. Not changed and not compared.Deliberate divergences
None added.
Tests
Each failed with the fix taken out, and passes with it:
tests/alignment_features.rs:test_unmapped_mate_files_match_star. Compares the whole of each file: single-end FASTQ and FASTA, a FASTQ and a FASTA pair, and half-mapped pairs with clipping, with both10and01. I ran STAR on the same genome and reads and its output is byte-identical to the test's expected text.src/io/fastq.rs:filter_flag_needs_y_as_the_second_colon_field_of_a_one_byte_first_field.cargo test --release,cargo clippy --all-targetsandcargo fmt --checkare clean on macOS.Not checked
test/parity_suite.shwas not run. This changes those files only, so the SAM output comparison harnesses were not run either.@q9 0:N:, a tool taking the whole line as the name would see the extra fields, as it does with STAR.🤖 Generated with Claude Code