Skip to content

Commit

Permalink
Add bwa-meme (#5620)
Browse files Browse the repository at this point in the history
* add index

* add bwameme_mem

* Update modules/nf-core/bwameme/index/tests/main.nf.test

Co-authored-by: Annick Renevey <47788523+rannick@users.noreply.github.com>

---------

Co-authored-by: Annick Renevey <47788523+rannick@users.noreply.github.com>
  • Loading branch information
ramprasadn and rannick authored May 17, 2024
1 parent b632dcb commit 7948029
Show file tree
Hide file tree
Showing 14 changed files with 800 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/bwameme/index/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "bwameme_index"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::bwa-meme=1.0.6"
61 changes: 61 additions & 0 deletions modules/nf-core/bwameme/index/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
process BWAMEME_INDEX {
tag "$fasta"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bwa-meme:1.0.6--hdcf5f25_2':
'biocontainers/bwa-meme:1.0.6--hdcf5f25_2' }"

input:
tuple val(meta), path(fasta)

output:
tuple val(meta), path("bwameme"), emit: index
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${fasta}"
def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions.
"""
mkdir bwameme
bwa-meme index \\
$args \\
-t $task.cpus \\
-p bwameme/$prefix \\
$fasta
build_rmis_dna.sh bwameme/$prefix
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bwameme: $VERSION
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${fasta}"
def VERSION = '1.0.6' // WARN: Version information provided by tool on CLI is incorrect. Please update this string when bumping container versions.
"""
mkdir bwameme
touch bwameme/${prefix}.0123
touch bwameme/${prefix}.ann
touch bwameme/${prefix}.pac
touch bwameme/${prefix}.amb
touch bwameme/${prefix}.pos_packed
touch bwameme/${prefix}.suffixarray_uint64
touch bwameme/${prefix}.suffixarray_uint64_L0_PARAMETERS
touch bwameme/${prefix}.suffixarray_uint64_L1_PARAMETERS
touch bwameme/${prefix}.suffixarray_uint64_L2_PARAMETERS
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bwameme: $VERSION
END_VERSIONS
"""
}
44 changes: 44 additions & 0 deletions modules/nf-core/bwameme/index/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "bwameme_index"
description: Create BWA-MEME index for reference genome
keywords:
- index
- fasta
- genome
- reference
tools:
- "bwameme":
description: "Faster BWA-MEM2 using learned-index"
homepage: https://github.com/kaist-ina/BWA-MEME
documentation: https://github.com/kaist-ina/BWA-MEME#getting-started
doi: "10.1093/bioinformatics/btac137"
licence: ["MIT"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- fasta:
type: file
description: Input genome fasta file

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- index:
type: file
description: BWA-MEME genome index files
pattern: "*.{0123,amb,ann,pac,pos_packed,suffixarray_uint64,suffixarray_uint64_L0_PARAMETERS,suffixarray_uint64_L1_PARAMETERS,suffixarray_uint64_L2_PARAMETERS}"

authors:
- "@ramprasadn"
maintainers:
- "@ramprasadn"
59 changes: 59 additions & 0 deletions modules/nf-core/bwameme/index/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "bwameme"
tag "bwameme/index"

config "./nextflow.config"

test("BWAMEME index") {

when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("BWAMEME index - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[id: 'test'],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
108 changes: 108 additions & 0 deletions modules/nf-core/bwameme/index/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"BWAMEME index - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"genome.fasta.0123:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.amb:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.ann:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.pac:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.pos_packed:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d"
],
"index": [
[
{
"id": "test"
},
[
"genome.fasta.0123:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.amb:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.ann:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.pac:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.pos_packed:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e",
"genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-15T13:44:38.551252246"
},
"BWAMEME index": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8",
"genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e",
"genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567",
"genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66",
"genome.fasta.pos_packed:md5,3534bc04a547d02d6e4cb50908a40db9",
"genome.fasta.suffixarray_uint64:md5,51abb48f687661f88bf5bf5d370521e3",
"genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,ad6397d3d33bbb6a31b1320349e23274",
"genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,6c0d6dc7e733a7f373aa7b2730621aa4",
"genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,b2d4bad4e9f0e8960a0af12b7038ab1e"
]
]
],
"1": [
"versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d"
],
"index": [
[
{
"id": "test"
},
[
"genome.fasta.0123:md5,b02870de80106104abcb03cd9463e7d8",
"genome.fasta.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e",
"genome.fasta.ann:md5,c32e11f6c859f166c7525a9c1d583567",
"genome.fasta.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66",
"genome.fasta.pos_packed:md5,3534bc04a547d02d6e4cb50908a40db9",
"genome.fasta.suffixarray_uint64:md5,51abb48f687661f88bf5bf5d370521e3",
"genome.fasta.suffixarray_uint64_L0_PARAMETERS:md5,ad6397d3d33bbb6a31b1320349e23274",
"genome.fasta.suffixarray_uint64_L1_PARAMETERS:md5,6c0d6dc7e733a7f373aa7b2730621aa4",
"genome.fasta.suffixarray_uint64_L2_PARAMETERS:md5,b2d4bad4e9f0e8960a0af12b7038ab1e"
]
]
],
"versions": [
"versions.yml:md5,c80b8097b8a9c022e4c1e2617771ea3d"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-05-15T13:44:25.040725565"
}
}
7 changes: 7 additions & 0 deletions modules/nf-core/bwameme/index/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
process {

withName: BWAMEME_INDEX {
ext.args = '-a meme'
}

}
2 changes: 2 additions & 0 deletions modules/nf-core/bwameme/index/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bwameme/index:
- "modules/nf-core/bwameme/index/**"
11 changes: 11 additions & 0 deletions modules/nf-core/bwameme/mem/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "bwameme_mem"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::bwa-meme=1.0.6"
- "bioconda::mbuffer=20160228"
- "bioconda::samtools=1.20"
Loading

0 comments on commit 7948029

Please sign in to comment.