diff --git a/conf/test.config b/conf/test.config index a58d2d9..42caf2d 100644 --- a/conf/test.config +++ b/conf/test.config @@ -10,6 +10,14 @@ ---------------------------------------------------------------------------------------- */ +process { + resourceLimits = [ + cpus: 4, + memory: '15.GB', + time: '1.h', + ] +} + params { config_profile_name = 'Test profile' config_profile_description = 'Minimal test dataset to check pipeline function' @@ -20,5 +28,5 @@ params { // Input data files = 'MAGFlow/data/*' - + } diff --git a/modules.json b/modules.json index d49d07a..40a90b3 100644 --- a/modules.json +++ b/modules.json @@ -8,53 +8,71 @@ "busco/busco": { "branch": "master", "git_sha": "17486961b8b1ab1aae258c83a7e947b40d8ab670", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/busco/busco/busco-busco.diff" }, "checkm2/databasedownload": { "branch": "master", "git_sha": "1bfd681e88ef66c037b3ffd6571ab00370230c7b", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/checkm2/databasedownload/checkm2-databasedownload.diff" }, "checkm2/predict": { "branch": "master", "git_sha": "1bfd681e88ef66c037b3ffd6571ab00370230c7b", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/checkm2/predict/checkm2-predict.diff" }, "fastqc": { "branch": "master", "git_sha": "285a50500f9e02578d90b3ce6382ea3c30216acd", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] }, "gtdbtk/classifywf": { "branch": "master", "git_sha": "28a811586021f5c81639355c1fe4a6651a07ab17", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/gtdbtk/classifywf/gtdbtk-classifywf.diff" }, "gunc/downloaddb": { "branch": "master", "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/gunc/downloaddb/gunc-downloaddb.diff" }, "gunc/run": { "branch": "master", "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/gunc/run/gunc-run.diff" }, "multiqc": { "branch": "master", "git_sha": "b7ebe95761cd389603f9cc0e0dc384c0f663815a", - "installed_by": ["modules"] + "installed_by": [ + "modules" + ] }, "quast": { "branch": "master", "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", - "installed_by": ["modules"], + "installed_by": [ + "modules" + ], "patch": "modules/nf-core/quast/quast.diff" } } @@ -64,20 +82,26 @@ "utils_nextflow_pipeline": { "branch": "master", "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] }, "utils_nfcore_pipeline": { "branch": "master", "git_sha": "92de218a329bfc9a9033116eb5f65fd270e72ba3", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] }, "utils_nfvalidation_plugin": { "branch": "master", "git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa", - "installed_by": ["subworkflows"] + "installed_by": [ + "subworkflows" + ] } } } } } -} +} \ No newline at end of file diff --git a/modules/nf-core/checkm2/predict/checkm2-predict.diff b/modules/nf-core/checkm2/predict/checkm2-predict.diff index b7c3710..e79b8e8 100644 --- a/modules/nf-core/checkm2/predict/checkm2-predict.diff +++ b/modules/nf-core/checkm2/predict/checkm2-predict.diff @@ -1,4 +1,5 @@ -Changes in module 'nf-core/checkm2/predict' +Changes in component 'nf-core/checkm2/predict' +Changes in 'checkm2/predict/meta.yml': --- modules/nf-core/checkm2/predict/meta.yml +++ modules/nf-core/checkm2/predict/meta.yml @@ -18,42 +18,30 @@ @@ -30,7 +31,7 @@ Changes in module 'nf-core/checkm2/predict' + type: directory + description: Path where the files containing nucleic acid sequence file in FASTA format "*.{fasta,fna,fa}". + pattern: -+ - changed_dot_for_underscore: ++ - change_dot_for_underscore: + type: string + description: Output from the process CHANGE_DOT_FOR_UNDERSCORE indicating that dots were removed from the file name. + - gtdbtk2_db: @@ -64,33 +65,34 @@ Changes in module 'nf-core/checkm2/predict' authors: - "@dialvarezs" +Changes in 'checkm2/predict/main.nf': --- modules/nf-core/checkm2/predict/main.nf +++ modules/nf-core/checkm2/predict/main.nf -@@ -1,41 +1,44 @@ +@@ -1,52 +1,39 @@ -process CHECKM2_PREDICT { - tag "${meta.id}" - label 'process_medium' +process CHECKM2 { -+ tag "$sample" ++ tag "${sample}" + label 'process_medium' - conda "bioconda::checkm2=1.0.1" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/checkm2:1.0.1--pyh7cba7a3_0': - 'biocontainers/checkm2:1.0.1--pyh7cba7a3_0' }" -+ conda "bioconda::checkm2=1.0.1 conda-forge::python=3.7.12" -+ container "${ params.use_singularity ? -+ 'https://depot.galaxyproject.org/singularity/checkm2:1.0.1--pyh7cba7a3_0' : -+ 'biocontainers/checkm2:1.0.1--pyh7cba7a3_0' }" -+ containerOptions "${ params.directory_to_bind == null ? '' : "--bind ${params.directory_to_bind}" }" ++ conda "bioconda::checkm2=1.0.1 conda-forge::python=3.7.12" ++ container "${params.use_singularity ++ ? 'https://depot.galaxyproject.org/singularity/checkm2:1.0.1--pyh7cba7a3_0' ++ : 'biocontainers/checkm2:1.0.1--pyh7cba7a3_0'}" ++ containerOptions "${params.directory_to_bind == null ? '' : "--bind ${params.directory_to_bind}"}" - input: - tuple val(meta), path(fasta, stageAs: "input_bins/*") - tuple val(dbmeta), path(db) + input: + tuple val(sample), path(files), val(change_dot_for_underscore) -+ val "checkm2_db" -+ val "gtdbtk2_db" ++ path checkm2_db ++ path gtdbtk2_db - output: - tuple val(meta), path("${prefix}") , emit: checkm2_output @@ -104,19 +106,18 @@ Changes in module 'nf-core/checkm2/predict' - task.ext.when == null || task.ext.when + script: + def outdir = params.outdir -+ def checkm2_db = params.checkm2_db ? -+ "--database_path ${params.checkm2_db}" : -+ "--database_path ${params.outdir}/databases/CheckM2_database/uniref100.KO.1.dmnd" ++ ? "--database_path ${params.checkm2_db}" ++ : "--database_path ${params.outdir}/databases/CheckM2_database/uniref100.KO.1.dmnd" + def args = task.ext.args ?: '' + """ + EXTENSION=\$(echo ".\$(ls ${files}/* | head -n 1 | rev | cut -d. -f1 | rev)") + checkm2 predict \ -+ --threads $task.cpus \ -+ --input $files -x \$EXTENSION \ ++ --threads ${task.cpus} \ ++ --input ${files} -x \$EXTENSION \ + --output-directory checkm2 \ -+ $checkm2_db \ -+ --tmpdir "${outdir}/${sample}" \ -+ $args ++ --database_path ${checkm2_db} \ ++ --tmpdir "${outdir}/${sample}" \ ++ ${args} - script: - def args = task.ext.args ?: '' @@ -135,14 +136,26 @@ Changes in module 'nf-core/checkm2/predict' - checkm2: \$(checkm2 --version) - END_VERSIONS - """ +- +- stub: +- def args = task.ext.args ?: '' +- prefix = task.ext.prefix ?: "${meta.id}" +- """ +- mkdir -p ${prefix}/diamond_output ${prefix}/protein_files +- touch ${prefix}/quality_report.tsv ${prefix}/checkm2.log +- +- cat <<-END_VERSIONS > versions.yml +- "${task.process}": +- checkm2: \$(checkm2 --version) +- END_VERSIONS +- """ + cat <<-END_VERSIONS > versions.yml -+ "${task.process}": + checkm2: \$(checkm2 --version) + END_VERSIONS + """ -+} - - stub: - def args = task.ext.args ?: '' + } +'modules/nf-core/checkm2/predict/tests/main.nf.test' is unchanged +'modules/nf-core/checkm2/predict/tests/tags.yml' is unchanged +'modules/nf-core/checkm2/predict/tests/main.nf.test.snap' is unchanged ************************************************************ diff --git a/modules/nf-core/checkm2/predict/main.nf b/modules/nf-core/checkm2/predict/main.nf index ca36136..c5d3e61 100644 --- a/modules/nf-core/checkm2/predict/main.nf +++ b/modules/nf-core/checkm2/predict/main.nf @@ -1,37 +1,35 @@ process CHECKM2 { - tag "$sample" + tag "${sample}" label 'process_medium' - conda "bioconda::checkm2=1.0.1 conda-forge::python=3.7.12" - container "${ params.use_singularity ? - 'https://depot.galaxyproject.org/singularity/checkm2:1.0.1--pyh7cba7a3_0' : - 'biocontainers/checkm2:1.0.1--pyh7cba7a3_0' }" - containerOptions "${ params.directory_to_bind == null ? '' : "--bind ${params.directory_to_bind}" }" + conda "bioconda::checkm2=1.0.1 conda-forge::python=3.7.12" + container "${params.use_singularity + ? 'https://depot.galaxyproject.org/singularity/checkm2:1.0.1--pyh7cba7a3_0' + : 'biocontainers/checkm2:1.0.1--pyh7cba7a3_0'}" + containerOptions "${params.directory_to_bind == null ? '' : "--bind ${params.directory_to_bind}"}" input: tuple val(sample), path(files), val(change_dot_for_underscore) - val "checkm2_db" - val "gtdbtk2_db" + path checkm2_db + path gtdbtk2_db output: path "checkm2", emit: checkm2 + path "tmp_dir", emit: tmp_dir path "versions.yml", emit: versions script: - def outdir = params.outdir - def checkm2_db = params.checkm2_db ? - "--database_path ${params.checkm2_db}" : - "--database_path ${params.outdir}/databases/CheckM2_database/uniref100.KO.1.dmnd" def args = task.ext.args ?: '' """ EXTENSION=\$(echo ".\$(ls ${files}/* | head -n 1 | rev | cut -d. -f1 | rev)") + mkdir tmp_dir checkm2 predict \ - --threads $task.cpus \ - --input $files -x \$EXTENSION \ + --threads ${task.cpus} \ + --input ${files} -x \$EXTENSION \ --output-directory checkm2 \ - $checkm2_db \ - --tmpdir "${outdir}/${sample}" \ - $args + --database_path ${checkm2_db} \ + --tmpdir tmp_dir/ \ + ${args} cat <<-END_VERSIONS > versions.yml checkm2: \$(checkm2 --version) diff --git a/workflows/magflow.nf b/workflows/magflow.nf index 1b116af..f12b09e 100644 --- a/workflows/magflow.nf +++ b/workflows/magflow.nf @@ -37,7 +37,7 @@ include { REMOVE_TMP } from '../modules/local/removetmp.nf' workflow MAGFlow { // Input channels - + if(params.files){ files_ch = Channel.fromPath( params.files, type: 'dir').map {tuple(it.baseName,it )} } else { @@ -47,33 +47,36 @@ workflow MAGFlow { } // Workflow including different tools - + ch_versions = Channel.empty() decompress_ch = DECOMPRESS(files_ch) - + empty_bins_ch = EMPTY_BINS(decompress_ch) change_dot_for_underscore_ch = CHANGE_DOT_FOR_UNDERSCORE(empty_bins_ch) if(params.run_gtdbtk2){ - gtdbtk2_db_ch = GTDBTK2_DB() - } else { - gtdbtk2_db_ch = [] - } - + if ( params.gtdbtk2_db ) { + gtdbtk2_db_ch = file(params.gtdbtk2_db, checkIfExists: true) + } else { + gtdbtk2_db_ch = GTDBTK2_DB() + } + } + busco_ch = Channel.empty() BUSCO(change_dot_for_underscore_ch, gtdbtk2_db_ch) busco_ch = busco_ch.mix(BUSCO.out.busco.collect { it } ) - busco_ch = busco_ch.first() + busco_ch = busco_ch.first() ch_versions = ch_versions.mix(BUSCO.out.versions.first()) - - if(!params.checkm2_db){ - checkm2_db_ch = CHECKM2_DB() - } else { - checkm2_db_ch = [] - } + if(params.run_checkm2){ + if ( params.checkm2_db ) { + checkm2_db_ch = file(params.checkm2_db, checkIfExists: true) + } else { + checkm2_db_ch = CHECKM2_DB() + } + } checkm2_ch = Channel.empty() CHECKM2(change_dot_for_underscore_ch, checkm2_db_ch, gtdbtk2_db_ch) @@ -81,21 +84,21 @@ workflow MAGFlow { checkm2_ch = checkm2_ch.first() ch_versions = ch_versions.mix(CHECKM2.out.versions.first()) - if(params.gtdbtk2_db || params.run_gtdbtk2){ + if(params.gtdbtk2_db || params.run_gtdbtk2){ gtdbtk2_ch = Channel.empty() - GTDBTK2(change_dot_for_underscore_ch, gtdbtk2_db_ch) + GTDBTK2(change_dot_for_underscore_ch, gtdbtk2_db_ch) gtdbtk2_ch = gtdbtk2_ch.mix(GTDBTK2.out.gtdbtk2.collect { it } ) gtdbtk2_ch = gtdbtk2_ch.first() ch_versions = ch_versions.mix(GTDBTK2.out.versions.first()) - } else { - gtdbtk2_ch = [] - } - - if(!params.gunc_db){ - gunc_db_ch = GUNC_DB() - } else { - gunc_db_ch = [] - } + } else { + gtdbtk2_ch = [] + } + + if ( params.gunc_db ) { + gunc_db_ch = file(params.gunc_db, checkIfExists: true) + } else { + gunc_db_ch = GUNC_DB() + } gunc_ch = Channel.empty() GUNC(change_dot_for_underscore_ch, gunc_db_ch, gtdbtk2_db_ch) @@ -107,14 +110,14 @@ workflow MAGFlow { QUAST(change_dot_for_underscore_ch, gtdbtk2_db_ch) quast_ch = quast_ch.mix(QUAST.out.quast.collect { it } ) quast_ch = quast_ch.first() - ch_versions = ch_versions.mix(QUAST.out.versions.first()) + ch_versions = ch_versions.mix(QUAST.out.versions.first()) // Final processing of the outputs concat_dfs_ch = CONCAT_DFS(change_dot_for_underscore_ch, checkm2_ch, busco_ch, gunc_ch, quast_ch, gtdbtk2_ch).collect() final_df_ch = FINAL_DF(concat_dfs_ch) REMOVE_TMP(change_dot_for_underscore_ch, final_df_ch) - + // Collate and save software versions softwareVersionsToYAML(ch_versions)