From e198734cc3be18af5f64f6d7734c7f1a7c3af5a6 Mon Sep 17 00:00:00 2001 From: Sofia Stamouli <91951607+sofstam@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:00:48 +0200 Subject: [PATCH] Update kmcp modules (#3680) * Update kmcp profile * Update kmcp modules * Remove one line * Update test.yml for kmcp/profile * test.yml * Fix linting * Update to kmcp:0.9.3 * kmcp=0.9.3 * Version 0.9.1 * Update test.yml for kmcp/search * Prettier * Fix linting * Update test.yml for kmcp/profile * Update test.yml * Test without stub * Prettier * Add stub to test.yml * Test gzip in search * Try to fix gzip * Try to fix gzip * Test gzip --- modules/nf-core/kmcp/profile/main.nf | 9 +++++---- modules/nf-core/kmcp/profile/meta.yml | 11 +++-------- modules/nf-core/kmcp/search/main.nf | 3 +-- modules/nf-core/kmcp/search/meta.yml | 2 +- tests/config/pytest_modules.yml | 8 ++++++++ tests/modules/nf-core/kmcp/compute/main.nf | 2 +- tests/modules/nf-core/kmcp/compute/test.yml | 3 +-- tests/modules/nf-core/kmcp/profile/main.nf | 16 +++++++--------- .../modules/nf-core/kmcp/profile/nextflow.config | 2 +- tests/modules/nf-core/kmcp/profile/test.yml | 8 ++++---- .../modules/nf-core/kmcp/search/nextflow.config | 4 ---- tests/modules/nf-core/kmcp/search/test.yml | 8 ++------ 12 files changed, 34 insertions(+), 42 deletions(-) diff --git a/modules/nf-core/kmcp/profile/main.nf b/modules/nf-core/kmcp/profile/main.nf index cc520ef8907..a46721224b1 100644 --- a/modules/nf-core/kmcp/profile/main.nf +++ b/modules/nf-core/kmcp/profile/main.nf @@ -9,8 +9,7 @@ process KMCP_PROFILE { input: tuple val(meta), path(search_results) - path taxdump - path taxid + path (db) val mode output: @@ -24,11 +23,13 @@ process KMCP_PROFILE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ + taxid=`find -L ${db} -name "*map"` + taxdump=`find -L ${db}/*/ -type d -not -name "R001"` kmcp \\ profile \\ $args \\ - -X $taxdump \\ - -T $taxid \\ + -X \$taxdump \\ + -T \$taxid \\ -m $mode \\ -j $task.cpus \\ -o ${prefix}.profile \\ diff --git a/modules/nf-core/kmcp/profile/meta.yml b/modules/nf-core/kmcp/profile/meta.yml index 512a882eab4..14f292c758e 100644 --- a/modules/nf-core/kmcp/profile/meta.yml +++ b/modules/nf-core/kmcp/profile/meta.yml @@ -23,18 +23,13 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - db: + type: directory + description: Database directory containing taxdump files and taxid file - search_results: type: file description: Gzipped file output from kmcp search module pattern: "*.gz" - - taxdump: - type: directory - description: Directory of NCBI taxonomy dump files - names.dmp, nodes.dmp - pattern: "*" - - taxid: - type: file - description: Tabular two-column file(s) mapping reference IDs to TaxIds. - pattern: "*.{csv,tsv}" - mode: type: integer description: Profiling mode. diff --git a/modules/nf-core/kmcp/search/main.nf b/modules/nf-core/kmcp/search/main.nf index b0b5e960406..cb2d68435b7 100644 --- a/modules/nf-core/kmcp/search/main.nf +++ b/modules/nf-core/kmcp/search/main.nf @@ -40,8 +40,7 @@ process KMCP_SEARCH { def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" """ - touch ${prefix} - gzip ${prefix} + touch ${prefix}.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/kmcp/search/meta.yml b/modules/nf-core/kmcp/search/meta.yml index d86ae8d172c..5526a179107 100644 --- a/modules/nf-core/kmcp/search/meta.yml +++ b/modules/nf-core/kmcp/search/meta.yml @@ -1,4 +1,4 @@ -name: "kmcp_compute" +name: "kmcp_search" description: Search sequences against database keywords: - metagenomics diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 39a14960902..7b285ab12e0 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2045,10 +2045,18 @@ kmcp/index: - modules/nf-core/kmcp/index/** - tests/modules/nf-core/kmcp/index/** +kmcp/merge: + - modules/nf-core/kmcp/merge/** + - tests/modules/nf-core/kmcp/merge/** + kmcp/profile: - modules/nf-core/kmcp/profile/** - tests/modules/nf-core/kmcp/profile/** +kmcp/search: + - modules/nf-core/kmcp/search/** + - tests/modules/nf-core/kmcp/search/** + kofamscan: - modules/nf-core/kofamscan/** - tests/modules/nf-core/kofamscan/** diff --git a/tests/modules/nf-core/kmcp/compute/main.nf b/tests/modules/nf-core/kmcp/compute/main.nf index 73679ebae12..59860296890 100644 --- a/tests/modules/nf-core/kmcp/compute/main.nf +++ b/tests/modules/nf-core/kmcp/compute/main.nf @@ -19,7 +19,7 @@ workflow test_kmcp_compute_directory { input = UNTAR ( [ [ id:'test' ], - file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/kmcp.tar.gz", checkIfExists: true) + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/kmcp/kmcp_profile.tar.gz", checkIfExists: true) ]).untar KMCP_COMPUTE ( input ) diff --git a/tests/modules/nf-core/kmcp/compute/test.yml b/tests/modules/nf-core/kmcp/compute/test.yml index e10ea1c2873..a8dbb2a24ee 100644 --- a/tests/modules/nf-core/kmcp/compute/test.yml +++ b/tests/modules/nf-core/kmcp/compute/test.yml @@ -1,8 +1,8 @@ - name: kmcp compute test_kmcp_compute command: nextflow run ./tests/modules/nf-core/kmcp/compute -entry test_kmcp_compute -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/kmcp/compute/nextflow.config tags: - - kmcp - kmcp/compute + - kmcp files: - path: output/kmcp/test_/_info.txt contains: ["#path name chunkIdx idxNum genomeSize kmers"] @@ -27,5 +27,4 @@ - path: output/kmcp/test_/_info.txt contains: ["#path name chunkIdx idxNum genomeSize kmers"] - path: output/kmcp/test_/genome.fasta.unik - - path: output/kmcp/test_/transcriptome.fasta.unik - path: output/kmcp/versions.yml diff --git a/tests/modules/nf-core/kmcp/profile/main.nf b/tests/modules/nf-core/kmcp/profile/main.nf index e41f4a2a7c1..bed70144213 100644 --- a/tests/modules/nf-core/kmcp/profile/main.nf +++ b/tests/modules/nf-core/kmcp/profile/main.nf @@ -10,23 +10,21 @@ include { KMCP_PROFILE } from '../../../../../modules/nf-core/kmcp/profile/main. workflow test_kmcp_profile { - input_compute = [ - [ id:'test', single_end:false ], // meta map - file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/kmcp/NC_045512.2.fasta', checkIfExists: true) - ] + input_compute= UNTAR ( [ + [ id:'test' ], + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/kmcp/kmcp_profile.tar.gz", checkIfExists: true) + ]).untar + input = [ [ id:'test', single_end:true ], // meta map file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] - taxdump = [ [],file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/kmcp/kmcp_profile.tar.gz', checkIfExists: true)] - ch_taxid = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/kmcp/seqid2taxid.map', checkIfExists: true) mode = 3 - UNTAR (taxdump) - KMCP_COMPUTE ( input_compute ) + KMCP_COMPUTE (input_compute ) KMCP_INDEX ( KMCP_COMPUTE.out.outdir ) KMCP_SEARCH ( KMCP_INDEX.out.kmcp.map{it[1]}, input ) - KMCP_PROFILE ( KMCP_SEARCH.out.result, UNTAR.out.untar.map{ it[1] }, ch_taxid, mode ) + KMCP_PROFILE ( KMCP_SEARCH.out.result, input_compute.map{ it[1] }, mode ) } diff --git a/tests/modules/nf-core/kmcp/profile/nextflow.config b/tests/modules/nf-core/kmcp/profile/nextflow.config index dafa8f3f73f..98a493be45f 100644 --- a/tests/modules/nf-core/kmcp/profile/nextflow.config +++ b/tests/modules/nf-core/kmcp/profile/nextflow.config @@ -2,7 +2,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: KMCP_INDEX { + withName: KMCP_COMPUTE { ext.prefix = { "${meta.id}_" } } diff --git a/tests/modules/nf-core/kmcp/profile/test.yml b/tests/modules/nf-core/kmcp/profile/test.yml index 4d537bbd5ea..6dac88d16e3 100644 --- a/tests/modules/nf-core/kmcp/profile/test.yml +++ b/tests/modules/nf-core/kmcp/profile/test.yml @@ -1,17 +1,17 @@ - name: kmcp profile test_kmcp_profile command: nextflow run ./tests/modules/nf-core/kmcp/profile -entry test_kmcp_profile -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/kmcp/profile/nextflow.config tags: - - kmcp/profile - kmcp + - kmcp/profile files: - path: output/kmcp/test.profile - - path: output/untar/versions.yml + - path: output/kmcp/versions.yml - name: kmcp profile test_kmcp_profile stub_run command: nextflow run ./tests/modules/nf-core/kmcp/profile -entry test_kmcp_profile -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/kmcp/profile/nextflow.config -stub-run tags: - - kmcp/profile - kmcp + - kmcp/profile files: - path: output/kmcp/test.profile - - path: output/untar/versions.yml + - path: output/kmcp/versions.yml diff --git a/tests/modules/nf-core/kmcp/search/nextflow.config b/tests/modules/nf-core/kmcp/search/nextflow.config index 4eb081d2033..dafa8f3f73f 100644 --- a/tests/modules/nf-core/kmcp/search/nextflow.config +++ b/tests/modules/nf-core/kmcp/search/nextflow.config @@ -6,8 +6,4 @@ process { ext.prefix = { "${meta.id}_" } } - withName: KMCP_SEARCH { - ext.prefix = { "${meta.id}_" } - } - } diff --git a/tests/modules/nf-core/kmcp/search/test.yml b/tests/modules/nf-core/kmcp/search/test.yml index eb356e8755e..7669b72d494 100644 --- a/tests/modules/nf-core/kmcp/search/test.yml +++ b/tests/modules/nf-core/kmcp/search/test.yml @@ -4,9 +4,7 @@ - kmcp - kmcp/search files: - - path: output/kmcp/test_/R001/__db.yml - - path: output/kmcp/test_/R001/__name_mapping.tsv - - path: output/kmcp/test_/R001/_block001.uniki + - path: output/kmcp/test.gz - path: output/kmcp/versions.yml - name: kmcp search test_kmcp_search stub_run @@ -15,7 +13,5 @@ - kmcp - kmcp/search files: - - path: output/kmcp/test_/R001/__db.yml - - path: output/kmcp/test_/R001/__name_mapping.tsv - - path: output/kmcp/test_/R001/_block001.uniki + - path: output/kmcp/test.gz - path: output/kmcp/versions.yml