Skip to content

Commit

Permalink
implemented chocophlan and uniref modules & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonJM committed Feb 16, 2024
1 parent 1f65b55 commit e915675
Show file tree
Hide file tree
Showing 14 changed files with 335 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/local/humann/downloadchocophlandb/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::humann=3.8
47 changes: 47 additions & 0 deletions modules/local/humann/downloadchocophlandb/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process HUMANN_DOWNLOADCHOCOPHLANDB {
tag "${params.chocophlan_db_version}"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/humann:3.8--pyh7cba7a3_0':
'quay.io/biocontainers/humann:3.8--pyh7cba7a3_0' }"

output:
path "${prefix}/chocophlan/" , emit: chocophlan_db_dir
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "chocophlan_db_${params.chocophlan_db_version}"
"""
mkdir -p ${prefix}
https_proxy=http://klone-dip1-A-ib:3128
export https_proxy
humann_databases \\
--download chocophlan ${params.chocophlan_db_version} \\
${prefix} \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
humann: \$(echo \$(humann --version 2>&1 | sed 's/^.*humann //; s/Using.*\$//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "chocophlan_db_${params.chocophlan_db_version}"
"""
mkdir -p ${prefix}/chocophlan/
cat <<-END_VERSIONS > versions.yml
"${task.process}":
humann: \$(echo \$(humann --version 2>&1 | sed 's/^.*humann //; s/Using.*\$//' ))
END_VERSIONS
"""
}
5 changes: 5 additions & 0 deletions modules/local/humann/downloadchocophlandb/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: HUMANN_DOWNLOADCHOCOPHLANDB {
ext.args = "--update-config no"
}
}
46 changes: 46 additions & 0 deletions modules/local/humann/downloadchocophlandb/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
nextflow_process {

name "Test Process: HUMANN_DOWNLOADCHOCOPHLANDB"
script "../main.nf"
process "HUMANN_DOWNLOADCHOCOPHLANDB"

tag "modules"
tag "modules_local"
tag "humann"
tag "humann/downloadchocophlandb"


test(" chocophlan_db_version = 'DEMO' ") {

when {
params {
chocophlan_db_version = 'DEMO'
}
}

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

test(" chocophlan_db_version = 'DEMO' -stub ") {

options "-stub"

when {
params {
chocophlan_db_version = 'DEMO'
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
58 changes: 58 additions & 0 deletions modules/local/humann/downloadchocophlandb/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
" chocophlan_db_version = 'DEMO' ": {
"content": [
{
"0": [
[
"g__Bacteroides.s__Bacteroides_dorei.centroids.v201901_v31.ffn.gz:md5,c23ab47a3f0a34abd20f0b1826482c6d",
"g__Bacteroides.s__Bacteroides_vulgatus.centroids.v201901_v31.ffn.gz:md5,61a2c5aa5ff04e400147974852e5bcc2"
]
],
"1": [
"versions.yml:md5,3d4522d3366acea81c55007726662550"
],
"chocophlan_db_dir": [
[
"g__Bacteroides.s__Bacteroides_dorei.centroids.v201901_v31.ffn.gz:md5,c23ab47a3f0a34abd20f0b1826482c6d",
"g__Bacteroides.s__Bacteroides_vulgatus.centroids.v201901_v31.ffn.gz:md5,61a2c5aa5ff04e400147974852e5bcc2"
]
],
"versions": [
"versions.yml:md5,3d4522d3366acea81c55007726662550"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-02-16T13:49:34.969434147"
},
" chocophlan_db_version = 'DEMO' -stub ": {
"content": [
{
"0": [
[

]
],
"1": [
"versions.yml:md5,3d4522d3366acea81c55007726662550"
],
"chocophlan_db_dir": [
[

]
],
"versions": [
"versions.yml:md5,3d4522d3366acea81c55007726662550"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-02-16T13:49:44.337325581"
}
}
2 changes: 2 additions & 0 deletions modules/local/humann/downloadchocophlandb/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
humann/downloadchocophlandb:
- modules/local/humann/downloadchocophlandb/**
6 changes: 6 additions & 0 deletions modules/local/humann/downloadunirefdb/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::humann=3.8
47 changes: 47 additions & 0 deletions modules/local/humann/downloadunirefdb/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process HUMANN_DOWNLOADUNIREFDB {
tag "${params.uniref_db_version}"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/humann:3.8--pyh7cba7a3_0':
'quay.io/biocontainers/humann:3.8--pyh7cba7a3_0' }"

output:
path "${prefix}/uniref/" , emit: uniref_db_dir
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "uniref_db_${params.uniref_db_version}"
"""
mkdir -p ${prefix}
https_proxy=http://klone-dip1-A-ib:3128
export https_proxy
humann_databases \\
--download uniref ${params.uniref_db_version} \\
${prefix} \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
humann: \$(echo \$(humann --version 2>&1 | sed 's/^.*humann //; s/Using.*\$//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "uniref_db_${params.uniref_db_version}"
"""
mkdir -p ${prefix}/uniref/
cat <<-END_VERSIONS > versions.yml
"${task.process}":
humann: \$(echo \$(humann --version 2>&1 | sed 's/^.*humann //; s/Using.*\$//' ))
END_VERSIONS
"""
}
5 changes: 5 additions & 0 deletions modules/local/humann/downloadunirefdb/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: HUMANN_DOWNLOADUNIREFDB {
ext.args = "--update-config no"
}
}
46 changes: 46 additions & 0 deletions modules/local/humann/downloadunirefdb/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
nextflow_process {

name "Test Process: HUMANN_DOWNLOADUNIREFDB"
script "../main.nf"
process "HUMANN_DOWNLOADUNIREFDB"

tag "modules"
tag "modules_local"
tag "humann"
tag "humann/downloadunirefdb"


test(" uniref_db_version = 'DEMO_diamond' ") {

when {
params {
uniref_db_version = 'DEMO_diamond'
}
}

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

test(" uniref_db_version = 'DEMO_diamond' -stub ") {

options "-stub"

when {
params {
uniref_db_version = 'DEMO_diamond'
}
}

then {
assertAll (
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
56 changes: 56 additions & 0 deletions modules/local/humann/downloadunirefdb/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
" uniref_db_version = 'DEMO_diamond' ": {
"content": [
{
"0": [
[
"uniref90_demo_prots_v201901b.dmnd:md5,1d2f8df48a349d72436425aafa29a6b1"
]
],
"1": [
"versions.yml:md5,9701558bc32dc67749aad70c9a67960f"
],
"uniref_db_dir": [
[
"uniref90_demo_prots_v201901b.dmnd:md5,1d2f8df48a349d72436425aafa29a6b1"
]
],
"versions": [
"versions.yml:md5,9701558bc32dc67749aad70c9a67960f"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-02-16T14:04:05.712218097"
},
" uniref_db_version = 'DEMO_diamond' -stub ": {
"content": [
{
"0": [
[

]
],
"1": [
"versions.yml:md5,9701558bc32dc67749aad70c9a67960f"
],
"uniref_db_dir": [
[

]
],
"versions": [
"versions.yml:md5,9701558bc32dc67749aad70c9a67960f"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-02-16T14:04:13.931593633"
}
}
8 changes: 8 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ params {
metaphlan_options = null
metaphlan_sgb2gtbd_file = "https://github.com/biobakery/MetaPhlAn/raw/master/metaphlan/utils/mpa_vOct22_CHOCOPhlAnSGB_202212_SGB2GTDB.tsv"

// HUMAnN options
chocophlan_db_version ='DEMO'
uniref_db_version ='DEMO_diamond'
utility_mapping_version ='DEMO'

// MultiQC options
multiqc_config = null
multiqc_title = null
Expand Down Expand Up @@ -80,6 +85,9 @@ try {
System.err.println("WARNING: Could not load nf-core/config profiles: ${params.custom_config_base}/nfcore_custom.config")
}

// Workflow specific configs
includeConfig './workflows/biobakerymgx/nextflow.config'

// Load hofflab/biobakerymgx custom profiles from different institutions.
// Warning: Uncomment only if a pipeline-specific instititutional config already exists on nf-core/configs!
// try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includeConfig '../../../modules/local/humann/downloadchocophlandb/nextflow.config'
includeConfig '../../../modules/local/humann/downloadunirefdb/nextflow.config'
1 change: 1 addition & 0 deletions workflows/biobakerymgx/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
includeConfig "../../subworkflows/local/fastq_microbial_pathway_humann/nextflow.config"

0 comments on commit e915675

Please sign in to comment.