Add thread option to samtools modules (#1069)

* add thread option to samtools modules

* fix tests

* fix tests

* fix tests

* Fix naming to fix tests

* cpus-1 to account for mainthread

* remove thread in ampliconclip, docu doesn't report this param

* add -1 to all other applicable samtools modules

* Update samtools version

* Update checksums

* retrigger GHA after update

* Update modules/samtools/fastq/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/fixmate/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/flagstat/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/index/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/merge/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/stats/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Update modules/samtools/view/main.nf

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>

* Fix md5sum fixmate

* Fix md5sums

* sth funny with the fixmate checksums

* more md5sums updates

Co-authored-by: Patrick Hüther <patrick.huether@gmail.com>
This commit is contained in:
FriederikeHanssen 2021-11-18 22:24:47 +01:00 committed by GitHub
parent 4e5b6ed843
commit 19035c99d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 79 additions and 76 deletions

View file

@ -11,11 +11,11 @@ process SAMTOOLS_AMPLICONCLIP {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::samtools=1.13" : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -38,7 +38,6 @@ process SAMTOOLS_AMPLICONCLIP {
samtools \\
ampliconclip \\
$options.args \\
-@ $task.cpus \\
$rejects \\
$stats \\
-b $bed \\

View file

@ -11,11 +11,11 @@ process SAMTOOLS_FAIDX {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:

View file

@ -11,11 +11,11 @@ process SAMTOOLS_FASTQ {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -23,7 +23,7 @@ process SAMTOOLS_FASTQ {
output:
tuple val(meta), path("*.fastq.gz"), emit: fastq
path "versions.yml" , emit: versions
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
@ -32,7 +32,7 @@ process SAMTOOLS_FASTQ {
"""
samtools fastq \\
$options.args \\
-@ $task.cpus \\
--threads ${task.cpus-1} \\
$endedness \\
$bam
cat <<-END_VERSIONS > versions.yml

View file

@ -33,7 +33,7 @@ process SAMTOOLS_FIXMATE {
samtools \\
fixmate \\
$options.args \\
-@ $task.cpus \\
--threads ${task.cpus-1} \\
$bam \\
${prefix}.bam \\

View file

@ -11,11 +11,11 @@ process SAMTOOLS_FLAGSTAT {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -27,7 +27,7 @@ process SAMTOOLS_FLAGSTAT {
script:
"""
samtools flagstat $bam > ${bam}.flagstat
samtools flagstat --threads ${task.cpus-1} $bam > ${bam}.flagstat
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -11,11 +11,11 @@ process SAMTOOLS_IDXSTATS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:

View file

@ -11,11 +11,11 @@ process SAMTOOLS_INDEX {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -29,7 +29,8 @@ process SAMTOOLS_INDEX {
script:
"""
samtools index $options.args $input
samtools index -@ ${task.cpus-1} $options.args $input
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -11,11 +11,11 @@ process SAMTOOLS_MERGE {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -32,7 +32,8 @@ process SAMTOOLS_MERGE {
def file_type = input_files[0].getExtension()
def reference = fasta ? "--reference ${fasta}" : ""
"""
samtools merge ${reference} ${prefix}.${file_type} $input_files
samtools merge --threads ${task.cpus-1} $options.args ${reference} ${prefix}.${file_type} $input_files
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -11,11 +11,11 @@ process SAMTOOLS_MPILEUP {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:

View file

@ -11,11 +11,11 @@ process SAMTOOLS_SORT {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:

View file

@ -11,11 +11,11 @@ process SAMTOOLS_STATS {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -29,7 +29,8 @@ process SAMTOOLS_STATS {
script:
def reference = fasta ? "--reference ${fasta}" : ""
"""
samtools stats ${reference} ${input} > ${input}.stats
samtools stats --threads ${task.cpus-1} ${reference} ${input} > ${input}.stats
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -11,11 +11,11 @@ process SAMTOOLS_VIEW {
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::samtools=1.13' : null)
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/samtools:1.13--h8c37831_0"
container "https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0"
} else {
container "quay.io/biocontainers/samtools:1.13--h8c37831_0"
container "quay.io/biocontainers/samtools:1.14--hb421002_0"
}
input:
@ -23,16 +23,17 @@ process SAMTOOLS_VIEW {
path fasta
output:
tuple val(meta), path("*.bam") , optional: true, emit: bam
tuple val(meta), path("*.cram"), optional: true, emit: cram
path "versions.yml" , emit: versions
tuple val(meta), path("*.bam") , emit: bam , optional: true
tuple val(meta), path("*.cram"), emit: cram, optional: true
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def reference = fasta ? "--reference ${fasta} -C" : ""
def file_type = input.getExtension()
"""
samtools view ${reference} $options.args $input > ${prefix}.${file_type}
samtools view --threads ${task.cpus-1} ${reference} $options.args $input > ${prefix}.${file_type}
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')

View file

@ -7,7 +7,7 @@
- samtools/ampliconclip
files:
- path: output/samtools/test.bam
md5sum: 1c705ebe39f68f1dac164733ae99c9d2
md5sum: 678f9ab04fbe3206f0f96e170fd833e9
- name: samtools ampliconclip no stats with rejects
command: nextflow run ./tests/modules/samtools/ampliconclip -entry test_samtools_ampliconclip_no_stats_with_rejects -c tests/config/nextflow.config
@ -16,9 +16,9 @@
- samtools/ampliconclip
files:
- path: output/samtools/test.bam
md5sum: 86c7bfb5378d57b16855c5b399000b2a
md5sum: bbf65ea626539d96c8271e17d1fc988b
- path: output/samtools/test.cliprejects.bam
md5sum: 8e2eea2c0005b4d4e77c0eb549599133
md5sum: a0bee15aead020d16d0c81bd9667df46
- name: samtools ampliconclip with stats with rejects
command: nextflow run ./tests/modules/samtools/ampliconclip -entry test_samtools_ampliconclip_with_stats_with_rejects -c tests/config/nextflow.config
@ -27,8 +27,8 @@
- samtools/ampliconclip
files:
- path: output/samtools/test.bam
md5sum: d96f5eebef0ff4635e68090e89756d4a
md5sum: f5a3611ecad34ba2dde77096e1c7dd93
- path: output/samtools/test.cliprejects.bam
md5sum: ad83a523d6ff1c58caade4ddafbaaed7
md5sum: 90ee7ce908b4bdb89ab41e4410de9012
- path: output/samtools/test.clipstats.txt
md5sum: 6fbde83d658cd2813b79900d33800d1d
md5sum: fc23355e1743d47f2541f2cb1a7a0cda

View file

@ -1,8 +1,8 @@
- name: samtools fixmate test_samtools_fixmate
command: nextflow run tests/modules/samtools/fixmate -entry test_samtools_fixmate -c tests/config/nextflow.config
tags:
- samtools/fixmate
- samtools
- samtools/fixmate
files:
- path: output/samtools/test.bam
md5sum: 92c8463710cdcaef2010aa02ed9e01fd
md5sum: a4092657a4b17170c7702a76cbf192a1

View file

@ -1,4 +1,4 @@
- name: samtools index bai
- name: samtools index test_samtools_index_bai
command: nextflow run tests/modules/samtools/index -entry test_samtools_index_bai -c tests/config/nextflow.config
tags:
- samtools
@ -7,7 +7,7 @@
- path: output/samtools/test.paired_end.sorted.bam.bai
md5sum: 704c10dd1326482448ca3073fdebc2f4
- name: samtools index crai
- name: samtools index test_samtools_index_crai
command: nextflow run tests/modules/samtools/index -entry test_samtools_index_crai -c tests/config/nextflow.config
tags:
- samtools
@ -16,7 +16,7 @@
- path: output/samtools/test.paired_end.recalibrated.sorted.cram.crai
md5sum: 537e3d8c937bcc4e34e1cf47cd71d484
- name: samtools index csi
- name: samtools index test_samtools_index_csi
command: nextflow run tests/modules/samtools/index -entry test_samtools_index_csi -c tests/config/nextflow.config
tags:
- samtools

View file

@ -1,15 +1,15 @@
- name: samtools merge test_samtools_merge
command: nextflow run tests/modules/samtools/merge -entry test_samtools_merge -c tests/config/nextflow.config
tags:
- samtools/merge
- samtools
- samtools/merge
files:
- path: output/samtools/test_merged.bam
- name: samtools merge test_samtools_merge_cram
command: nextflow run tests/modules/samtools/merge -entry test_samtools_merge_cram -c tests/config/nextflow.config
tags:
- samtools/merge
- samtools
- samtools/merge
files:
- path: output/samtools/test_merged.cram

View file

@ -5,4 +5,4 @@
- samtools/sort
files:
- path: output/samtools/test.sorted.bam
md5sum: bbb2db225f140e69a4ac577f74ccc90f
md5sum: 4adc495469724a375d5e1a9f3485e38d

View file

@ -14,9 +14,9 @@ workflow test_samtools_stats {
}
workflow test_samtools_stats_cram {
input = [ [ id: 'test' ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true)
input = [ [ id: 'test', single_end:true ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true)
]
fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)

View file

@ -1,17 +1,17 @@
- name: samtools stats test_samtools_stats
command: nextflow run tests/modules/samtools/stats -entry test_samtools_stats -c tests/config/nextflow.config
tags:
- samtools
- samtools/stats
- samtools
files:
- path: output/samtools/test.paired_end.sorted.bam.stats
md5sum: a7f36cf11fd3bf97e0a0ae29c0627296
md5sum: 09146eeecfcae2a84fb8615c86cd8d64
- name: samtools stats test_samtools_stats_cram
command: nextflow run tests/modules/samtools/stats -entry test_samtools_stats_cram -c tests/config/nextflow.config
tags:
- samtools
- samtools/stats
- samtools
files:
- path: output/samtools/test.paired_end.recalibrated.sorted.cram.stats
md5sum: bd55a1da30028403f4b66dacf7a2a20e
md5sum: 62377b29c3f6253e37308a28d13a496d

View file

@ -37,7 +37,7 @@
- path: ./output/samtools/test.sorted.bam.idxstats
md5sum: e16eb632f7f462514b0873c7ac8ac905
- path: ./output/samtools/test.sorted.bam.stats
md5sum: 2d837cd72432cd856fca70d33f02ffb5
md5sum: d9eb909c2cde69d6ae83999a72d770d7
- name: align bowtie2 paired-end
command: nextflow run ./tests/subworkflows/nf-core/align_bowtie2 -entry test_align_bowtie2_paired_end -c tests/config/nextflow.config
@ -78,4 +78,4 @@
- path: ./output/samtools/test.sorted.bam.idxstats
md5sum: 29ff2fa56d35b2a47625b8f517f1a947
- path: ./output/samtools/test.sorted.bam.stats
md5sum: 98aa88a39d26244c89bd4e577953fb48
md5sum: d0c7a1a4fbd2c1aed437ca419a9e344f

View file

@ -4,15 +4,15 @@
- subworkflows/bam_sort_samtools
- subworkflows/bam_stats_samtools
# Modules
# - samtools
# - samtools/index
# - samtools/sort
# - samtools/stats
# - samtools/idxstats
# - samtools/flagstat
- samtools
- samtools/index
- samtools/sort
- samtools/stats
- samtools/idxstats
- samtools/flagstat
files:
- path: ./output/samtools/test.sorted.bam
md5sum: e4c77897d6824ce4df486d1b100618af
md5sum: 8b56bb7d26ced04112f712250d915aaa
- path: ./output/samtools/test.sorted.bam.bai
md5sum: a70940ce9ba2e700ec2984e0a6526099
# samtools stats
@ -36,7 +36,7 @@
# - samtools/flagstat
files:
- path: ./output/samtools/test.sorted.bam
md5sum: bbb2db225f140e69a4ac577f74ccc90f
md5sum: 4adc495469724a375d5e1a9f3485e38d
- path: ./output/samtools/test.sorted.bam.bai
md5sum: 20c91e3a0fd4661d7cb967f40d2486ba
# samtools stats