From d3b3d270e4424ffc50eaa03dceab195504e9ae30 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Mon, 10 Jun 2024 16:27:17 +0200 Subject: [PATCH 01/16] Post release version bump --- CHANGELOG.md | 12 ++++++++++++ assets/multiqc_config.yml | 4 ++-- nextflow.config | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1107406f..bd58f661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## dev [unreleased] + +### `Added` + +### `Changed` + +### `Fixed` + +### `Dependencies` + +### `Deprecated` + ## 3.0.1 [2024-06-10] ### `Added` diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index 14f8ba03..9f4e5e7e 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -1,7 +1,7 @@ report_comment: > - This report has been generated by the nf-core/mag + This report has been generated by the nf-core/mag analysis pipeline. For information about how to interpret these results, please see the - documentation. + documentation. report_section_order: "nf-core-mag-methods-description": order: -1000 diff --git a/nextflow.config b/nextflow.config index 051be69d..7b8b1bc8 100644 --- a/nextflow.config +++ b/nextflow.config @@ -390,7 +390,7 @@ manifest { description = """Assembly, binning and annotation of metagenomes""" mainScript = 'main.nf' nextflowVersion = '!>=23.04.0' - version = '3.0.1' + version = '3.0.2dev' doi = '10.1093/nargab/lqac007' } From ec7eda679b99a2e27708d3a3d057c6062f6049e7 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 20 Jun 2024 15:19:35 +0200 Subject: [PATCH 02/16] Get BUSCO to use --offline mode if a database is supplied --- bin/run_busco.sh | 14 +++++++++----- conf/modules.config | 3 +++ modules/local/busco.nf | 12 +++++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/bin/run_busco.sh b/bin/run_busco.sh index 4f8d6c86..b0864e22 100755 --- a/bin/run_busco.sh +++ b/bin/run_busco.sh @@ -11,6 +11,7 @@ bin=$4 task_cpus=$5 lineage_dataset_provided=$6 busco_clean=$7 +extra_args=$8 # ensure augustus has write access to config directory if [ ${cp_augustus_config} = "Y" ]; then @@ -30,11 +31,14 @@ shopt -s nullglob # only used for saving busco downloads most_spec_db="NA" -if busco ${p} \ - --mode genome \ - --in ${bin} \ - --cpu ${task_cpus} \ - --out "BUSCO" >${bin}_busco.log 2>${bin}_busco.err; then +if + busco ${p} \ + --mode genome \ + --in ${bin} \ + --cpu ${task_cpus} \ + ${extra_args} \ + --out "BUSCO" >${bin}_busco.log 2>${bin}_busco.err +then # get name of used specific lineage dataset summaries=(BUSCO/short_summary.specific.*.BUSCO.txt) diff --git a/conf/modules.config b/conf/modules.config index a3be8574..01431e43 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -360,6 +360,9 @@ process { } withName: 'BUSCO' { + ext.args = [ + params.busco_db ? '--offline' : '' + ].join(' ').trim() publishDir = [ path: { "${params.outdir}/GenomeBinning/QC/BUSCO" }, mode: params.publish_dir_mode, diff --git a/modules/local/busco.nf b/modules/local/busco.nf index 014046f0..4d0a561d 100644 --- a/modules/local/busco.nf +++ b/modules/local/busco.nf @@ -23,6 +23,7 @@ process BUSCO { path "versions.yml" , emit: versions script: + def args = task.ext.args ?: '' def cp_augustus_config = workflow.profile.toString().indexOf("conda") != -1 ? "N" : "Y" def lineage_dataset_provided = "${db_meta.lineage}" def busco_clean = params.busco_clean ? "Y" : "N" @@ -36,7 +37,16 @@ process BUSCO { lineage_dataset_provided = "" } """ - run_busco.sh "${p}" "${cp_augustus_config}" "${db}" "${bin}" ${task.cpus} "${lineage_dataset_provided}" "${busco_clean}" + run_busco.sh \\ + "${p}" \\ + "${cp_augustus_config}" \\ + "${db}" \\ + "${bin}" \\ + ${task.cpus} \\ + "${lineage_dataset_provided}" \\ + "${busco_clean}" \\ + "${args}" + most_spec_db=\$( versions.yml From b5b98a14404ed7814f8232ac7d0783328d7e188b Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 20 Jun 2024 16:16:56 +0200 Subject: [PATCH 03/16] Formatting --- conf/modules.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 01431e43..3075922c 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -361,8 +361,8 @@ process { withName: 'BUSCO' { ext.args = [ - params.busco_db ? '--offline' : '' - ].join(' ').trim() + params.busco_db ? '--offline' : '' + ].join(' ').trim() publishDir = [ path: { "${params.outdir}/GenomeBinning/QC/BUSCO" }, mode: params.publish_dir_mode, From b324554bb5452d90418e481c9594a3de77d1a90b Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 14:35:35 +0200 Subject: [PATCH 04/16] Update CONCOCT workflow to remove mismatch --- CHANGELOG.md | 2 + modules.json | 12 +- .../nf-core/concoct/concoct/environment.yml | 7 + modules/nf-core/concoct/concoct/main.nf | 23 +- modules/nf-core/concoct/concoct/meta.yml | 9 +- .../concoct/concoct/tests/main.nf.test | 105 +++++++++ .../concoct/concoct/tests/main.nf.test.snap | 173 ++++++++++++++ .../nf-core/concoct/concoct/tests/tags.yml | 2 + .../concoctcoveragetable/environment.yml | 7 + .../concoct/concoctcoveragetable/main.nf | 18 +- .../concoct/concoctcoveragetable/meta.yml | 7 +- .../concoctcoveragetable/tests/main.nf.test | 84 +++++++ .../tests/main.nf.test.snap | 70 ++++++ .../concoctcoveragetable/tests/tags.yml | 2 + .../concoct/cutupfasta/environment.yml | 7 + modules/nf-core/concoct/cutupfasta/main.nf | 20 +- modules/nf-core/concoct/cutupfasta/meta.yml | 7 +- .../concoct/cutupfasta/tests/main.nf.test | 60 +++++ .../cutupfasta/tests/main.nf.test.snap | 84 +++++++ .../nf-core/concoct/cutupfasta/tests/tags.yml | 2 + .../concoct/extractfastabins/environment.yml | 7 + .../nf-core/concoct/extractfastabins/main.nf | 19 +- .../nf-core/concoct/extractfastabins/meta.yml | 8 +- .../extractfastabins/tests/main.nf.test | 124 ++++++++++ .../extractfastabins/tests/main.nf.test.snap | 72 ++++++ .../concoct/extractfastabins/tests/tags.yml | 2 + .../mergecutupclustering/environment.yml | 7 + .../concoct/mergecutupclustering/main.nf | 19 +- .../concoct/mergecutupclustering/meta.yml | 7 +- .../mergecutupclustering/tests/main.nf.test | 107 +++++++++ .../tests/main.nf.test.snap | 70 ++++++ .../mergecutupclustering/tests/tags.yml | 2 + .../nf-core/fasta_binning_concoct/main.nf | 2 +- .../fasta_binning_concoct/tests/main.nf.test | 46 ++++ .../tests/main.nf.test.snap | 223 ++++++++++++++++++ 35 files changed, 1372 insertions(+), 44 deletions(-) create mode 100644 modules/nf-core/concoct/concoct/environment.yml create mode 100644 modules/nf-core/concoct/concoct/tests/main.nf.test create mode 100644 modules/nf-core/concoct/concoct/tests/main.nf.test.snap create mode 100644 modules/nf-core/concoct/concoct/tests/tags.yml create mode 100644 modules/nf-core/concoct/concoctcoveragetable/environment.yml create mode 100644 modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test create mode 100644 modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test.snap create mode 100644 modules/nf-core/concoct/concoctcoveragetable/tests/tags.yml create mode 100644 modules/nf-core/concoct/cutupfasta/environment.yml create mode 100644 modules/nf-core/concoct/cutupfasta/tests/main.nf.test create mode 100644 modules/nf-core/concoct/cutupfasta/tests/main.nf.test.snap create mode 100644 modules/nf-core/concoct/cutupfasta/tests/tags.yml create mode 100644 modules/nf-core/concoct/extractfastabins/environment.yml create mode 100644 modules/nf-core/concoct/extractfastabins/tests/main.nf.test create mode 100644 modules/nf-core/concoct/extractfastabins/tests/main.nf.test.snap create mode 100644 modules/nf-core/concoct/extractfastabins/tests/tags.yml create mode 100644 modules/nf-core/concoct/mergecutupclustering/environment.yml create mode 100644 modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test create mode 100644 modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test.snap create mode 100644 modules/nf-core/concoct/mergecutupclustering/tests/tags.yml create mode 100644 subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test create mode 100644 subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test.snap diff --git a/CHANGELOG.md b/CHANGELOG.md index bd58f661..a0ae919a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` +- [#630](https://github.com/nf-core/mag/pull/630) - Fix CONCOCT empty bins killing the pipeline, and allow for true multithreading again (removing OPENBLAS loop) (reported by @maxibor, fix by @jfy133) + ### `Dependencies` ### `Deprecated` diff --git a/modules.json b/modules.json index cabd3125..313bcbc3 100644 --- a/modules.json +++ b/modules.json @@ -64,27 +64,27 @@ }, "concoct/concoct": { "branch": "master", - "git_sha": "c684a6edba2c8516a0d2cfeafb12489b99d2fffb", + "git_sha": "baa30accc6c50ea8a98662417d4f42ed18966353", "installed_by": ["fasta_binning_concoct"] }, "concoct/concoctcoveragetable": { "branch": "master", - "git_sha": "36aa9d3ce6561d9bd5c240bcf82fe109af543c0d", + "git_sha": "baa30accc6c50ea8a98662417d4f42ed18966353", "installed_by": ["fasta_binning_concoct"] }, "concoct/cutupfasta": { "branch": "master", - "git_sha": "36aa9d3ce6561d9bd5c240bcf82fe109af543c0d", + "git_sha": "73a6d7e6077b88aba1c5d6805635d79d6718270c", "installed_by": ["fasta_binning_concoct"] }, "concoct/extractfastabins": { "branch": "master", - "git_sha": "36aa9d3ce6561d9bd5c240bcf82fe109af543c0d", + "git_sha": "baa30accc6c50ea8a98662417d4f42ed18966353", "installed_by": ["fasta_binning_concoct"] }, "concoct/mergecutupclustering": { "branch": "master", - "git_sha": "36aa9d3ce6561d9bd5c240bcf82fe109af543c0d", + "git_sha": "baa30accc6c50ea8a98662417d4f42ed18966353", "installed_by": ["fasta_binning_concoct"] }, "custom/dumpsoftwareversions": { @@ -243,7 +243,7 @@ "nf-core": { "fasta_binning_concoct": { "branch": "master", - "git_sha": "cfd937a668919d948f6fcbf4218e79de50c2f36f", + "git_sha": "373d3e2f5ce7f215977826d358c461078c8e1057", "installed_by": ["subworkflows"] }, "utils_nextflow_pipeline": { diff --git a/modules/nf-core/concoct/concoct/environment.yml b/modules/nf-core/concoct/concoct/environment.yml new file mode 100644 index 00000000..af1c59f0 --- /dev/null +++ b/modules/nf-core/concoct/concoct/environment.yml @@ -0,0 +1,7 @@ +name: concoct_concoct +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::concoct=1.1.0 diff --git a/modules/nf-core/concoct/concoct/main.nf b/modules/nf-core/concoct/concoct/main.nf index 536d195d..958defd8 100644 --- a/modules/nf-core/concoct/concoct/main.nf +++ b/modules/nf-core/concoct/concoct/main.nf @@ -3,10 +3,10 @@ process CONCOCT_CONCOCT { tag "$meta.id" label 'process_high' - conda "bioconda::concoct=1.1.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py311h245ed52_4': - 'biocontainers/concoct:1.1.0--py311h245ed52_4' }" + 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py312h245ed52_6': + 'biocontainers/concoct:1.1.0--py312h245ed52_6' }" input: tuple val(meta), path(coverage_file), path(fasta) @@ -39,4 +39,21 @@ process CONCOCT_CONCOCT { concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_args.txt + touch ${prefix}_clustering_gt1000.csv + touch ${prefix}_log.txt + touch ${prefix}_original_data_gt1000.csv + touch ${prefix}_PCA_components_data_gt1000.csv + touch ${prefix}_PCA_transformed_data_gt1000.csv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/concoct/concoct/meta.yml b/modules/nf-core/concoct/concoct/meta.yml index 25192f7a..d92455cf 100644 --- a/modules/nf-core/concoct/concoct/meta.yml +++ b/modules/nf-core/concoct/concoct/meta.yml @@ -17,15 +17,14 @@ tools: documentation: "https://concoct.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/BinPro/CONCOCT" doi: "10.1038/nmeth.3103" - licence: "['FreeBSD']" - + licence: ["FreeBSD"] input: - meta: type: map description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - coverage: + - coverage_file: type: file description: Subcontig coverage TSV table (typically generated with concoct_coverage_table.py) pattern: "*.tsv" @@ -33,7 +32,6 @@ input: type: file description: FASTA file containing subcontigs (typically generated with cutup_fasta.py) pattern: "*.fasta" - output: - meta: type: map @@ -68,6 +66,7 @@ output: type: file description: Transformed PCA compontent values pattern: "*_PCA_transformed_data_gt1000.csv" - authors: - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/concoct/concoct/tests/main.nf.test b/modules/nf-core/concoct/concoct/tests/main.nf.test new file mode 100644 index 00000000..a979ebe3 --- /dev/null +++ b/modules/nf-core/concoct/concoct/tests/main.nf.test @@ -0,0 +1,105 @@ +nextflow_process { + + name "Test Process CONCOCT_CONCOCT" + script "../main.nf" + process "CONCOCT_CONCOCT" + + tag "modules" + tag "modules_nfcore" + tag "concoct" + tag "concoct/concoct" + tag "concoct/cutupfasta" + tag "concoct/concoctcoveragetable" + + setup { + run("CONCOCT_CUTUPFASTA") { + script "../../cutupfasta/main.nf" + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = true + """ + } + } + + run("CONCOCT_CONCOCTCOVERAGETABLE") { + script "../../concoctcoveragetable/main.nf" + process { + """ + ch_bam_input = Channel + .fromList([ + [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ], + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + ] + ]) + + + input[0] = CONCOCT_CUTUPFASTA.out.bed.join( ch_bam_input ) + """ + } + } + } + + test("sarscov2 - bam") { + + when { + process { + """ + ch_input_for_concoctconcoct = CONCOCT_CONCOCTCOVERAGETABLE.out.tsv + .join(CONCOCT_CUTUPFASTA.out.fasta) + + input[0] = ch_input_for_concoctconcoct + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.args_txt, + process.out.clustering_csv, + process.out.original_data_csv, + process.out.pca_components_csv, + process.out.pca_transformed_csv, + process.out.versions, + file(process.out.log_txt[0][1]).readLines().last().contains("CONCOCT Finished, the log shows how it went.") + ).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id: 'test'], [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/concoct/concoct/tests/main.nf.test.snap b/modules/nf-core/concoct/concoct/tests/main.nf.test.snap new file mode 100644 index 00000000..6ff6ac97 --- /dev/null +++ b/modules/nf-core/concoct/concoct/tests/main.nf.test.snap @@ -0,0 +1,173 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_args.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test_clustering_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "test_original_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test" + }, + "test_PCA_components_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test" + }, + "test_PCA_transformed_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,ed583fb0862e060844ceffee6bf0eeb7" + ], + "args_txt": [ + [ + { + "id": "test" + }, + "test_args.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "clustering_csv": [ + [ + { + "id": "test" + }, + "test_clustering_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log_txt": [ + [ + { + "id": "test" + }, + "test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "original_data_csv": [ + [ + { + "id": "test" + }, + "test_original_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "pca_components_csv": [ + [ + { + "id": "test" + }, + "test_PCA_components_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "pca_transformed_csv": [ + [ + { + "id": "test" + }, + "test_PCA_transformed_data_gt1000.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ed583fb0862e060844ceffee6bf0eeb7" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-24T08:39:53.759611572" + }, + "sarscov2 - bam": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test_args.txt:md5,277d8a15f732ae1bd4d6839fd768113e" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_clustering_gt1000.csv:md5,8cb3e6901075bf07966d08e1816762ce" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_original_data_gt1000.csv:md5,7474c6a670a608c2c9c9b9edde724074" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_PCA_components_data_gt1000.csv:md5,e69fd8a810563e62cb0c3998842b3659" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test_PCA_transformed_data_gt1000.csv:md5,558a35f720a9bfa54cbf7cdf099fd367" + ] + ], + [ + "versions.yml:md5,ed583fb0862e060844ceffee6bf0eeb7" + ], + true + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T20:25:56.619830843" + } +} \ No newline at end of file diff --git a/modules/nf-core/concoct/concoct/tests/tags.yml b/modules/nf-core/concoct/concoct/tests/tags.yml new file mode 100644 index 00000000..90503318 --- /dev/null +++ b/modules/nf-core/concoct/concoct/tests/tags.yml @@ -0,0 +1,2 @@ +concoct/concoct: + - "modules/nf-core/concoct/concoct/**" diff --git a/modules/nf-core/concoct/concoctcoveragetable/environment.yml b/modules/nf-core/concoct/concoctcoveragetable/environment.yml new file mode 100644 index 00000000..4152605f --- /dev/null +++ b/modules/nf-core/concoct/concoctcoveragetable/environment.yml @@ -0,0 +1,7 @@ +name: concoct_concoctcoveragetable +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::concoct=1.1.0 diff --git a/modules/nf-core/concoct/concoctcoveragetable/main.nf b/modules/nf-core/concoct/concoctcoveragetable/main.nf index 21f0f218..65a81454 100644 --- a/modules/nf-core/concoct/concoctcoveragetable/main.nf +++ b/modules/nf-core/concoct/concoctcoveragetable/main.nf @@ -3,10 +3,10 @@ process CONCOCT_CONCOCTCOVERAGETABLE { tag "$meta.id" label 'process_single' - conda "bioconda::concoct=1.1.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py311h245ed52_4': - 'biocontainers/concoct:1.1.0--py311h245ed52_4' }" + 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py312h245ed52_6': + 'biocontainers/concoct:1.1.0--py312h245ed52_6' }" input: tuple val(meta), path(bed), path(bamfiles), path(baifiles) @@ -33,4 +33,16 @@ process CONCOCT_CONCOCTCOVERAGETABLE { concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/concoct/concoctcoveragetable/meta.yml b/modules/nf-core/concoct/concoctcoveragetable/meta.yml index ecbb44d9..26b9793c 100644 --- a/modules/nf-core/concoct/concoctcoveragetable/meta.yml +++ b/modules/nf-core/concoct/concoctcoveragetable/meta.yml @@ -16,8 +16,7 @@ tools: documentation: "https://concoct.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/BinPro/CONCOCT" doi: "10.1038/nmeth.3103" - licence: "['FreeBSD']" - + licence: ["FreeBSD"] input: - meta: type: map @@ -36,7 +35,6 @@ input: type: file description: A single or list of BAM index files (.bai) corresponding to BAM pattern: "*.bam" - output: - meta: type: map @@ -51,6 +49,7 @@ output: type: file description: Contig coverage table pattern: "*.tsv" - authors: - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test b/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test new file mode 100644 index 00000000..dc378b52 --- /dev/null +++ b/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test @@ -0,0 +1,84 @@ +nextflow_process { + + name "Test Process CONCOCT_CONCOCTCOVERAGETABLE" + script "../main.nf" + process "CONCOCT_CONCOCTCOVERAGETABLE" + + tag "modules" + tag "modules_nfcore" + tag "concoct" + tag "concoct/concoctcoveragetable" + tag "concoct/cutupfasta" + + setup { + run("CONCOCT_CUTUPFASTA") { + script "../../cutupfasta/main.nf" + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = true + """ + } + } + } + + test("sarscov2 - bam") { + + when { + process { + """ + ch_bam_input = Channel + .fromList([ + [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ], + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + ] + ]) + + + input[0] = CONCOCT_CUTUPFASTA.out.bed.join( ch_bam_input ) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id:'test'], [], [] ,[] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test.snap b/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test.snap new file mode 100644 index 00000000..e92af4b2 --- /dev/null +++ b/modules/nf-core/concoct/concoctcoveragetable/tests/main.nf.test.snap @@ -0,0 +1,70 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,156a9a23e05b34188d03d52b39fae343" + ], + "tsv": [ + [ + { + "id": "test" + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,156a9a23e05b34188d03d52b39fae343" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-24T08:41:27.166202038" + }, + "sarscov2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,0183c95ec03d2a6c83a4ca82935308a4" + ] + ], + "1": [ + "versions.yml:md5,156a9a23e05b34188d03d52b39fae343" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,0183c95ec03d2a6c83a4ca82935308a4" + ] + ], + "versions": [ + "versions.yml:md5,156a9a23e05b34188d03d52b39fae343" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T15:59:09.328659542" + } +} \ No newline at end of file diff --git a/modules/nf-core/concoct/concoctcoveragetable/tests/tags.yml b/modules/nf-core/concoct/concoctcoveragetable/tests/tags.yml new file mode 100644 index 00000000..20480896 --- /dev/null +++ b/modules/nf-core/concoct/concoctcoveragetable/tests/tags.yml @@ -0,0 +1,2 @@ +concoct/concoctcoveragetable: + - "modules/nf-core/concoct/concoctcoveragetable/**" diff --git a/modules/nf-core/concoct/cutupfasta/environment.yml b/modules/nf-core/concoct/cutupfasta/environment.yml new file mode 100644 index 00000000..c6927197 --- /dev/null +++ b/modules/nf-core/concoct/cutupfasta/environment.yml @@ -0,0 +1,7 @@ +name: concoct_cutupfasta +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::concoct=1.1.0 diff --git a/modules/nf-core/concoct/cutupfasta/main.nf b/modules/nf-core/concoct/cutupfasta/main.nf index dba2fc58..9a69e72c 100644 --- a/modules/nf-core/concoct/cutupfasta/main.nf +++ b/modules/nf-core/concoct/cutupfasta/main.nf @@ -3,10 +3,10 @@ process CONCOCT_CUTUPFASTA { tag "$meta.id" label 'process_single' - conda "bioconda::concoct=1.1.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py311h245ed52_4': - 'biocontainers/concoct:1.1.0--py311h245ed52_4' }" + 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py312h245ed52_6': + 'biocontainers/concoct:1.1.0--py312h245ed52_6' }" input: tuple val(meta), path(fasta) @@ -37,4 +37,18 @@ process CONCOCT_CUTUPFASTA { concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def bedfile = bed ? "-b ${prefix}.bed" : "" + if ("$fasta" == "${prefix}.fasta") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + """ + touch ${prefix}.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/concoct/cutupfasta/meta.yml b/modules/nf-core/concoct/cutupfasta/meta.yml index 6fec4087..44a28723 100644 --- a/modules/nf-core/concoct/cutupfasta/meta.yml +++ b/modules/nf-core/concoct/cutupfasta/meta.yml @@ -15,8 +15,7 @@ tools: documentation: "https://concoct.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/BinPro/CONCOCT" doi: "10.1038/nmeth.3103" - licence: "['FreeBSD']" - + licence: ["FreeBSD"] input: - meta: type: map @@ -30,7 +29,6 @@ input: - bed: type: boolean description: Specify whether to generate a BED file describing where each contig was cut up - output: - meta: type: map @@ -49,6 +47,7 @@ output: type: file description: Optional BED File containing locations on original contigs where they were cut up. pattern: "*.bed" - authors: - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/concoct/cutupfasta/tests/main.nf.test b/modules/nf-core/concoct/cutupfasta/tests/main.nf.test new file mode 100644 index 00000000..0c395ee2 --- /dev/null +++ b/modules/nf-core/concoct/cutupfasta/tests/main.nf.test @@ -0,0 +1,60 @@ +nextflow_process { + + name "Test Process CONCOCT_CUTUPFASTA" + script "../main.nf" + process "CONCOCT_CUTUPFASTA" + + tag "modules" + tag "modules_nfcore" + tag "concoct" + tag "concoct/cutupfasta" + + test("sarscov2 - genome - fasta") { + + when { + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - genome - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/concoct/cutupfasta/tests/main.nf.test.snap b/modules/nf-core/concoct/cutupfasta/tests/main.nf.test.snap new file mode 100644 index 00000000..74be0e7a --- /dev/null +++ b/modules/nf-core/concoct/cutupfasta/tests/main.nf.test.snap @@ -0,0 +1,84 @@ +{ + "sarscov2 - genome - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,b7d972e6efa0b306e02e46a685310c7f" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,9785f4f0f5f6e8d020a52a9e2c4fa3e0" + ], + "bed": [ + + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,b7d972e6efa0b306e02e46a685310c7f" + ] + ], + "versions": [ + "versions.yml:md5,9785f4f0f5f6e8d020a52a9e2c4fa3e0" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T15:13:08.126117371" + }, + "sarscov2 - genome - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,9785f4f0f5f6e8d020a52a9e2c4fa3e0" + ], + "bed": [ + + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,9785f4f0f5f6e8d020a52a9e2c4fa3e0" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T15:13:20.929503446" + } +} \ No newline at end of file diff --git a/modules/nf-core/concoct/cutupfasta/tests/tags.yml b/modules/nf-core/concoct/cutupfasta/tests/tags.yml new file mode 100644 index 00000000..84a0432c --- /dev/null +++ b/modules/nf-core/concoct/cutupfasta/tests/tags.yml @@ -0,0 +1,2 @@ +concoct/cutupfasta: + - "modules/nf-core/concoct/cutupfasta/**" diff --git a/modules/nf-core/concoct/extractfastabins/environment.yml b/modules/nf-core/concoct/extractfastabins/environment.yml new file mode 100644 index 00000000..e31d2e86 --- /dev/null +++ b/modules/nf-core/concoct/extractfastabins/environment.yml @@ -0,0 +1,7 @@ +name: concoct_extractfastabins +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::concoct=1.1.0 diff --git a/modules/nf-core/concoct/extractfastabins/main.nf b/modules/nf-core/concoct/extractfastabins/main.nf index 102ea934..add94c93 100644 --- a/modules/nf-core/concoct/extractfastabins/main.nf +++ b/modules/nf-core/concoct/extractfastabins/main.nf @@ -2,10 +2,10 @@ process CONCOCT_EXTRACTFASTABINS { tag "$meta.id" label 'process_single' - conda "bioconda::concoct=1.1.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py311h245ed52_4': - 'biocontainers/concoct:1.1.0--py311h245ed52_4' }" + 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py312h245ed52_6': + 'biocontainers/concoct:1.1.0--py312h245ed52_6' }" input: tuple val(meta), path(original_fasta), path(csv) @@ -40,4 +40,17 @@ process CONCOCT_EXTRACTFASTABINS { concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p ${prefix} + echo "" | gzip > ${prefix}/${prefix}.fa.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/concoct/extractfastabins/meta.yml b/modules/nf-core/concoct/extractfastabins/meta.yml index 0bbc8e53..a9ac00a3 100644 --- a/modules/nf-core/concoct/extractfastabins/meta.yml +++ b/modules/nf-core/concoct/extractfastabins/meta.yml @@ -10,7 +10,6 @@ keywords: - cut up - bins - merge - tools: - "concoct": description: "Clustering cONtigs with COverage and ComposiTion" @@ -18,8 +17,7 @@ tools: documentation: "https://concoct.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/BinPro/CONCOCT" doi: "10.1038/nmeth.3103" - licence: "['FreeBSD']" - + licence: ["FreeBSD"] input: - meta: type: map @@ -34,7 +32,6 @@ input: type: boolean description: Output table of merge_cutup_clustering with new cluster assignments pattern: ".csv" - output: - meta: type: map @@ -49,6 +46,7 @@ output: type: file description: FASTA files containing CONCOCT predicted bin clusters, named numerically by CONCOCT cluster ID in a directory called `fasta_bins` pattern: "*.fa.gz" - authors: - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/concoct/extractfastabins/tests/main.nf.test b/modules/nf-core/concoct/extractfastabins/tests/main.nf.test new file mode 100644 index 00000000..ce14d726 --- /dev/null +++ b/modules/nf-core/concoct/extractfastabins/tests/main.nf.test @@ -0,0 +1,124 @@ +nextflow_process { + + name "Test Process CONCOCT_EXTRACTFASTABINS" + script "../main.nf" + process "CONCOCT_EXTRACTFASTABINS" + tag "modules" + tag "modules_nfcore" + tag "concoct" + tag "concoct/extractfastabins" + tag "concoct/cutupfasta" + tag "concoct/concoctcoveragetable" + tag "concoct/concoct" + tag "concoct/mergecutupclustering" + + setup { + run("CONCOCT_CUTUPFASTA") { + script "../../cutupfasta/main.nf" + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = true + """ + } + } + + run("CONCOCT_CONCOCTCOVERAGETABLE") { + script "../../concoctcoveragetable/main.nf" + process { + """ + ch_bam_input = Channel + .fromList([ + [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ], + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + ] + ]) + + + input[0] = CONCOCT_CUTUPFASTA.out.bed.join( ch_bam_input ) + """ + } + } + + run("CONCOCT_CONCOCT") { + script "../../concoct/main.nf" + process { + """ + ch_input_for_concoctconcoct = CONCOCT_CONCOCTCOVERAGETABLE.out.tsv + .join(CONCOCT_CUTUPFASTA.out.fasta) + + input[0] = ch_input_for_concoctconcoct + """ + } + } + + run("CONCOCT_MERGECUTUPCLUSTERING") { + script "../../mergecutupclustering/main.nf" + process { + """ + input[0] = CONCOCT_CONCOCT.out.clustering_csv + """ + } + } + } + + test("sarscov2 - bam") { + + when { + process { + """ + fasta = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[0] = Channel.of(fasta).join(CONCOCT_MERGECUTUPCLUSTERING.out.csv) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/concoct/extractfastabins/tests/main.nf.test.snap b/modules/nf-core/concoct/extractfastabins/tests/main.nf.test.snap new file mode 100644 index 00000000..5af33a37 --- /dev/null +++ b/modules/nf-core/concoct/extractfastabins/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fa.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,768f307345c2552b0613b946fca44873" + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fa.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,768f307345c2552b0613b946fca44873" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-24T08:33:53.38186154" + }, + "sarscov2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ] + ], + "1": [ + "versions.yml:md5,768f307345c2552b0613b946fca44873" + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "test_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ] + ], + "versions": [ + "versions.yml:md5,768f307345c2552b0613b946fca44873" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T21:05:15.805714717" + } +} \ No newline at end of file diff --git a/modules/nf-core/concoct/extractfastabins/tests/tags.yml b/modules/nf-core/concoct/extractfastabins/tests/tags.yml new file mode 100644 index 00000000..6db649a2 --- /dev/null +++ b/modules/nf-core/concoct/extractfastabins/tests/tags.yml @@ -0,0 +1,2 @@ +concoct/extractfastabins: + - "modules/nf-core/concoct/extractfastabins/**" diff --git a/modules/nf-core/concoct/mergecutupclustering/environment.yml b/modules/nf-core/concoct/mergecutupclustering/environment.yml new file mode 100644 index 00000000..459d65c7 --- /dev/null +++ b/modules/nf-core/concoct/mergecutupclustering/environment.yml @@ -0,0 +1,7 @@ +name: concoct_mergecutupclustering +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::concoct=1.1.0 diff --git a/modules/nf-core/concoct/mergecutupclustering/main.nf b/modules/nf-core/concoct/mergecutupclustering/main.nf index d95efde3..01e2e46d 100644 --- a/modules/nf-core/concoct/mergecutupclustering/main.nf +++ b/modules/nf-core/concoct/mergecutupclustering/main.nf @@ -2,10 +2,10 @@ process CONCOCT_MERGECUTUPCLUSTERING { tag "$meta.id" label 'process_single' - conda "bioconda::concoct=1.1.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py311h245ed52_4': - 'biocontainers/concoct:1.1.0--py311h245ed52_4' }" + 'https://depot.galaxyproject.org/singularity/concoct:1.1.0--py312h245ed52_6': + 'biocontainers/concoct:1.1.0--py312h245ed52_6' }" input: tuple val(meta), path(clustering_csv) @@ -32,4 +32,17 @@ process CONCOCT_MERGECUTUPCLUSTERING { concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + if ("$clustering_csv" == "${prefix}.csv") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + """ + touch ${prefix}.csv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + concoct: \$(echo \$(concoct --version 2>&1) | sed 's/concoct //g' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/concoct/mergecutupclustering/meta.yml b/modules/nf-core/concoct/mergecutupclustering/meta.yml index 84b0a459..e34a423c 100644 --- a/modules/nf-core/concoct/mergecutupclustering/meta.yml +++ b/modules/nf-core/concoct/mergecutupclustering/meta.yml @@ -16,8 +16,7 @@ tools: documentation: "https://concoct.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/BinPro/CONCOCT" doi: "10.1038/nmeth.3103" - licence: "['FreeBSD']" - + licence: ["FreeBSD"] input: - meta: type: map @@ -28,7 +27,6 @@ input: type: file description: Input cutup clustering result. Typically *_gt1000.csv from concoct pattern: "*.csv" - output: - meta: type: map @@ -43,6 +41,7 @@ output: type: file description: Cluster assignments per contig part with concensus cluster pattern: "*.csv" - authors: - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test b/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test new file mode 100644 index 00000000..b888c2fa --- /dev/null +++ b/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test @@ -0,0 +1,107 @@ +nextflow_process { + + name "Test Process CONCOCT_MERGECUTUPCLUSTERING" + script "../main.nf" + process "CONCOCT_MERGECUTUPCLUSTERING" + + tag "modules" + tag "modules_nfcore" + tag "concoct" + tag "concoct/mergecutupclustering" + tag "concoct/cutupfasta" + tag "concoct/concoctcoveragetable" + tag "concoct/concoct" + + setup { + run("CONCOCT_CUTUPFASTA") { + script "../../cutupfasta/main.nf" + process { + """ + input[0] = [ + [id: 'test', single_end: false], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[1] = true + """ + } + } + + run("CONCOCT_CONCOCTCOVERAGETABLE") { + script "../../concoctcoveragetable/main.nf" + process { + """ + ch_bam_input = Channel + .fromList([ + [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ], + [ + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + '/genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + ] + ]) + + + input[0] = CONCOCT_CUTUPFASTA.out.bed.join( ch_bam_input ) + """ + } + } + + run("CONCOCT_CONCOCT") { + script "../../concoct/main.nf" + process { + """ + ch_input_for_concoctconcoct = CONCOCT_CONCOCTCOVERAGETABLE.out.tsv + .join(CONCOCT_CUTUPFASTA.out.fasta) + + input[0] = ch_input_for_concoctconcoct + """ + } + } + } + + test("sarscov2 - bam") { + + when { + process { + """ + input[0] = CONCOCT_CONCOCT.out.clustering_csv + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [id: 'test'], []] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test.snap b/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test.snap new file mode 100644 index 00000000..fd4e6813 --- /dev/null +++ b/modules/nf-core/concoct/mergecutupclustering/tests/main.nf.test.snap @@ -0,0 +1,70 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,bf584483f6d21a4c6b34a4c517c88283" + ], + "csv": [ + [ + { + "id": "test" + }, + "test.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bf584483f6d21a4c6b34a4c517c88283" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-24T08:41:05.313757446" + }, + "sarscov2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ] + ], + "1": [ + "versions.yml:md5,bf584483f6d21a4c6b34a4c517c88283" + ], + "csv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ] + ], + "versions": [ + "versions.yml:md5,bf584483f6d21a4c6b34a4c517c88283" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-21T20:35:39.630679488" + } +} \ No newline at end of file diff --git a/modules/nf-core/concoct/mergecutupclustering/tests/tags.yml b/modules/nf-core/concoct/mergecutupclustering/tests/tags.yml new file mode 100644 index 00000000..0fc6dc6e --- /dev/null +++ b/modules/nf-core/concoct/mergecutupclustering/tests/tags.yml @@ -0,0 +1,2 @@ +concoct/mergecutupclustering: + - "modules/nf-core/concoct/mergecutupclustering/**" diff --git a/subworkflows/nf-core/fasta_binning_concoct/main.nf b/subworkflows/nf-core/fasta_binning_concoct/main.nf index 94fae84b..cdcf8826 100644 --- a/subworkflows/nf-core/fasta_binning_concoct/main.nf +++ b/subworkflows/nf-core/fasta_binning_concoct/main.nf @@ -35,7 +35,7 @@ workflow FASTA_BINNING_CONCOCT { ch_versions = ch_versions.mix( CONCOCT_MERGECUTUPCLUSTERING.out.versions.first()) ch_mergecutupclustering_for_extractfastabins = ch_fasta - .join(CONCOCT_MERGECUTUPCLUSTERING.out.csv, failOnMismatch: true) + .join(CONCOCT_MERGECUTUPCLUSTERING.out.csv, failOnMismatch: false) CONCOCT_EXTRACTFASTABINS ( ch_mergecutupclustering_for_extractfastabins ) ch_versions = ch_versions.mix(CONCOCT_EXTRACTFASTABINS.out.versions.first()) diff --git a/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test b/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test new file mode 100644 index 00000000..ab5eb230 --- /dev/null +++ b/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test @@ -0,0 +1,46 @@ +nextflow_workflow { + + name "Test Subworkflow FASTA_BINNING_CONCOCT" + script "../main.nf" + workflow "FASTA_BINNING_CONCOCT" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "subworkflows/fasta_binning_concoct" + + tag "concoct" + tag "concoct/cutupfasta" + tag "concoct/concoctcoveragetable" + tag "concoct/concoct" + tag "concoct/mergecutupclustering" + tag "concoct/extractfastabins" + + + test("sarscov2 - genome - fasta") { + + when { + workflow { + """ + input[0] = Channel.of( + [[ id: 'test' ], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)], + [[ id: 'test2'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ) + + input[1] = Channel.of( + [[ id: 'test' ], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.sorted.bam.bai', checkIfExists: true)], + [[ id: 'test2'], file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)] + ) + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match()} + ) + } + } +} diff --git a/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test.snap b/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test.snap new file mode 100644 index 00000000..1e626dcf --- /dev/null +++ b/subworkflows/nf-core/fasta_binning_concoct/tests/main.nf.test.snap @@ -0,0 +1,223 @@ +{ + "sarscov2 - genome - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test2" + }, + "test2.tsv:md5,3e0e31b009b3f4b4345df615a70a2835" + ], + [ + { + "id": "test" + }, + "test.tsv:md5,12b125c66c7e353fe206203d203f90be" + ] + ], + "1": [ + [ + { + "id": "test2" + }, + "test2_original_data_gt1000.csv:md5,afe4845db494e8c3d74c11950056c6b9" + ], + [ + { + "id": "test" + }, + "test_original_data_gt1000.csv:md5,5800a76203ca027b87ab14d323958ce2" + ] + ], + "2": [ + [ + { + "id": "test2" + }, + "test2_clustering_gt1000.csv:md5,8cb3e6901075bf07966d08e1816762ce" + ], + [ + { + "id": "test" + }, + "test_clustering_gt1000.csv:md5,8cb3e6901075bf07966d08e1816762ce" + ] + ], + "3": [ + [ + { + "id": "test2" + }, + "test2_PCA_components_data_gt1000.csv:md5,e935179f138edd7f4db6c8cd1fd90d48" + ], + [ + { + "id": "test" + }, + "test_PCA_components_data_gt1000.csv:md5,b4cae93ee69a00b366ab8d7c4e0d6191" + ] + ], + "4": [ + [ + { + "id": "test2" + }, + "test2_PCA_transformed_data_gt1000.csv:md5,7e39ef9d66adb948e75faa1c9a4d1542" + ], + [ + { + "id": "test" + }, + "test_PCA_transformed_data_gt1000.csv:md5,107ff5473b8b0479ede9043fc425e5ea" + ] + ], + "5": [ + [ + { + "id": "test2" + }, + "test2.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ], + [ + { + "id": "test" + }, + "test.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ] + ], + "6": [ + [ + { + "id": "test2" + }, + "test2_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ], + [ + { + "id": "test" + }, + "test_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ] + ], + "7": [ + "versions.yml:md5,02b573fc121beb734320d0e115ae4457", + "versions.yml:md5,4bc65b076c9549a3e935fbc16d7d33fe", + "versions.yml:md5,add0cb757a41623b081a19fad811b97e", + "versions.yml:md5,c8571a624e787edcad507c36c9dab06f", + "versions.yml:md5,f45abcb3924ba6847dea4997c62a7916" + ], + "bins": [ + [ + { + "id": "test2" + }, + "test2_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ], + [ + { + "id": "test" + }, + "test_3.fa.gz:md5,483f4a5dfe60171c86ee9b7e6dff908b" + ] + ], + "cluster_table": [ + [ + { + "id": "test2" + }, + "test2.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ], + [ + { + "id": "test" + }, + "test.csv:md5,ac57fce859cd28f5d18e1f4bbe056a35" + ] + ], + "coverage_table": [ + [ + { + "id": "test2" + }, + "test2.tsv:md5,3e0e31b009b3f4b4345df615a70a2835" + ], + [ + { + "id": "test" + }, + "test.tsv:md5,12b125c66c7e353fe206203d203f90be" + ] + ], + "original_csv": [ + [ + { + "id": "test2" + }, + "test2_original_data_gt1000.csv:md5,afe4845db494e8c3d74c11950056c6b9" + ], + [ + { + "id": "test" + }, + "test_original_data_gt1000.csv:md5,5800a76203ca027b87ab14d323958ce2" + ] + ], + "pca_original": [ + [ + { + "id": "test2" + }, + "test2_PCA_components_data_gt1000.csv:md5,e935179f138edd7f4db6c8cd1fd90d48" + ], + [ + { + "id": "test" + }, + "test_PCA_components_data_gt1000.csv:md5,b4cae93ee69a00b366ab8d7c4e0d6191" + ] + ], + "pca_transformed": [ + [ + { + "id": "test2" + }, + "test2_PCA_transformed_data_gt1000.csv:md5,7e39ef9d66adb948e75faa1c9a4d1542" + ], + [ + { + "id": "test" + }, + "test_PCA_transformed_data_gt1000.csv:md5,107ff5473b8b0479ede9043fc425e5ea" + ] + ], + "raw_clustering_csv": [ + [ + { + "id": "test2" + }, + "test2_clustering_gt1000.csv:md5,8cb3e6901075bf07966d08e1816762ce" + ], + [ + { + "id": "test" + }, + "test_clustering_gt1000.csv:md5,8cb3e6901075bf07966d08e1816762ce" + ] + ], + "versions": [ + "versions.yml:md5,02b573fc121beb734320d0e115ae4457", + "versions.yml:md5,4bc65b076c9549a3e935fbc16d7d33fe", + "versions.yml:md5,add0cb757a41623b081a19fad811b97e", + "versions.yml:md5,c8571a624e787edcad507c36c9dab06f", + "versions.yml:md5,f45abcb3924ba6847dea4997c62a7916" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-25T18:40:35.774932002" + } +} \ No newline at end of file From 47a9cf9f629606cc47e9e261f551f5fbf91f664d Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 14:40:04 +0200 Subject: [PATCH 05/16] Add cGHANGELGO --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0ae919a..8609f84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Fixed` -- [#630](https://github.com/nf-core/mag/pull/630) - Fix CONCOCT empty bins killing the pipeline, and allow for true multithreading again (removing OPENBLAS loop) (reported by @maxibor, fix by @jfy133) +- [#630](https://github.com/nf-core/mag/pull/630) - Fix CONCOCT empty bins killing the pipeline, and allow for true multithreading again (removing OPENBLAS loop) (reported by @maxibor, fix by @maxibor and @jfy133) ### `Dependencies` From d6d8fee17113274a16d6b7ce8e21eb5e39b7323a Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 14:44:32 +0200 Subject: [PATCH 06/16] Replace PORECHOP with official module --- CHANGELOG.md | 4 + conf/modules.config | 4 +- modules.json | 5 ++ modules/local/porechop.nf | 25 ------ .../nf-core/porechop/porechop/environment.yml | 7 ++ modules/nf-core/porechop/porechop/main.nf | 48 ++++++++++ modules/nf-core/porechop/porechop/meta.yml | 62 +++++++++++++ .../porechop/porechop/tests/main.nf.test | 61 +++++++++++++ .../porechop/porechop/tests/main.nf.test.snap | 88 +++++++++++++++++++ .../porechop/porechop/tests/nextflow.config | 9 ++ .../nf-core/porechop/porechop/tests/tags.yml | 2 + workflows/mag.nf | 8 +- 12 files changed, 292 insertions(+), 31 deletions(-) delete mode 100644 modules/local/porechop.nf create mode 100644 modules/nf-core/porechop/porechop/environment.yml create mode 100644 modules/nf-core/porechop/porechop/main.nf create mode 100644 modules/nf-core/porechop/porechop/meta.yml create mode 100644 modules/nf-core/porechop/porechop/tests/main.nf.test create mode 100644 modules/nf-core/porechop/porechop/tests/main.nf.test.snap create mode 100644 modules/nf-core/porechop/porechop/tests/nextflow.config create mode 100644 modules/nf-core/porechop/porechop/tests/tags.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index bd58f661..5f71f21a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Dependencies` +| Tool | Previous version | New version | +| -------- | ---------------- | ----------- | +| Porechop | 0.2.3_seqan2.1.1 | 0.2.4 | + ### `Deprecated` ## 3.0.1 [2024-06-10] diff --git a/conf/modules.config b/conf/modules.config index a3be8574..d3ff4dbc 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -167,11 +167,11 @@ process { ] } - withName: PORECHOP { + withName: PORECHOP_PORECHOP { publishDir = [ path: { "${params.outdir}/QC_longreads/porechop" }, mode: params.publish_dir_mode, - pattern: "*_porechop.fastq", + pattern: "*_trimmed.fastq", enabled: params.save_porechop_reads ] ext.prefix = { "${meta.id}_run${meta.run}_trimmed" } diff --git a/modules.json b/modules.json index cabd3125..0d150080 100644 --- a/modules.json +++ b/modules.json @@ -197,6 +197,11 @@ "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", "installed_by": ["modules"] }, + "porechop/porechop": { + "branch": "master", + "git_sha": "1d68c7f248d1a480c5959548a9234602b771199e", + "installed_by": ["modules"] + }, "prodigal": { "branch": "master", "git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220", diff --git a/modules/local/porechop.nf b/modules/local/porechop.nf deleted file mode 100644 index 91576887..00000000 --- a/modules/local/porechop.nf +++ /dev/null @@ -1,25 +0,0 @@ -process PORECHOP { - tag "$meta.id" - - conda "bioconda::porechop=0.2.3_seqan2.1.1" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/porechop:0.2.3_seqan2.1.1--py36h2d50403_3' : - 'biocontainers/porechop:0.2.3_seqan2.1.1--py36h2d50403_3' }" - - input: - tuple val(meta), path(reads) - - output: - tuple val(meta), path("${meta.id}_porechop.fastq") , emit: reads - path "versions.yml" , emit: versions - - script: - """ - porechop -i ${reads} -t ${task.cpus} -o ${meta.id}_porechop.fastq - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - porechop: \$(porechop --version) - END_VERSIONS - """ -} diff --git a/modules/nf-core/porechop/porechop/environment.yml b/modules/nf-core/porechop/porechop/environment.yml new file mode 100644 index 00000000..28b67c16 --- /dev/null +++ b/modules/nf-core/porechop/porechop/environment.yml @@ -0,0 +1,7 @@ +name: porechop_porechop +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::porechop=0.2.4 diff --git a/modules/nf-core/porechop/porechop/main.nf b/modules/nf-core/porechop/porechop/main.nf new file mode 100644 index 00000000..1ff02a12 --- /dev/null +++ b/modules/nf-core/porechop/porechop/main.nf @@ -0,0 +1,48 @@ +process PORECHOP_PORECHOP { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/porechop:0.2.4--py39h7cff6ad_2' : + 'biocontainers/porechop:0.2.4--py39h7cff6ad_2' }" + + input: + tuple val(meta), path(reads) + + output: + tuple val(meta), path("*.fastq.gz"), emit: reads + tuple val(meta), path("*.log") , emit: log + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + porechop \\ + -i $reads \\ + -t $task.cpus \\ + $args \\ + -o ${prefix}.fastq.gz \\ + > ${prefix}.log + cat <<-END_VERSIONS > versions.yml + "${task.process}": + porechop: \$( porechop --version ) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fastq + gzip ${prefix}.fastq + touch ${prefix}.log + cat <<-END_VERSIONS > versions.yml + "${task.process}": + porechop: \$( porechop --version ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/porechop/porechop/meta.yml b/modules/nf-core/porechop/porechop/meta.yml new file mode 100644 index 00000000..13be76f2 --- /dev/null +++ b/modules/nf-core/porechop/porechop/meta.yml @@ -0,0 +1,62 @@ +name: "porechop_porechop" +description: Adapter removal and demultiplexing of Oxford Nanopore reads +keywords: + - adapter + - nanopore + - demultiplexing +tools: + - porechop: + description: Adapter removal and demultiplexing of Oxford Nanopore reads + homepage: "https://github.com/rrwick/Porechop" + documentation: "https://github.com/rrwick/Porechop" + tool_dev_url: "https://github.com/rrwick/Porechop" + doi: "10.1099/mgen.0.000132" + licence: ["GPL v3"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: fastq/fastq.gz file + pattern: "*.{fastq,fastq.gz,fq,fq.gz}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - reads: + type: file + description: Demultiplexed and/or adapter-trimmed fastq.gz file + pattern: "*.{fastq.gz}" + - log: + type: file + description: Log file containing stdout information + pattern: "*.log" +authors: + - "@ggabernet" + - "@jasmezz" + - "@d4straub" + - "@LaurenceKuhl" + - "@SusiJo" + - "@jonasscheid" + - "@jonoave" + - "@GokceOGUZ" + - "@jfy133" +maintainers: + - "@ggabernet" + - "@jasmezz" + - "@d4straub" + - "@LaurenceKuhl" + - "@SusiJo" + - "@jonasscheid" + - "@jonoave" + - "@GokceOGUZ" + - "@jfy133" diff --git a/modules/nf-core/porechop/porechop/tests/main.nf.test b/modules/nf-core/porechop/porechop/tests/main.nf.test new file mode 100644 index 00000000..4c3c3d65 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process PORECHOP_PORECHOP" + script "../main.nf" + process "PORECHOP_PORECHOP" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "porechop" + tag "porechop/porechop" + + test("sarscov2 - nanopore - fastq") { + + when { + process { + """ + input[0] = [ [ id:'test', single_end:true ], + file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.reads).match("reads") }, + { assert snapshot(process.out.versions).match("versions") }, + // complete log is not stable. These first lines should be stable + { assert snapshot(path(process.out.log.get(0).get(1)).readLines()[0..7]).match("log")} + ) + } + + } + + + test("stub") { + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test', single_end:true ], + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + +} diff --git a/modules/nf-core/porechop/porechop/tests/main.nf.test.snap b/modules/nf-core/porechop/porechop/tests/main.nf.test.snap new file mode 100644 index 00000000..cf544d2d --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/main.nf.test.snap @@ -0,0 +1,88 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ] + ], + "timestamp": "2023-12-18T07:47:16.83444" + }, + "log": { + "content": [ + [ + "", + "\u001b[1m\u001b[4mLoading reads\u001b[0m", + "test.fastq.gz", + "100 reads loaded", + "", + "", + "\u001b[1m\u001b[4mLooking for known adapter sets\u001b[0m", + "" + ] + ], + "timestamp": "2023-12-18T07:47:16.853899" + }, + "reads": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,886fdb859fb50e0dddd35007bcff043e" + ] + ] + ], + "timestamp": "2023-12-18T07:47:16.811393" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": true + }, + "test_porechop.fastq.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,712c0753b56d0fb530092dfb5bdf2e5c" + ] + } + ], + "timestamp": "2023-12-18T07:47:37.814949" + } +} \ No newline at end of file diff --git a/modules/nf-core/porechop/porechop/tests/nextflow.config b/modules/nf-core/porechop/porechop/tests/nextflow.config new file mode 100644 index 00000000..a9ecf7b6 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + + + withName: PORECHOP_PORECHOP { + ext.args = '' + ext.prefix = { "${meta.id}_porechop" } + } + +} diff --git a/modules/nf-core/porechop/porechop/tests/tags.yml b/modules/nf-core/porechop/porechop/tests/tags.yml new file mode 100644 index 00000000..743645c2 --- /dev/null +++ b/modules/nf-core/porechop/porechop/tests/tags.yml @@ -0,0 +1,2 @@ +porechop/porechop: + - "modules/nf-core/porechop/porechop/**" diff --git a/workflows/mag.nf b/workflows/mag.nf index 7594b370..24ab9309 100644 --- a/workflows/mag.nf +++ b/workflows/mag.nf @@ -32,6 +32,7 @@ include { ARIA2 as ARIA2_UNTAR } from '../modul include { FASTQC as FASTQC_RAW } from '../modules/nf-core/fastqc/main' include { FASTQC as FASTQC_TRIMMED } from '../modules/nf-core/fastqc/main' include { SEQTK_MERGEPE } from '../modules/nf-core/seqtk/mergepe/main' +include { PORECHOP_PORECHOP } from '../modules/nf-core/porechop/porechop/main' include { BBMAP_BBNORM } from '../modules/nf-core/bbmap/bbnorm/main' include { FASTP } from '../modules/nf-core/fastp/main' include { ADAPTERREMOVAL as ADAPTERREMOVAL_PE } from '../modules/nf-core/adapterremoval/main' @@ -56,7 +57,6 @@ include { BOWTIE2_REMOVAL_BUILD as BOWTIE2_HOST_REMOVAL_BUILD } from '../modules include { BOWTIE2_REMOVAL_ALIGN as BOWTIE2_HOST_REMOVAL_ALIGN } from '../modules/local/bowtie2_removal_align' include { BOWTIE2_REMOVAL_BUILD as BOWTIE2_PHIX_REMOVAL_BUILD } from '../modules/local/bowtie2_removal_build' include { BOWTIE2_REMOVAL_ALIGN as BOWTIE2_PHIX_REMOVAL_ALIGN } from '../modules/local/bowtie2_removal_align' -include { PORECHOP } from '../modules/local/porechop' include { NANOLYSE } from '../modules/local/nanolyse' include { FILTLONG } from '../modules/local/filtlong' include { NANOPLOT as NANOPLOT_RAW } from '../modules/local/nanoplot' @@ -369,11 +369,11 @@ workflow MAG { if ( !params.assembly_input ) { if (!params.skip_adapter_trimming) { - PORECHOP ( + PORECHOP_PORECHOP ( ch_raw_long_reads ) - ch_long_reads = PORECHOP.out.reads - ch_versions = ch_versions.mix(PORECHOP.out.versions.first()) + ch_long_reads = PORECHOP_PORECHOP.out.reads + ch_versions = ch_versions.mix(PORECHOP_PORECHOP.out.versions.first()) } if (!params.keep_lambda) { From 32ba76ce62dfe0d00bce2ca23bd5e10c1f27af6d Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 15:08:50 +0200 Subject: [PATCH 07/16] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd58f661..ee7c26e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Changed` +- [#633](https://github.com/nf-core/mag/pull/633/) - Changed BUSCO to use offline mode when database specified by the user (reported by @ChristophKnapp and many others, fix by @jfy133) + ### `Fixed` ### `Dependencies` From 5e452052399355fd0d8f71413e539c084753b915 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 16:37:36 +0200 Subject: [PATCH 08/16] Bump nanoplot version 1.41.6 for valid docker container --- CHANGELOG.md | 1 + conf/modules.config | 11 +- modules.json | 5 + modules/local/nanolyse.nf | 4 +- modules/local/nanoplot.nf | 33 ----- modules/nf-core/nanoplot/environment.yml | 7 + modules/nf-core/nanoplot/main.nf | 58 ++++++++ modules/nf-core/nanoplot/meta.yml | 62 +++++++++ modules/nf-core/nanoplot/tests/main.nf.test | 94 +++++++++++++ .../nf-core/nanoplot/tests/main.nf.test.snap | 131 ++++++++++++++++++ modules/nf-core/nanoplot/tests/tags.yaml | 2 + workflows/mag.nf | 4 +- 12 files changed, 374 insertions(+), 38 deletions(-) delete mode 100644 modules/local/nanoplot.nf create mode 100644 modules/nf-core/nanoplot/environment.yml create mode 100644 modules/nf-core/nanoplot/main.nf create mode 100644 modules/nf-core/nanoplot/meta.yml create mode 100644 modules/nf-core/nanoplot/tests/main.nf.test create mode 100644 modules/nf-core/nanoplot/tests/main.nf.test.snap create mode 100644 modules/nf-core/nanoplot/tests/tags.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f71f21a..7458472a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | Tool | Previous version | New version | | -------- | ---------------- | ----------- | | Porechop | 0.2.3_seqan2.1.1 | 0.2.4 | +| NanoPlot | 1.26.3 | 1.41.6 | ### `Deprecated` diff --git a/conf/modules.config b/conf/modules.config index d3ff4dbc..be17815e 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -206,6 +206,11 @@ process { withName: NANOPLOT_RAW { ext.prefix = 'raw' + ext.args = { [ + "-p raw_", + "--title ${meta.id}_raw", + "-c darkblue", + ].join(' ').trim() } publishDir = [ path: { "${params.outdir}/QC_longreads/NanoPlot/${meta.id}" }, mode: params.publish_dir_mode, @@ -214,7 +219,11 @@ process { } withName: NANOPLOT_FILTERED { - ext.prefix = 'filtered' + ext.args = { [ + "-p filtered_", + "--title ${meta.id}_filtered", + "-c darkblue", + ].join(' ').trim() } publishDir = [ path: { "${params.outdir}/QC_longreads/NanoPlot/${meta.id}" }, mode: params.publish_dir_mode, diff --git a/modules.json b/modules.json index 0d150080..ddce6955 100644 --- a/modules.json +++ b/modules.json @@ -197,6 +197,11 @@ "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", "installed_by": ["modules"] }, + "nanoplot": { + "branch": "master", + "git_sha": "3135090b46f308a260fc9d5991d7d2f9c0785309", + "installed_by": ["modules"] + }, "porechop/porechop": { "branch": "master", "git_sha": "1d68c7f248d1a480c5959548a9234602b771199e", diff --git a/modules/local/nanolyse.nf b/modules/local/nanolyse.nf index 4cd46d4f..9e800ef0 100644 --- a/modules/local/nanolyse.nf +++ b/modules/local/nanolyse.nf @@ -17,9 +17,9 @@ process NANOLYSE { script: """ - cat ${reads} | NanoLyse --reference $nanolyse_db | gzip > ${meta.id}_nanolyse.fastq.gz + zcat ${reads} | NanoLyse --reference $nanolyse_db | gzip > ${meta.id}_nanolyse.fastq.gz echo "NanoLyse reference: $params.lambda_reference" >${meta.id}_nanolyse.log - cat ${reads} | echo "total reads before NanoLyse: \$((`wc -l`/4))" >>${meta.id}_nanolyse.log + zcat ${reads} | echo "total reads before NanoLyse: \$((`wc -l`/4))" >>${meta.id}_nanolyse.log gunzip -c ${meta.id}_nanolyse.fastq.gz | echo "total reads after NanoLyse: \$((`wc -l`/4))" >> ${meta.id}_nanolyse.log cat <<-END_VERSIONS > versions.yml diff --git a/modules/local/nanoplot.nf b/modules/local/nanoplot.nf deleted file mode 100644 index d3c347aa..00000000 --- a/modules/local/nanoplot.nf +++ /dev/null @@ -1,33 +0,0 @@ -process NANOPLOT { - tag "$meta.id" - - conda "bioconda::nanoplot=1.26.3" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/nanoplot:1.26.3--py_0' : - 'biocontainers/nanoplot:1.26.3--py_0' }" - - input: - tuple val(meta), path(reads) - - output: - path '*.png' , emit: png - path '*.html' , emit: html - path '*.txt' , emit: txt - path "versions.yml" , emit: versions - - script: - def prefix = task.ext.prefix ? "-p ${task.ext.prefix}_" : '' - def title = task.ext.prefix ? "${meta.id}_${task.ext.prefix}" : "${meta.id}" - """ - NanoPlot -t ${task.cpus} \ - ${prefix} \ - --title ${title} \ - -c darkblue \ - --fastq ${reads} - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - NanoPlot: \$(NanoPlot --version | sed -e "s/NanoPlot //g") - END_VERSIONS - """ -} diff --git a/modules/nf-core/nanoplot/environment.yml b/modules/nf-core/nanoplot/environment.yml new file mode 100644 index 00000000..219cd2e3 --- /dev/null +++ b/modules/nf-core/nanoplot/environment.yml @@ -0,0 +1,7 @@ +name: nanoplot +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::nanoplot=1.41.6 diff --git a/modules/nf-core/nanoplot/main.nf b/modules/nf-core/nanoplot/main.nf new file mode 100644 index 00000000..c1816caf --- /dev/null +++ b/modules/nf-core/nanoplot/main.nf @@ -0,0 +1,58 @@ +process NANOPLOT { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/nanoplot:1.41.6--pyhdfd78af_0' : + 'biocontainers/nanoplot:1.41.6--pyhdfd78af_0' }" + + input: + tuple val(meta), path(ontfile) + + output: + tuple val(meta), path("*.html") , emit: html + tuple val(meta), path("*.png") , optional: true, emit: png + tuple val(meta), path("*.txt") , emit: txt + tuple val(meta), path("*.log") , emit: log + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def input_file = ("$ontfile".endsWith(".fastq.gz") || "$ontfile".endsWith(".fq.gz")) ? "--fastq ${ontfile}" : + ("$ontfile".endsWith(".txt")) ? "--summary ${ontfile}" : '' + """ + NanoPlot \\ + $args \\ + -t $task.cpus \\ + $input_file + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nanoplot: \$(echo \$(NanoPlot --version 2>&1) | sed 's/^.*NanoPlot //; s/ .*\$//') + END_VERSIONS + """ + + stub: + """ + touch LengthvsQualityScatterPlot_dot.html + touch LengthvsQualityScatterPlot_kde.html + touch NanoPlot-report.html + touch NanoPlot_20240301_1130.log + touch NanoStats.txt + touch Non_weightedHistogramReadlength.html + touch Non_weightedLogTransformed_HistogramReadlength.html + touch WeightedHistogramReadlength.html + touch WeightedLogTransformed_HistogramReadlength.html + touch Yield_By_Length.html + + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nanoplot: \$(echo \$(NanoPlot --version 2>&1) | sed 's/^.*NanoPlot //; s/ .*\$//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/nanoplot/meta.yml b/modules/nf-core/nanoplot/meta.yml new file mode 100644 index 00000000..46fbd562 --- /dev/null +++ b/modules/nf-core/nanoplot/meta.yml @@ -0,0 +1,62 @@ +name: nanoplot +description: Run NanoPlot on nanopore-sequenced reads +keywords: + - quality control + - qc + - fastq + - sequencing summary + - nanopore +tools: + - nanoplot: + description: | + NanoPlot is a tool for ploting long-read sequencing data and + alignment. + homepage: http://nanoplot.bioinf.be + documentation: https://github.com/wdecoster/NanoPlot + licence: ["GPL-3.0-or-later"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastq: + type: file + description: | + List of input basecalled-FastQ files. + - summary_txt: + type: file + description: | + List of sequencing_summary.txt files from running basecalling. +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - html: + type: file + description: NanoPlot report + pattern: "*{.html}" + - png: + type: file + description: Plots generated by NanoPlot + pattern: "*{.png}" + - txt: + type: file + description: Stats from NanoPlot + pattern: "*{.txt}" + - log: + type: file + description: log file of NanoPlot run + pattern: "*{.log}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@drpatelh" + - "@yuukiiwa" +maintainers: + - "@drpatelh" + - "@yuukiiwa" diff --git a/modules/nf-core/nanoplot/tests/main.nf.test b/modules/nf-core/nanoplot/tests/main.nf.test new file mode 100644 index 00000000..29b57c10 --- /dev/null +++ b/modules/nf-core/nanoplot/tests/main.nf.test @@ -0,0 +1,94 @@ +nextflow_process { + + name "Test Process NANOPLOT" + tag "modules_nfcore" + tag "modules" + tag "nanoplot" + script "../main.nf" + process "NANOPLOT" + + test("NanoPlot summary") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['nanopore']['test_sequencing_summary'], checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.txt, + process.out.versions + ).match() + }, + { + with(process.out.html.get(0)) { + assert get(1).collect { p -> file(p).getName() }.contains("NanoPlot-report.html") + } + } + ) + } + + } + + test("NanoPlot FASTQ") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['nanopore']['test_fastq_gz'], checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.txt, + process.out.versions + ).match() + }, + { + with(process.out.html.get(0)) { + assert get(1).collect { p -> file(p).getName() }.contains("NanoPlot-report.html") + } + } + ) + } + + } + + test("NanoPlot - stub") { + + options "-stub" + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['nanopore']['test_sequencing_summary'], checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} diff --git a/modules/nf-core/nanoplot/tests/main.nf.test.snap b/modules/nf-core/nanoplot/tests/main.nf.test.snap new file mode 100644 index 00000000..f7f8028a --- /dev/null +++ b/modules/nf-core/nanoplot/tests/main.nf.test.snap @@ -0,0 +1,131 @@ +{ + "NanoPlot - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "LengthvsQualityScatterPlot_dot.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "LengthvsQualityScatterPlot_kde.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "NanoPlot-report.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Yield_By_Length.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test" + }, + "NanoPlot_20240301_1130.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ], + "html": [ + [ + { + "id": "test" + }, + [ + "LengthvsQualityScatterPlot_dot.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "LengthvsQualityScatterPlot_kde.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "NanoPlot-report.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Non_weightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedHistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "WeightedLogTransformed_HistogramReadlength.html:md5,d41d8cd98f00b204e9800998ecf8427e", + "Yield_By_Length.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "log": [ + [ + { + "id": "test" + }, + "NanoPlot_20240301_1130.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "png": [ + + ], + "txt": [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-01T14:54:18.083198" + }, + "NanoPlot FASTQ": { + "content": [ + [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,50373c7543e71e3baf040926f0c69ac1" + ] + ], + [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-10-17T16:18:44.848688965" + }, + "NanoPlot summary": { + "content": [ + [ + [ + { + "id": "test" + }, + "NanoStats.txt:md5,90464bf7049ca66106de56e7eac23dd4" + ] + ], + [ + "versions.yml:md5,961cee64736aeb9e56b65d05ee3cd1a5" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2023-10-17T16:18:31.104601192" + } +} \ No newline at end of file diff --git a/modules/nf-core/nanoplot/tests/tags.yaml b/modules/nf-core/nanoplot/tests/tags.yaml new file mode 100644 index 00000000..7c6ce3fa --- /dev/null +++ b/modules/nf-core/nanoplot/tests/tags.yaml @@ -0,0 +1,2 @@ +nanoplot: + - modules/nf-core/nanoplot/** diff --git a/workflows/mag.nf b/workflows/mag.nf index 24ab9309..19d7f574 100644 --- a/workflows/mag.nf +++ b/workflows/mag.nf @@ -33,6 +33,8 @@ include { FASTQC as FASTQC_RAW } from '../modul include { FASTQC as FASTQC_TRIMMED } from '../modules/nf-core/fastqc/main' include { SEQTK_MERGEPE } from '../modules/nf-core/seqtk/mergepe/main' include { PORECHOP_PORECHOP } from '../modules/nf-core/porechop/porechop/main' +include { NANOPLOT as NANOPLOT_RAW } from '../modules/nf-core/nanoplot/main' +include { NANOPLOT as NANOPLOT_FILTERED } from '../modules/nf-core/nanoplot/main' include { BBMAP_BBNORM } from '../modules/nf-core/bbmap/bbnorm/main' include { FASTP } from '../modules/nf-core/fastp/main' include { ADAPTERREMOVAL as ADAPTERREMOVAL_PE } from '../modules/nf-core/adapterremoval/main' @@ -59,8 +61,6 @@ include { BOWTIE2_REMOVAL_BUILD as BOWTIE2_PHIX_REMOVAL_BUILD } from '../modules include { BOWTIE2_REMOVAL_ALIGN as BOWTIE2_PHIX_REMOVAL_ALIGN } from '../modules/local/bowtie2_removal_align' include { NANOLYSE } from '../modules/local/nanolyse' include { FILTLONG } from '../modules/local/filtlong' -include { NANOPLOT as NANOPLOT_RAW } from '../modules/local/nanoplot' -include { NANOPLOT as NANOPLOT_FILTERED } from '../modules/local/nanoplot' include { KRAKEN2_DB_PREPARATION } from '../modules/local/kraken2_db_preparation' include { KRAKEN2 } from '../modules/local/kraken2' include { POOL_SINGLE_READS as POOL_SHORT_SINGLE_READS } from '../modules/local/pool_single_reads' From b45d57a9a9d944cbfe8ac82bc885a6e00faab21d Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 16:51:30 +0200 Subject: [PATCH 09/16] Remove some old local modules --- conf/base.config | 6 ++--- modules/local/centrifuge_db_preparation.nf | 27 ---------------------- modules/local/krona_db.nf | 21 ----------------- 3 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 modules/local/centrifuge_db_preparation.nf delete mode 100644 modules/local/krona_db.nf diff --git a/conf/base.config b/conf/base.config index 7dec9e28..4cbf14f0 100644 --- a/conf/base.config +++ b/conf/base.config @@ -77,7 +77,7 @@ process { memory = { check_max (8.GB * task.attempt, 'memory' ) } time = { check_max (6.h * task.attempt, 'time' ) } } - withName: PORECHOP { + withName: PORECHOP_PORECHOP { cpus = { check_max (4 * task.attempt, 'cpus' ) } memory = { check_max (30.GB * task.attempt, 'memory' ) } time = { check_max (4.h * task.attempt, 'time' ) } @@ -93,7 +93,7 @@ process { memory = { check_max (64.GB * (2**(task.attempt-1)), 'memory' ) } time = { check_max (24.h * (2**(task.attempt-1)), 'time' ) } } - withName: CENTRIFUGE { + withName: CENTRIFUGE_CENTRIFUGE { cpus = { check_max (8 * task.attempt, 'cpus' ) } memory = { check_max (40.GB * task.attempt, 'memory' ) } time = { check_max (12.h * task.attempt, 'time' ) } @@ -103,7 +103,7 @@ process { memory = { check_max (40.GB * task.attempt, 'memory' ) } time = { check_max (12.h * task.attempt, 'time' ) } } - withName: KRONA { + withName: KRONA_KTIMPORTTAXONOMY { cpus = { check_max (8 * task.attempt, 'cpus' ) } memory = { check_max (20.GB * task.attempt, 'memory' ) } time = { check_max (12.h * task.attempt, 'time' ) } diff --git a/modules/local/centrifuge_db_preparation.nf b/modules/local/centrifuge_db_preparation.nf deleted file mode 100644 index fe48512c..00000000 --- a/modules/local/centrifuge_db_preparation.nf +++ /dev/null @@ -1,27 +0,0 @@ -process CENTRIFUGE_DB_PREPARATION { - - conda "conda-forge::sed=4.7" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/ubuntu:20.04' : - 'nf-core/ubuntu:20.04' }" - - input: - path db - - output: - path "database/*.cf", emit: db - path "versions.yml" , emit: versions - - script: - """ - mkdir db_tmp - tar -xf "${db}" -C db_tmp - mkdir database - mv `find db_tmp/ -name "*.cf"` database/ - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - tar: \$(tar --version 2>&1 | sed -n 1p | sed 's/tar (GNU tar) //') - END_VERSIONS - """ -} diff --git a/modules/local/krona_db.nf b/modules/local/krona_db.nf deleted file mode 100644 index 0b1f4125..00000000 --- a/modules/local/krona_db.nf +++ /dev/null @@ -1,21 +0,0 @@ -process KRONA_DB { - - conda "bioconda::krona=2.7.1" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/krona:2.7.1--pl526_5' : - 'biocontainers/krona:2.7.1--pl526_5' }" - - output: - path("taxonomy/taxonomy.tab"), emit: db - path "versions.yml" , emit: versions - - script: - """ - ktUpdateTaxonomy.sh taxonomy - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - ktImportTaxonomy: \$(ktImportTaxonomy 2>&1 | sed -n '/KronaTools /p' | sed 's/^.*KronaTools //; s/ - ktImportTaxonomy.*//') - END_VERSIONS - """ -} From 4bf46108f53a4411a0f8690f7cd633d8bfbfecde Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 17:11:47 +0200 Subject: [PATCH 10/16] update NanoLyse module --- CHANGELOG.md | 3 ++ docs/output.md | 2 +- modules.json | 5 +++ modules/nf-core/nanolyse/environment.yml | 7 ++++ modules/nf-core/nanolyse/main.nf | 34 ++++++++++++++++ modules/nf-core/nanolyse/meta.yml | 49 ++++++++++++++++++++++++ workflows/mag.nf | 4 +- 7 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 modules/nf-core/nanolyse/environment.yml create mode 100644 modules/nf-core/nanolyse/main.nf create mode 100644 modules/nf-core/nanolyse/meta.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 7458472a..a703a764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Changed` +- [#632](https://github.com/nf-core/mag/pull/632) - Use default NanoLyse log of just removed reads rather than custom (by @jfy133) + ### `Fixed` ### `Dependencies` @@ -17,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | -------- | ---------------- | ----------- | | Porechop | 0.2.3_seqan2.1.1 | 0.2.4 | | NanoPlot | 1.26.3 | 1.41.6 | +| NanoLyse | 1.1.0 | 1.2.0 | ### `Deprecated` diff --git a/docs/output.md b/docs/output.md index 838fc7c5..cb3704ed 100644 --- a/docs/output.md +++ b/docs/output.md @@ -105,7 +105,7 @@ The pipeline uses Nanolyse to map the reads against the Lambda phage and removes Output files - `QC_longreads/NanoLyse/` - - `[sample]_nanolyse.log`: Contains a brief log file indicating how many reads have been retained. + - `[sample]_nanolyse.log`: Contains a brief log file indicating how many reads have been removed. diff --git a/modules.json b/modules.json index ddce6955..288c46da 100644 --- a/modules.json +++ b/modules.json @@ -197,6 +197,11 @@ "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", "installed_by": ["modules"] }, + "nanolyse": { + "branch": "master", + "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", + "installed_by": ["modules"] + }, "nanoplot": { "branch": "master", "git_sha": "3135090b46f308a260fc9d5991d7d2f9c0785309", diff --git a/modules/nf-core/nanolyse/environment.yml b/modules/nf-core/nanolyse/environment.yml new file mode 100644 index 00000000..7d738ba9 --- /dev/null +++ b/modules/nf-core/nanolyse/environment.yml @@ -0,0 +1,7 @@ +name: nanolyse +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::nanolyse=1.2.0 diff --git a/modules/nf-core/nanolyse/main.nf b/modules/nf-core/nanolyse/main.nf new file mode 100644 index 00000000..68d5d804 --- /dev/null +++ b/modules/nf-core/nanolyse/main.nf @@ -0,0 +1,34 @@ +process NANOLYSE { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/nanolyse:1.2.0--py_0' : + 'biocontainers/nanolyse:1.2.0--py_0' }" + + input: + tuple val(meta), path(fastq) + path fasta + + output: + tuple val(meta), path("*.fastq.gz"), emit: fastq + path "*.log" , emit: log + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + gunzip -c $fastq | NanoLyse -r $fasta | gzip > ${prefix}.fastq.gz + mv NanoLyse.log ${prefix}.nanolyse.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nanolyse: \$(NanoLyse --version 2>&1 | sed -e "s/NanoLyse //g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/nanolyse/meta.yml b/modules/nf-core/nanolyse/meta.yml new file mode 100644 index 00000000..375ad9bc --- /dev/null +++ b/modules/nf-core/nanolyse/meta.yml @@ -0,0 +1,49 @@ +name: nanolyse +description: DNA contaminant removal using NanoLyse +keywords: + - contaminant_removal +tools: + - nanolyse: + description: | + DNA contaminant removal using NanoLyse + homepage: https://github.com/wdecoster/nanolyse + documentation: https://github.com/wdecoster/nanolyse#nanolyse + licence: ["GPL-3.0-or-later"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastq: + type: file + description: | + Basecalled reads in FASTQ.GZ format + pattern: "*.fastq.gz" + - fasta: + type: file + description: | + A reference fasta file against which to filter. + pattern: "*.fasta" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fastq: + type: file + description: Reads with contaminants removed in FASTQ format + pattern: "*.fastq.gz" + - log: + type: file + description: Log of the Nanolyse run. + pattern: "*.log" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@yuukiiwa" +maintainers: + - "@yuukiiwa" diff --git a/workflows/mag.nf b/workflows/mag.nf index 19d7f574..f71d4218 100644 --- a/workflows/mag.nf +++ b/workflows/mag.nf @@ -35,6 +35,7 @@ include { SEQTK_MERGEPE } from '../modul include { PORECHOP_PORECHOP } from '../modules/nf-core/porechop/porechop/main' include { NANOPLOT as NANOPLOT_RAW } from '../modules/nf-core/nanoplot/main' include { NANOPLOT as NANOPLOT_FILTERED } from '../modules/nf-core/nanoplot/main' +include { NANOLYSE } from '../modules/nf-core/nanolyse/main' include { BBMAP_BBNORM } from '../modules/nf-core/bbmap/bbnorm/main' include { FASTP } from '../modules/nf-core/fastp/main' include { ADAPTERREMOVAL as ADAPTERREMOVAL_PE } from '../modules/nf-core/adapterremoval/main' @@ -59,7 +60,6 @@ include { BOWTIE2_REMOVAL_BUILD as BOWTIE2_HOST_REMOVAL_BUILD } from '../modules include { BOWTIE2_REMOVAL_ALIGN as BOWTIE2_HOST_REMOVAL_ALIGN } from '../modules/local/bowtie2_removal_align' include { BOWTIE2_REMOVAL_BUILD as BOWTIE2_PHIX_REMOVAL_BUILD } from '../modules/local/bowtie2_removal_build' include { BOWTIE2_REMOVAL_ALIGN as BOWTIE2_PHIX_REMOVAL_ALIGN } from '../modules/local/bowtie2_removal_align' -include { NANOLYSE } from '../modules/local/nanolyse' include { FILTLONG } from '../modules/local/filtlong' include { KRAKEN2_DB_PREPARATION } from '../modules/local/kraken2_db_preparation' include { KRAKEN2 } from '../modules/local/kraken2' @@ -381,7 +381,7 @@ workflow MAG { ch_long_reads, ch_nanolyse_db ) - ch_long_reads = NANOLYSE.out.reads + ch_long_reads = NANOLYSE.out.fastq ch_versions = ch_versions.mix(NANOLYSE.out.versions.first()) } From 42db409d1b99ab4079ca89913cccabda8b564d14 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jun 2024 17:13:15 +0200 Subject: [PATCH 11/16] Output docs update --- docs/output.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/output.md b/docs/output.md index cb3704ed..d044e544 100644 --- a/docs/output.md +++ b/docs/output.md @@ -105,7 +105,7 @@ The pipeline uses Nanolyse to map the reads against the Lambda phage and removes Output files - `QC_longreads/NanoLyse/` - - `[sample]_nanolyse.log`: Contains a brief log file indicating how many reads have been removed. + - `[sample]_[run]_lambdafiltered.nanolyse.log`: Contains a brief log file indicating how many reads have been removed. From faf2196311099b0799f401c5c72c07ba9a6e5f61 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Fri, 28 Jun 2024 07:38:56 +0200 Subject: [PATCH 12/16] Bump versions for patch release --- CHANGELOG.md | 2 +- assets/multiqc_config.yml | 4 ++-- nextflow.config | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1d688ea..f9dacba4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## dev [unreleased] +## 3.0.2 [2024-06-28] ### `Added` diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index 9f4e5e7e..47f9932a 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -1,7 +1,7 @@ report_comment: > - This report has been generated by the nf-core/mag + This report has been generated by the nf-core/mag analysis pipeline. For information about how to interpret these results, please see the - documentation. + documentation. report_section_order: "nf-core-mag-methods-description": order: -1000 diff --git a/nextflow.config b/nextflow.config index 7b8b1bc8..e2a4398c 100644 --- a/nextflow.config +++ b/nextflow.config @@ -390,7 +390,7 @@ manifest { description = """Assembly, binning and annotation of metagenomes""" mainScript = 'main.nf' nextflowVersion = '!>=23.04.0' - version = '3.0.2dev' + version = '3.0.2' doi = '10.1093/nargab/lqac007' } From e07724d1de876ed9da3a11249cc66093f19b66a2 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Mon, 1 Jul 2024 07:59:35 +0200 Subject: [PATCH 13/16] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9dacba4..e341dba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 3.0.2 [2024-06-28] +## 3.0.2 [2024-07-01] ### `Added` From c4ae311dc8729d492ecbfa86d81fd23aa4775526 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 4 Jul 2024 05:56:26 +0200 Subject: [PATCH 14/16] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e341dba7..aec4219b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### `Changed` -- [#633](https://github.com/nf-core/mag/pull/633/) - Changed BUSCO to use offline mode when database specified by the user (reported by @ChristophKnapp and many others, fix by @jfy133) +- [#633](https://github.com/nf-core/mag/pull/633/) - Changed BUSCO to use offline mode when the database is specified by the user (reported by @ChristophKnapp and many others, fix by @jfy133) - [#632](https://github.com/nf-core/mag/pull/632) - Use default NanoLyse log of just removed reads rather than custom (by @jfy133) ### `Fixed` From 34d7e9a5b590deda931793f7da7a109e88fffd38 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 4 Jul 2024 08:23:09 +0200 Subject: [PATCH 15/16] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aec4219b..8e36b245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 3.0.2 [2024-07-01] +## 3.0.2 [2024-07-04] ### `Added` From 4e124658f972810309830a3e047d60ecd0877cfe Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 4 Jul 2024 08:35:04 +0200 Subject: [PATCH 16/16] Add missing versions channel in subworkflow --- modules.json | 2 +- subworkflows/nf-core/fasta_binning_concoct/main.nf | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules.json b/modules.json index 752f22da..16a805b8 100644 --- a/modules.json +++ b/modules.json @@ -258,7 +258,7 @@ "nf-core": { "fasta_binning_concoct": { "branch": "master", - "git_sha": "373d3e2f5ce7f215977826d358c461078c8e1057", + "git_sha": "c60c14b285b89bdd0607e371417dadb80385ad6e", "installed_by": ["subworkflows"] }, "utils_nextflow_pipeline": { diff --git a/subworkflows/nf-core/fasta_binning_concoct/main.nf b/subworkflows/nf-core/fasta_binning_concoct/main.nf index cdcf8826..ee51044c 100644 --- a/subworkflows/nf-core/fasta_binning_concoct/main.nf +++ b/subworkflows/nf-core/fasta_binning_concoct/main.nf @@ -53,4 +53,3 @@ workflow FASTA_BINNING_CONCOCT { versions = ch_versions // channel: [ versions.yml ] } -