fix(params): treat --outFileNamePrefix as a literal string prefix#46
Open
pinin4fjords wants to merge 1 commit into
Open
fix(params): treat --outFileNamePrefix as a literal string prefix#46pinin4fjords wants to merge 1 commit into
--outFileNamePrefix as a literal string prefix#46pinin4fjords wants to merge 1 commit into
Conversation
PathBuf semantics joined a bare-dot prefix like SAMPLE. as a directory
component, so outputs landed at SAMPLE./Aligned.out.bam instead of
SAMPLE.Aligned.out.bam. STAR concatenates the prefix straight onto
each output filename and is the convention every STAR wrapper assumes.
Change out_file_name_prefix to String and switch every consumer from
PathBuf::push to a string concatenation. Trailing-slash prefixes
(SAMPLE./) still work since "{prefix}X.bam" produces "SAMPLE./X.bam"
which is a valid path; the bare-dot case now produces
SAMPLE.X.bam at the top level, matching STAR.
Fixes scverse#26
Co-Authored-By: Claude <noreply@anthropic.com>
Author
|
Verified end-to-end on macOS/aarch64 against the rebuilt fix branch. Bare-dot prefix ( Top-level Trailing-slash prefix ( Still produces files inside the directory as expected; the fix didn't regress the directory-style usage. LGTM. |
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.
Summary
--outFileNamePrefix SAMPLE.(or any value not ending in/) was treated as a directory by rustar - outputs landed inSAMPLE./Aligned.out.bametc. STAR concatenates the prefix straight onto each output filename:SAMPLE.Aligned.out.bamat the top level. Every STAR wrapper assumes the latter convention; the directory behaviour breaks the output-glob convention nf-core/rnaseq and most STAR Snakemake wrappers rely on.Root cause:
out_file_name_prefixwas typed asPathBufand joined via.push("Aligned.out.bam"). That always treats the existing value as a directory component.Fix
Change the type to
Stringand concatenate at every output-write site:A small
Parameters::output_path("Aligned.out.bam")helper does this concatenation once so the call sites stay readable. The chimeric junction writer (which already took the prefix as&str) was usingPathBuf::pushinternally and is fixed the same way.Trailing-slash prefixes (
out/) still work -format!producesout/Aligned.out.bam, a valid path. The bare-dot case now producesSAMPLE.Aligned.out.bamat the top level, matching STAR.Test plan
Parameters::output_pathcover bare-dot, trailing-slash, default, and path-with-underscore prefixestest_bare_dot_prefix_is_literal_stringruns the binary with<run_dir>/SAMPLE.and assertsSAMPLE.Aligned.out.bam+SAMPLE.Log.final.outland at the top level and that noSAMPLE./directory is createdtest_chimeric_junction_writer_bare_dot_prefixcovers the same case forChimeric.out.junctiontests/alignment_features.rs,tests/phase9_threading.rs,tests/transcriptome_sam.rs) all already use trailing-slash prefixes and continue to pass unchangedcargo buildcargo clippy --lib -- -D warningscargo fmt --checkcargo test- all 402 tests pass (388 lib + 9 alignment_features + 4 phase9_threading + 1 transcriptome_sam)After this fix, no downstream wrapper needs the workaround that flattens
SAMPLE./back to STAR-style filenames after the run.Fixes #26