-
Notifications
You must be signed in to change notification settings - Fork 953
add writing index option to samtools sort #8895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…into samtools_sort merge
|
@nf-core-bot update gpu snapshot path: subworkflows/nf-core/fastq_align_dedup_bwameth |
fellen31
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one thing.
| args.contains("--output-fmt cram") ? "cram" : | ||
| "bam" | ||
| reference = fasta ? "--reference ${fasta}" : "" | ||
| output_file = index_format ? "${prefix}.${extension}##idx##${prefix}.${extension}.${index_format} --write-index" : "${prefix}.${extension}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a check for this here and in the stub.
if (index_format) {
if (!index_format.matches('bai|csi|crai')) {
error "Index format not one of bai, csi, crai."
} else if (extension == "sam") {
error "Indexing not compatible with SAM output"
}
}
Since technically, index_format can be anything, but we only have outputs for bai, crai, csi (I'm team emit: index, but that's another discussion).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I would also prefer a simple emit: index option. Either way, I've added the check like this.
|
@fellen31 Thanks for reviewing! So it's all good to merge once checks are complete or does it need approval of anyone else first still? |
|
I say good to merge! Perhaps some extra care could be taken since changing samtools sort might affect many pipelines, but we had the discussion already for samtools view and came to a conclusion (#4326), and this implementation is exactly the same. |
This adds the ability to include an index of choice using
samtools sort. Currently it was only possible to use theext.args = "--write-index"which will only output a.csiindex. This adds a newvalchannel input that will output the selected bam/sam/cram index. If the channel is left empty''no index will be written and the old behaviour is maintained.This is the same as the use case in the latest version of
samtools/viewandminimap2/alignand will reduce a lot of unecessarySAMTOOLS_SORTintoSAMTOOLS_INDEXprocesses.Due to many modules/subworkflows use
samtools sort(for instance inBAM_SORT_STATS_SAMTOOLS), other tests are also updated to include an empty third input channel to maintain the old behaviour.Optionally
BAM_SORT_STATS_SAMTOOLScan also be updated to now entirely skipSAMTOOLS_INDEXand simply directly write thebaiindex withinSAMTOOLS_SORTPR checklist
Closes #XXX
versions.ymlfile.labelnf-core modules test <MODULE> --profile dockernf-core modules test <MODULE> --profile singularitynf-core modules test <MODULE> --profile condanf-core subworkflows test <SUBWORKFLOW> --profile dockernf-core subworkflows test <SUBWORKFLOW> --profile singularitynf-core subworkflows test <SUBWORKFLOW> --profile conda