samtools/merge: emit .bai/.crai index files by default (fixes #4261) - #12859
Conversation
SPPearce
left a comment
There was a problem hiding this comment.
What happens if the bam/cram files are not in coordinate sort order?
|
Now I could be convinced to have an input channel to make the indexes, rather than the horrific --write-index mess. |
|
Thanks for the review, @SPPearce. That's a great point about the sorting edge cases, and I agree on dropping the If we handle this through the input channel, would adding an optional boolean (like Let me know how you'd prefer the input signature structured so we don't break existing pipelines, and I'll get the PR updated! |
|
Hi @ramakrishna-p21 , can you take a look at how samtools/sort implements this, with the input channel there. |
|
Also please join the community via the slack channel github-invitations. |
Replaces hardcoded --write-index with an explicit index_format input, mirroring the samtools/sort architecture. Updates module tests and bam_applybqsr subworkflow.
|
Hey @SPPearce, I've refactored the module to use the index_format input channel, matching the samtools/sort architecture exactly. I also updated the downstream bam_applybqsr subworkflow to dynamically pass crai or bai based on the output format, and regenerated all tests and snapshots. Please take a look at the updated changes when you have a moment. Also, I've just submitted my GitHub invitation request in the slack channel as suggested! |
Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
… bam_applybqsr snapshots Generated by Antigravity
|
Hi @SPPearce, I've updated everything based on your feedback:
Local tests and linting are all green. Let me know if you spot anything else! |
SPPearce
left a comment
There was a problem hiding this comment.
Thanks!
Minor tweak to use the test data param.
Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
|
Huh, looks like that didn't work. So just put it back to how it was |
Generated by Antigravity
|
Done, put it back to how it was! Tests and linting are all green again. Feel free to merge whenever you're ready! |
PR checklist
Closes #4261
topic: versions- See version_topicslabelnf-core modules test samtools/merge --profile dockerDescription of Changes
This PR updates
samtools/mergeto automatically generate and emit index files (.baifor BAM and.craifor CRAM) alongside the merged alignment file, resolving #4261.Key Modifications
main.nf: Added--write-indexand##idx##syntax to thesamtools mergecommand execution to emit.baifor BAM files and.craifor CRAM files by default. Updated thestub:block to touch the corresponding index file.meta.yml: Updated documentation for the emittedindexchannel pattern.tests/main.nf.test: Removed manual--write-indexoverrides from module test configs.tests/main.nf.test.snap: Refreshed snapshots to reflect the generated.baiand.craiindices.Note: Developed and verified with assistance from Antigravity. All test fixtures, linting, and biological logic were manually reviewed and validated against nf-test.