diff --git a/modules/local/humann/downloadchocophlandb/environment.yml b/modules/local/humann/downloadchocophlandb/environment.yml new file mode 100644 index 0000000..92f963f --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::humann=3.8 diff --git a/modules/local/humann/downloadchocophlandb/main.nf b/modules/local/humann/downloadchocophlandb/main.nf new file mode 100644 index 0000000..1d92d3a --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/main.nf @@ -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 + """ +} diff --git a/modules/local/humann/downloadchocophlandb/nextflow.config b/modules/local/humann/downloadchocophlandb/nextflow.config new file mode 100644 index 0000000..2356eed --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: HUMANN_DOWNLOADCHOCOPHLANDB { + ext.args = "--update-config no" + } +} diff --git a/modules/local/humann/downloadchocophlandb/tests/main.nf.test b/modules/local/humann/downloadchocophlandb/tests/main.nf.test new file mode 100644 index 0000000..db25223 --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/tests/main.nf.test @@ -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() } + ) + } + } +} diff --git a/modules/local/humann/downloadchocophlandb/tests/main.nf.test.snap b/modules/local/humann/downloadchocophlandb/tests/main.nf.test.snap new file mode 100644 index 0000000..6bfc0c4 --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/tests/main.nf.test.snap @@ -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" + } +} \ No newline at end of file diff --git a/modules/local/humann/downloadchocophlandb/tests/tags.yml b/modules/local/humann/downloadchocophlandb/tests/tags.yml new file mode 100644 index 0000000..a85f35b --- /dev/null +++ b/modules/local/humann/downloadchocophlandb/tests/tags.yml @@ -0,0 +1,2 @@ +humann/downloadchocophlandb: + - modules/local/humann/downloadchocophlandb/** diff --git a/modules/local/humann/downloadunirefdb/environment.yml b/modules/local/humann/downloadunirefdb/environment.yml new file mode 100644 index 0000000..92f963f --- /dev/null +++ b/modules/local/humann/downloadunirefdb/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::humann=3.8 diff --git a/modules/local/humann/downloadunirefdb/main.nf b/modules/local/humann/downloadunirefdb/main.nf new file mode 100644 index 0000000..5f9ad6c --- /dev/null +++ b/modules/local/humann/downloadunirefdb/main.nf @@ -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 + """ +} diff --git a/modules/local/humann/downloadunirefdb/nextflow.config b/modules/local/humann/downloadunirefdb/nextflow.config new file mode 100644 index 0000000..6be75c4 --- /dev/null +++ b/modules/local/humann/downloadunirefdb/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: HUMANN_DOWNLOADUNIREFDB { + ext.args = "--update-config no" + } +} diff --git a/modules/local/humann/downloadunirefdb/tests/main.nf.test b/modules/local/humann/downloadunirefdb/tests/main.nf.test new file mode 100644 index 0000000..7d0b2a2 --- /dev/null +++ b/modules/local/humann/downloadunirefdb/tests/main.nf.test @@ -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() } + ) + } + } +} diff --git a/modules/local/humann/downloadunirefdb/tests/main.nf.test.snap b/modules/local/humann/downloadunirefdb/tests/main.nf.test.snap new file mode 100644 index 0000000..5fc14d1 --- /dev/null +++ b/modules/local/humann/downloadunirefdb/tests/main.nf.test.snap @@ -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" + } +} \ No newline at end of file diff --git a/nextflow.config b/nextflow.config index 067cd91..ba10c83 100644 --- a/nextflow.config +++ b/nextflow.config @@ -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 @@ -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 { diff --git a/subworkflows/local/fastq_microbial_pathway_humann/nextflow.config b/subworkflows/local/fastq_microbial_pathway_humann/nextflow.config new file mode 100644 index 0000000..1a8763f --- /dev/null +++ b/subworkflows/local/fastq_microbial_pathway_humann/nextflow.config @@ -0,0 +1,2 @@ +includeConfig '../../../modules/local/humann/downloadchocophlandb/nextflow.config' +includeConfig '../../../modules/local/humann/downloadunirefdb/nextflow.config' diff --git a/workflows/biobakerymgx/nextflow.config b/workflows/biobakerymgx/nextflow.config index e69de29..4c02b2b 100644 --- a/workflows/biobakerymgx/nextflow.config +++ b/workflows/biobakerymgx/nextflow.config @@ -0,0 +1 @@ +includeConfig "../../subworkflows/local/fastq_microbial_pathway_humann/nextflow.config"