Repository navigation
fix(sam): STAR's header text, from @HD VN:1.4 to the @CO command line - #297
Open
BenjaminDEMAILLE wants to merge 3 commits into
Open
BenjaminDEMAILLE wants to merge 3 commits into
BenjaminDEMAILLE wants to merge 3 commits into
Conversation
STAR hard-codes `@HD VN:1.4` (samHeaders.cpp:94); rustar wrote noodles' default 1.6, so the first header line differed from STAR's in every SAM and BAM. A VN given in --outSAMheaderHD now sets the version instead of being stored as an extra field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
…outSAMheaderHD - STAR builds the sorted header as samHeaderHD + "\tSO:coordinate" (samHeaders.cpp:100), so a user @hd keeps its field order and SO comes last. '-' is STAR's default for --outSAMheaderHD and was rejected as a malformed field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…file, user @hd, transcriptome BAM STAR's header layout (samHeaders.cpp): @hd as the user wrote it (VN:1.4 by default, no VN added to a user @hd), @sq, user @pg, program @pg, comment-file lines verbatim (blank lines skipped), @rg, then @co user command line. The transcriptome BAM carries only @sq and @rg. The text is rendered once from the parameters and shared by the SAM and BAM writers. 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.
STAR's SAM/BAM header, line for line (started as
@HD VN:1.4, extended after review).Finding
Headers differed from STAR 2.7.11b in four ways: no
@CO user command lineline;--outSAMheaderCommentFilelines got a second@CO\tprefix;Aligned.toTranscriptome.out.bamcarried@HDand@PG; a user--outSAMheaderHDwithoutVNgotVN:1.4added; and the line order was @hd @sq @rg @pg @co instead of STAR's.Cause and fix
samHeaders.cpp:samHeaderswrites @hd, @sq, user @pg (outSAMheaderPG), program @pg, comment-file lines verbatim (blank lines skipped), @rg,@CO\tuser command line: <commandLine>. The transcriptome BAM header is @sq and @rg only (top of the same function).Parameters.cppbuildscommandLineas argv joined by spaces, a value argument with white space wrapped in quotes.The header text is now rendered once by
io::sam::render_header_text(kinds Main, MainSorted, Transcriptome) and used by the SAM, BAM, sorted BAM and stdout writers, instead of noodles' serializer. The user@HDstring is emitted verbatim, so noVNis invented (the noodles map is no longer the source of the @hd line).Parameters::star_command_lineholds STAR's command line format. The@PGID/PN/VN/CL stay rustar-aligner's own (intended difference).Results
Full headers compared with STAR on the yeast index (SAM, BAM Unsorted, BAM SortedByCoordinate, TranscriptomeSAM, with RG line,
--outSAMheaderPG, comment file,--outSAMheaderHDwith and without VN): identical apart from the program @pg line and the binary path in @co.Tests
New
header_text_follows_stars_layout; sorted-header test uses the new renderer;tests/determinism.rsalso drops@CO(it records the thread count). cargo test --release, clippy -D warnings, fmt clean.Earlier commits in this PR
@HD VN:1.4by default (samHeaders.cpp:94),SO:coordinateappended after the user's@HDfields for sorted BAM,--outSAMheaderHD -accepted as STAR's default.Part of #298.
🤖 Generated with Claude Code