Skip to content
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

switch to using --write-index instead of samtools index #1338

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [#1338](https://github.com/nf-core/sarek/pull/1338) - Optimisation: switch `samtools index` to `--write-index` ([#1121](https://github.com/nf-core/sarek/issues/1121) )

### Fixed

- [#1334](https://github.com/nf-core/sarek/pull/1334) - Remove extra v, when reporting tower runs on slack
Expand Down
1 change: 1 addition & 0 deletions conf/modules/aligner.config
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ process {
}

withName: 'MERGE_BAM' {
ext.args = { "--write-index" }
ext.prefix = { "${meta.id}.sorted" }
}
}
4 changes: 4 additions & 0 deletions conf/modules/haplotypecaller.config
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,9 @@ process {
pattern: "*{bam,bai}"
]
}

withName: 'NFCORE_SAREK:SAREK:BAM_VARIANT_CALLING_GERMLINE_ALL:BAM_VARIANT_CALLING_HAPLOTYPECALLER:BAM_MERGE_INDEX_SAMTOOLS:MERGE_BAM' {
ext.args = { "--write-index" }
}
}
}
13 changes: 13 additions & 0 deletions conf/modules/ngscheckmate.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Config file for defining DSL2 per module options and publishing paths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Available keys to override module options:
ext.args = Additional arguments appended to command in module.
ext.args2 = Second set of arguments appended to command in module (multi-tool modules).
ext.args3 = Third set of arguments appended to command in module (multi-tool modules).
ext.prefix = File name prefix for output files.
ext.when = When to run the module.
----------------------------------------------------------------------------------------
*/

process {

withName: '.*BAM_NGSCHECKMATE:BCFTOOLS_MPILEUP' {
Expand Down
7 changes: 4 additions & 3 deletions conf/modules/recalibrate.config
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ process {

if ((params.step == 'mapping' || params.step == 'markduplicates'|| params.step == 'prepare_recalibration'|| params.step == 'recalibrate') && (!(params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator')))) {
withName: 'NFCORE_SAREK:SAREK:(BAM_APPLYBQSR|BAM_APPLYBQSR_SPARK):CRAM_MERGE_INDEX_SAMTOOLS:MERGE_CRAM' {
ext.args = { "--write-index" }
ext.prefix = { "${meta.id}.recal" }
ext.when = { meta.num_intervals > 1 }
publishDir = [
mode: params.publish_dir_mode,
mode: params.publish_dir_mode,
path: { "${params.outdir}/preprocessing/recalibrated/${meta.id}/" },
pattern: "*cram",
pattern: "*cram,*cram.crai",
saveAs: { !params.save_output_as_bam ? it : null }
]
}

withName: 'NFCORE_SAREK:SAREK:(BAM_APPLYBQSR|BAM_APPLYBQSR_SPARK):CRAM_MERGE_INDEX_SAMTOOLS:INDEX_CRAM' {
publishDir = [
mode: params.publish_dir_mode,
mode: params.publish_dir_mode,
path: { "${params.outdir}/preprocessing/recalibrated/${meta.id}/" },
pattern: "*{recal.cram,recal.cram.crai}",
saveAs: { !params.save_output_as_bam ? it : null }
Expand Down
6 changes: 2 additions & 4 deletions modules/nf-core/cnvkit/batch/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions modules/nf-core/gatk4/markduplicates/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions modules/nf-core/samtools/convert/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions modules/nf-core/samtools/merge/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions subworkflows/local/bam_merge_index_samtools/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ workflow BAM_MERGE_INDEX_SAMTOOLS {
// Only when using intervals
MERGE_BAM(bam_to_merge.multiple, [ [ id:'null' ], []], [ [ id:'null' ], []])

// Mix intervals and no_intervals channels together
bam_all = MERGE_BAM.out.bam.mix(bam_to_merge.single)
// Join with the bai file
bam_bai_merged = MERGE_BAM.out.bam.join(MERGE_BAM.out.bai)

// Index bam
INDEX_MERGE_BAM(bam_all)
// Index single bams, merged ones are indexed on the fly
INDEX_MERGE_BAM(bam_to_merge.single)
bam_bai_single = bam_to_merge.single.join(INDEX_MERGE_BAM.out.bai, failOnDuplicate: true, failOnMismatch: true)

// Join with the bai file
bam_bai = bam_all.join(INDEX_MERGE_BAM.out.bai, failOnDuplicate: true, failOnMismatch: true)
// Mix intervals and no_intervals channels together
bam_bai = bam_bai_merged.mix(bam_bai_single)

// Gather versions of all tools used
versions = versions.mix(INDEX_MERGE_BAM.out.versions)
Expand Down
13 changes: 7 additions & 6 deletions subworkflows/local/cram_merge_index_samtools/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ workflow CRAM_MERGE_INDEX_SAMTOOLS {
// Only when using intervals
MERGE_CRAM(cram_to_merge.multiple, fasta.map{ it -> [ [ id:'fasta' ], it ] }, fasta_fai.map{ it -> [ [ id:'fasta_fai' ], it ] })

// Mix intervals and no_intervals channels together
cram_all = MERGE_CRAM.out.cram.mix(cram_to_merge.single)
// Join with the crai file
cram_crai_merged = MERGE_CRAM.out.cram.join(MERGE_CRAM.out.crai)

// Index cram
INDEX_CRAM(cram_all)
// Index cram, multiple ones are indexed on the fly
INDEX_CRAM(cram_to_merge.single)
cram_crai_single = cram_to_merge.single.join(INDEX_CRAM.out.crai)

// Join with the crai file
cram_crai = cram_all.join(INDEX_CRAM.out.crai, failOnDuplicate: true, failOnMismatch: true)
// Mix intervals and no_intervals channels together
cram_crai = cram_crai_merged.mix(cram_crai_single)

// Gather versions of all tools used
versions = versions.mix(INDEX_CRAM.out.versions.first())
Expand Down