Skip to content

Commit

Permalink
Added BBMAP/REPAIR submodule (#7249)
Browse files Browse the repository at this point in the history
* New submodule: BBMAP/REPAIR

* BBMAP/repair snapshot added

* removed cpu setting in nextflow.config

---------

Co-authored-by: irongraft <[email protected]>
  • Loading branch information
mazzalab and tm4zza authored Jan 7, 2025
1 parent cb8e4c9 commit 7053802
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/bbmap/repair/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::bbmap=39.13"
57 changes: 57 additions & 0 deletions modules/nf-core/bbmap/repair/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
process BBMAP_REPAIR {
tag "$meta.id"
label 'process_single'
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bbmap:39.13--he5f24ec_1':
'biocontainers/bbmap:39.13--he5f24ec_1' }"

input:
tuple val(meta), path(reads)
val(interleave)

output:
tuple val(meta), path("*_repaired.fastq.gz") , emit: repaired
tuple val(meta), path("${prefix}_singleton.fastq.gz"), emit: singleton
path "versions.yml" , emit: versions
path "*.log" , emit: log

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
in_reads = ( interleave ) ? "in=${reads[0]}" : "in=${reads[0]} in2=${reads[1]}"
out_reads = ( interleave ) ? "out=${prefix}_repaired.fastq.gz outs=${prefix}_singleton.fastq.gz"
: "out=${prefix}_1_repaired.fastq.gz out2=${prefix}_2_repaired.fastq.gz outs=${prefix}_singleton.fastq.gz"
"""
maxmem=\$(echo \"$task.memory\"| sed 's/ GB/g/g')
repair.sh \\
-Xmx\$maxmem \\
$in_reads \\
$out_reads \\
threads=${task.cpus}
${args} \\
&> ${prefix}.repair.sh.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(repair.sh --version |& sed '2!d ; s/BBMap version //')
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}_1_repaired.fastq.gz
echo "" | gzip > ${prefix}_2_repaired.fastq.gz
echo "" | gzip > ${prefix}_singleton.fastq.gz
touch ${prefix}.repair.sh.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
repair.sh: \$(repair.sh --version |& sed '2!d ; s/BBMap version //')
END_VERSIONS
"""
}
67 changes: 67 additions & 0 deletions modules/nf-core/bbmap/repair/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "bbmap_repair"
description: Re-pairs reads that became disordered or had some mates eliminated.
keywords:
- paired reads re-pairing
- fastq
- preprocessing
tools:
- repair:
description: Repair.sh is a tool that re-pairs reads that became disordered or had some mates eliminated
tools.
homepage: https://jgi.doe.gov/data-and-tools/software-tools/bbtools/
documentation: https://jgi.doe.gov/data-and-tools/software-tools/bbtools/bb-tools-user-guide/
licence: ["UC-LBL license (see package)"]
identifier: biotools:bbmap

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- reads:
type: file
description: |
List of input paired end fastq files
pattern: "*.{fastq,fq}.gz"
- - interleave:
type: boolean
description: |
Indicates whether the input paired reads are interleaved or not
output:
- repaired:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*_repaired.fastq.gz":
type: file
description: re-paired reads
pattern: "*_repaired.fastq.gz"
- singleton:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "${prefix}_singleton.fastq.gz":
type: file
description: singleton reads
pattern: "*singleton.fastq.gz"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
- log:
- "*.log":
type: file
description: log file containing stdout and stderr from repair.sh
pattern: "*.log"
authors:
- "@mazzalab"
maintainers:
- "@mazzalab"
- "@tm4zza"
115 changes: 115 additions & 0 deletions modules/nf-core/bbmap/repair/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
nextflow_process {

name "Test Process BBMAP_REPAIR"
script "../main.nf"
process "BBMAP_REPAIR"

tag "modules"
tag "modules_nfcore"
tag "bbmap"
tag "bbmap/repair"

test("sarscov2_illumina_paired - fastq_gz") {
config "./nextflow.config"

when {
params {
module_args = 'qin=33'
}
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)]
]
input[1] = false
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() }
)
}
}

test("sarscov2_illumina_interleaved - fastq_gz") {
config "./nextflow.config"

when {
params {
module_args = 'qin=33'
}
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true)]
]
input[1] = true
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() }
)
}
}

test("sarscov2_illumina_paired - fastq_gz - stub") {
config "./nextflow.config"
options "-stub"

when {
params {
module_args = 'qin=33'
}
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)]
]
input[1] = false
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("sarscov2_illumina_interleaved - fastq_gz - stub") {
config "./nextflow.config"
options "-stub"

when {
params {
module_args = 'qin=33'
}
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true)]
]
input[1] = true
"""
}
}
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
Loading

0 comments on commit 7053802

Please sign in to comment.