From dcf61eddfca6191fcd39d212fd59e8cb35dcb304 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 07:20:00 +0200 Subject: [PATCH 01/87] Update actions/checkout digest to 11bd719 (#6836) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/fix-linting.yml | 2 +- .github/workflows/test.yml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 30bfcffb8ec..a9cad1fd5a9 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: # Use the @nf-core-bot token to check out so we can push later - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: token: ${{ secrets.nf_core_bot_auth_token }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94b90449803..bbead51a9c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 # FIXME Flip this off once we get to less than a couple hundred. Adding @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Install NodeJS uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 @@ -58,7 +58,7 @@ jobs: editorconfig: runs-on: ubuntu-latest steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 with: @@ -78,7 +78,7 @@ jobs: modules: ${{ steps.tags.outputs.modules }} subworkflows: ${{ steps.tags.outputs.subworkflows }} steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 2 # To retrieve the preceding commit. @@ -111,7 +111,7 @@ jobs: # Prod for version bumping steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 0 @@ -148,7 +148,7 @@ jobs: "${{ fromJson(needs.nf-test-changes.outputs.modules) }}", ] steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 @@ -194,7 +194,7 @@ jobs: "${{ fromJson(needs.nf-test-changes.outputs.subworkflows) }}", ] steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 @@ -398,7 +398,7 @@ jobs: NXF_ANSI_LOG: false steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 @@ -655,7 +655,7 @@ jobs: SENTIEON_ENCRYPTION_KEY: ${{ secrets.SENTIEON_ENCRYPTION_KEY }} steps: - - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: From daa15d5226111e10ca95c0d4a85fa6bd11a08a01 Mon Sep 17 00:00:00 2001 From: Daniel Schmitz Date: Thu, 24 Oct 2024 13:09:01 +0200 Subject: [PATCH 02/87] Updated HiFiAsm to 0.20 and changed input channels (#6828) * Updated hifiasm to 0.20 * Changed separate input channels to tuple * Added me as author * Updated meta.yml to reflect new input specification. * Changed input channels to group kmers/Hi-C --------- Co-authored-by: Mahesh Binzer-Panchal --- modules/nf-core/hifiasm/environment.yml | 2 +- modules/nf-core/hifiasm/main.nf | 12 +- modules/nf-core/hifiasm/meta.yml | 17 +- modules/nf-core/hifiasm/tests/main.nf.test | 114 ++++++---- .../nf-core/hifiasm/tests/main.nf.test.snap | 196 +++++++++--------- 5 files changed, 191 insertions(+), 150 deletions(-) diff --git a/modules/nf-core/hifiasm/environment.yml b/modules/nf-core/hifiasm/environment.yml index 80293d11987..f50b420e542 100644 --- a/modules/nf-core/hifiasm/environment.yml +++ b/modules/nf-core/hifiasm/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::hifiasm=0.19.9 + - bioconda::hifiasm=0.20.0 diff --git a/modules/nf-core/hifiasm/main.nf b/modules/nf-core/hifiasm/main.nf index 0f9b074b3c3..f2d29a33c55 100644 --- a/modules/nf-core/hifiasm/main.nf +++ b/modules/nf-core/hifiasm/main.nf @@ -4,15 +4,13 @@ process HIFIASM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/hifiasm:0.19.9--h43eeafb_0' : - 'biocontainers/hifiasm:0.19.9--h43eeafb_0' }" + 'https://depot.galaxyproject.org/singularity/hifiasm:0.20.0--h43eeafb_0' : + 'biocontainers/hifiasm:0.20.0--h43eeafb_0' }" input: - tuple val(meta), path(reads) - path paternal_kmer_dump - path maternal_kmer_dump - path hic_read1 - path hic_read2 + tuple val(meta) , path(reads) + tuple val(meta1), path(paternal_kmer_dump), path(maternal_kmer_dump) + tuple val(meta2), path(hic_read1) , path(hic_read2) output: tuple val(meta), path("*.r_utg.gfa") , emit: raw_unitigs diff --git a/modules/nf-core/hifiasm/meta.yml b/modules/nf-core/hifiasm/meta.yml index 5f948b798a9..343ef1820aa 100644 --- a/modules/nf-core/hifiasm/meta.yml +++ b/modules/nf-core/hifiasm/meta.yml @@ -26,18 +26,26 @@ input: type: file description: FASTQ file with PacBio HiFi reads pattern: "*.{fastq}" - - - paternal_kmer_dump: + - - meta1: + type: map + description: | + Groovy Map containing information about parental kmers. + - paternal_kmer_dump: type: file description: Yak kmer dump file for paternal reads (can be used for haplotype resolution). It can have an arbitrary extension. - - - maternal_kmer_dump: + - maternal_kmer_dump: type: file description: Yak kmer dump file for maternal reads (can be used for haplotype resolution). It can have an arbitrary extension. - - - hic_read1: + - - meta2: + type: map + description: | + Groovy Map containing information about Hi-C reads + - hic_read1: type: file description: Hi-C data Forward reads. - - - hic_read2: + - hic_read2: type: file description: Hi-C data Reverse reads. output: @@ -160,6 +168,7 @@ authors: - "@sidorov-si" - "@scorreard" - "@mbeavitt" + - "@schmytzi" maintainers: - "@sidorov-si" - "@scorreard" diff --git a/modules/nf-core/hifiasm/tests/main.nf.test b/modules/nf-core/hifiasm/tests/main.nf.test index 07e9ce89c3c..5258890aa22 100644 --- a/modules/nf-core/hifiasm/tests/main.nf.test +++ b/modules/nf-core/hifiasm/tests/main.nf.test @@ -9,18 +9,24 @@ nextflow_process { tag "modules_nfcore" tag "hifiasm" - test("homo_sapiens pacbio hifi [fastq, , , , ]") { + test("homo_sapiens pacbio hifi [fastq, [,], [,] ]") { when { process { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [], + [], + [] + ] + input[2] = [ + [], + [], + [] ] - input[1] = [] - input[2] = [] - input[3] = [] - input[4] = [] """ } } @@ -43,18 +49,24 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, yak, yak, , ]") { + test("homo_sapiens pacbio hifi [fastq, [yak, yak], [,] ]") { when { process { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [ id : 'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test2.yak', checkIfExists: true) + ] + input[2] = [ + [ id : 'test' ], + [], + [] ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true) - input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test2.yak', checkIfExists: true) - input[3] = [] - input[4] = [] """ } } @@ -76,18 +88,24 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, , , fastq, fastq]") { + test("homo_sapiens pacbio hifi [fastq, [,], [fastq, fastq] ]") { when { process { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [ id : 'test' ], + [], + [] + ] + input[2] = [ + [ id : 'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] - input[1] = [] - input[2] = [] - input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true) - input[4] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) """ } } @@ -109,17 +127,23 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, yak, yak, fastq, fastq]") { + test("homo_sapiens pacbio hifi [fastq, [yak, yak], [fastq, fastq] ]") { when { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [ id : 'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test2.yak', checkIfExists: true) + ] + input[2] = [ + [ id : 'test' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz, checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz, checkIfExists: true) ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true) - input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test2.yak', checkIfExists: true) - input[3] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz, checkIfExists: true) - input[4] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz, checkIfExists: true) """ } then { @@ -129,17 +153,19 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, yak, , , ]") { + test("homo_sapiens pacbio hifi [fastq, [yak, ], [,] ]") { when { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [ id : 'test'], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true), + [] ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/yak/test.yak', checkIfExists: true) input[2] = [] - input[3] = [] - input[4] = [] """ } then { @@ -149,17 +175,19 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, , , , fastq]") { + test("homo_sapiens pacbio hifi [fastq, [,], [, fastq] ]") { when { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) ] input[1] = [] - input[2] = [] - input[3] = [] - input[4] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + input[2] = [ + [ id : 'test'], + [], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] """ } then { @@ -169,19 +197,25 @@ nextflow_process { } } - test("homo_sapiens pacbio hifi [fastq, , , , ] - stub") { + test("homo_sapiens pacbio hifi [fastq, [,], [,] ] - stub") { options "-stub" when { process { """ input[0] = [ [ id : 'test'], - [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true)] + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true) + ] + input[1] = [ + [], + [], + [] + ] + input[2] = [ + [], + [], + [] ] - input[1] = [] - input[2] = [] - input[3] = [] - input[4] = [] """ } } diff --git a/modules/nf-core/hifiasm/tests/main.nf.test.snap b/modules/nf-core/hifiasm/tests/main.nf.test.snap index 932fce839dc..8ad9589e818 100644 --- a/modules/nf-core/hifiasm/tests/main.nf.test.snap +++ b/modules/nf-core/hifiasm/tests/main.nf.test.snap @@ -1,5 +1,93 @@ { - "homo_sapiens pacbio hifi [fastq, , , , ] - stub": { + "homo_sapiens pacbio hifi [fastq, [,], [,] ]": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.asm.bp.r_utg.gfa:md5,6a200e4bcb5d8d8fa6ed75874d26edc6" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.bp.p_ctg.gfa:md5,c3225425a73a8d6d46536dab72380650" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.bp.p_utg.gfa:md5,6a200e4bcb5d8d8fa6ed75874d26edc6" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.bp.hap1.p_ctg.gfa:md5,78a86b6d5741a680e22a427ca9faa74a" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.bp.hap2.p_ctg.gfa:md5,ac2116fd2f22c67d4c304cbf9b9f7793" + ] + ], + [ + "versions.yml:md5,6a23f7ea8bae71905c537cd521cffcb8" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T14:01:04.528764919" + }, + "homo_sapiens pacbio hifi [fastq, [,], [fastq, fastq] ]": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.asm.hic.r_utg.gfa:md5,6a200e4bcb5d8d8fa6ed75874d26edc6" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.hic.p_utg.gfa:md5,6a200e4bcb5d8d8fa6ed75874d26edc6" + ] + ], + [ + [ + { + "id": "test" + }, + "test.asm.hic.hap1.p_ctg.gfa:md5,f67a8fdfa756961360732c79d189054d" + ] + ], + [ + "versions.yml:md5,6a23f7ea8bae71905c537cd521cffcb8" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T14:08:48.081396092" + }, + "homo_sapiens pacbio hifi [fastq, [,], [,] ] - stub": { "content": [ { "0": [ @@ -27,7 +115,7 @@ ] ], "11": [ - "versions.yml:md5,981b5ef63d639c5f0fae9846b07c6d53" + "versions.yml:md5,6a23f7ea8bae71905c537cd521cffcb8" ], "2": [ [ @@ -182,7 +270,7 @@ ] ], "versions": [ - "versions.yml:md5,981b5ef63d639c5f0fae9846b07c6d53" + "versions.yml:md5,6a23f7ea8bae71905c537cd521cffcb8" ] } ], @@ -190,104 +278,16 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-18T09:26:14.077804563" - }, - "homo_sapiens pacbio hifi [fastq, , , fastq, fastq]": { - "content": [ - [ - [ - { - "id": "test" - }, - "test.asm.hic.r_utg.gfa:md5,9cb983397b093bcf9ef5a01c5aa52c6c" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.hic.p_utg.gfa:md5,3e2b4815145b06bb74f1b74876e767dc" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.hic.hap1.p_ctg.gfa:md5,467a7f7d6dd15b773f15ccce84e0f28d" - ] - ], - [ - "versions.yml:md5,981b5ef63d639c5f0fae9846b07c6d53" - ] - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-18T09:03:04.159625282" - }, - "homo_sapiens pacbio hifi [fastq, , , , ]": { - "content": [ - [ - [ - { - "id": "test" - }, - "test.asm.bp.r_utg.gfa:md5,9cb983397b093bcf9ef5a01c5aa52c6c" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.bp.p_ctg.gfa:md5,c83aba621a6ae5a5b5b39dbdc1a0ba9d" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.bp.p_utg.gfa:md5,3e2b4815145b06bb74f1b74876e767dc" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.bp.hap1.p_ctg.gfa:md5,1206beee1cda7b39e48e0a080fde0801" - ] - ], - [ - [ - { - "id": "test" - }, - "test.asm.bp.hap2.p_ctg.gfa:md5,765b53fbf44b43826174585438a3578e" - ] - ], - [ - "versions.yml:md5,981b5ef63d639c5f0fae9846b07c6d53" - ] - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-18T09:02:09.113570192" + "timestamp": "2024-10-23T14:09:13.475508542" }, - "homo_sapiens pacbio hifi [fastq, yak, yak, , ]": { + "homo_sapiens pacbio hifi [fastq, [yak, yak], [,] ]": { "content": [ [ [ { "id": "test" }, - "test.asm.dip.r_utg.gfa:md5,9cb983397b093bcf9ef5a01c5aa52c6c" + "test.asm.dip.r_utg.gfa:md5,68361ac3e8babd51f3891d1637ca0fdc" ] ], [ @@ -295,7 +295,7 @@ { "id": "test" }, - "test.asm.dip.p_utg.gfa:md5,3e2b4815145b06bb74f1b74876e767dc" + "test.asm.dip.p_utg.gfa:md5,68361ac3e8babd51f3891d1637ca0fdc" ] ], [ @@ -303,17 +303,17 @@ { "id": "test" }, - "test.asm.dip.hap1.p_ctg.gfa:md5,9d4d20104ef4bc3d2896ae25c6b35c06" + "test.asm.dip.hap1.p_ctg.gfa:md5,eed5da5f3dd415dbb711edb61a09802f" ] ], [ - "versions.yml:md5,981b5ef63d639c5f0fae9846b07c6d53" + "versions.yml:md5,6a23f7ea8bae71905c537cd521cffcb8" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-18T09:02:35.562018153" + "timestamp": "2024-10-23T13:33:47.765243676" } } \ No newline at end of file From eb2c3f7ee2c938ab1a49764bdb1319adaa35492c Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:23:35 +0200 Subject: [PATCH 03/87] Fix and update SVDB (#6839) * Fix priority bug * Latest SVDB version, and bcftools to be able to choose output file and index format * fix meta --- modules/nf-core/svdb/build/environment.yml | 2 +- modules/nf-core/svdb/build/main.nf | 4 +- .../svdb/build/tests/main.nf.test.snap | 20 ++-- modules/nf-core/svdb/merge/environment.yml | 5 +- modules/nf-core/svdb/merge/main.nf | 73 +++++++----- modules/nf-core/svdb/merge/meta.yml | 32 +++++- modules/nf-core/svdb/merge/tests/main.nf.test | 32 ++---- .../svdb/merge/tests/main.nf.test.snap | 106 +++++++++++++----- .../nf-core/svdb/merge/tests/nextflow.config | 1 + modules/nf-core/svdb/query/environment.yml | 2 +- modules/nf-core/svdb/query/main.nf | 4 +- .../svdb/query/tests/main.nf.test.snap | 25 +---- 12 files changed, 184 insertions(+), 122 deletions(-) diff --git a/modules/nf-core/svdb/build/environment.yml b/modules/nf-core/svdb/build/environment.yml index cd35cf488a5..2af552205f8 100644 --- a/modules/nf-core/svdb/build/environment.yml +++ b/modules/nf-core/svdb/build/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::svdb=2.8.1 + - bioconda::svdb=2.8.2 diff --git a/modules/nf-core/svdb/build/main.nf b/modules/nf-core/svdb/build/main.nf index db3055e26c9..6c3abc31117 100644 --- a/modules/nf-core/svdb/build/main.nf +++ b/modules/nf-core/svdb/build/main.nf @@ -4,8 +4,8 @@ process SVDB_BUILD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/svdb:2.8.1--py39h5371cbf_0': - 'biocontainers/svdb:2.8.1--py39h5371cbf_0' }" + 'https://depot.galaxyproject.org/singularity/svdb:2.8.2--py39h5371cbf_0': + 'biocontainers/svdb:2.8.2--py39h5371cbf_0' }" input: tuple val(meta), path(input) diff --git a/modules/nf-core/svdb/build/tests/main.nf.test.snap b/modules/nf-core/svdb/build/tests/main.nf.test.snap index 9a9929573ce..5cef5d0a537 100644 --- a/modules/nf-core/svdb/build/tests/main.nf.test.snap +++ b/modules/nf-core/svdb/build/tests/main.nf.test.snap @@ -3,27 +3,27 @@ "content": [ "test.db", [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-18T11:37:21.374511177" + "timestamp": "2024-10-24T09:03:48.567184823" }, "two VCFs - files": { "content": [ "test.db", [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-18T11:37:27.968892336" + "timestamp": "2024-10-24T09:03:56.532448243" }, "two VCFs - files -stub": { "content": [ @@ -37,7 +37,7 @@ ] ], "1": [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ], "db": [ [ @@ -48,7 +48,7 @@ ] ], "versions": [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ] } ], @@ -56,7 +56,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-18T11:40:04.558825564" + "timestamp": "2024-10-24T09:04:11.44464276" }, "one VCF - files -stub": { "content": [ @@ -70,7 +70,7 @@ ] ], "1": [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ], "db": [ [ @@ -81,7 +81,7 @@ ] ], "versions": [ - "versions.yml:md5,171626910c11bd4ea32d2dc4255dbba8" + "versions.yml:md5,9b27195b3baedc2374fdc3922173c0fa" ] } ], @@ -89,6 +89,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-18T10:54:45.735248435" + "timestamp": "2024-10-24T09:04:03.87138989" } } \ No newline at end of file diff --git a/modules/nf-core/svdb/merge/environment.yml b/modules/nf-core/svdb/merge/environment.yml index f725b65248d..ab87ec70a1b 100644 --- a/modules/nf-core/svdb/merge/environment.yml +++ b/modules/nf-core/svdb/merge/environment.yml @@ -3,6 +3,5 @@ channels: - bioconda dependencies: - - htslib=1.19.1 - - samtools=1.19.2 - - svdb=2.8.1 + - bcftools=1.21 + - svdb=2.8.2 diff --git a/modules/nf-core/svdb/merge/main.nf b/modules/nf-core/svdb/merge/main.nf index d28f2a97cff..5b19a299310 100644 --- a/modules/nf-core/svdb/merge/main.nf +++ b/modules/nf-core/svdb/merge/main.nf @@ -3,83 +3,102 @@ process SVDB_MERGE { label 'process_medium' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-c8daa8f9d69d3c5a1a4ff08283a166c18edb0000:511069f65a53621c5503e5cfee319aa3c735abfa-0': - 'biocontainers/mulled-v2-c8daa8f9d69d3c5a1a4ff08283a166c18edb0000:511069f65a53621c5503e5cfee319aa3c735abfa-0' }" + 'https://depot.galaxyproject.org/singularity/mulled-v2-375a758a4ca8c128fb9d38047a68a9f4322d2acd:b3615e06ef17566f2988a215ce9e10808c1d08bf-0': + 'biocontainers/mulled-v2-375a758a4ca8c128fb9d38047a68a9f4322d2acd:b3615e06ef17566f2988a215ce9e10808c1d08bf-0' }" input: tuple val(meta), path(vcfs) - val(priority) + val(input_priority) val(sort_inputs) output: - tuple val(meta), path("*.vcf.gz"), emit: vcf - path "versions.yml" , emit: versions + tuple val(meta), path("*.{vcf,vcf.gz,bcf,bcf.gz}"), emit: vcf + tuple val(meta), path("*.tbi") , emit: tbi, optional: true + tuple val(meta), path("*.csi") , emit: csi, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" // Ensure priority list matches the number of VCFs if priority is provided - if (priority && vcfs.collect().size() != priority.collect().size()) { + if (input_priority && vcfs.collect().size() != input_priority.collect().size()) { error "If priority is used, one tag per VCF is needed" } - if (sort_inputs && vcfs.collect().size() > 1) { - if (priority) { + def input = "" + def prio = "" + if (input_priority) { + if (vcfs.collect().size() > 1 && sort_inputs) { // make vcf-prioprity pairs and sort on VCF name, so priority is also sorted the same - def pairs = vcfs.indices.collect { [vcfs[it], priority[it]] } + def pairs = vcfs.indices.collect { [vcfs[it], input_priority[it]] } pairs = pairs.sort { a, b -> a[0].name <=> b[0].name } vcfs = pairs.collect { it[0] } priority = pairs.collect { it[1] } } else { - // if there's no priority input just sort the vcfs by name - vcfs = vcfs.sort { it.name } + priority = input_priority } - } - - // If there's only one input VCF the code above is not executed, and that VCF becomes the input - input = vcfs - def prio = "" - if(priority) { - prio = "--priority ${priority.join(',')}" + // Build inputs + prio = "--priority ${input_priority.join(',')}" input = "" for (int index = 0; index < vcfs.collect().size(); index++) { input += "${vcfs[index]}:${priority[index]} " } + + } else { + // if there's no priority input just sort the vcfs by name if possible + input = (vcfs.collect().size() > 1 && sort_inputs) ? vcfs.sort { it.name } : vcfs } + def extension = args2.contains("--output-type b") || args2.contains("-Ob") ? "bcf.gz" : + args2.contains("--output-type u") || args2.contains("-Ou") ? "bcf" : + args2.contains("--output-type z") || args2.contains("-Oz") ? "vcf.gz" : + args2.contains("--output-type v") || args2.contains("-Ov") ? "vcf" : + "vcf" """ svdb \\ --merge \\ $args \\ $prio \\ - --vcf $input \\ - > ${prefix}.vcf - - bgzip \\ - --threads ${task.cpus} \\ - ${prefix}.vcf + --vcf $input |\\ + bcftools view \\ + --threads ${task.cpus} \\ + --output ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml "${task.process}": svdb: \$( echo \$(svdb) | head -1 | sed 's/usage: SVDB-\\([0-9]\\.[0-9]\\.[0-9]\\).*/\\1/' ) - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') END_VERSIONS """ stub: def prefix = task.ext.prefix ?: "${meta.id}" + def args2 = task.ext.args2 ?: '' + def extension = args2.contains("--output-type b") || args2.contains("-Ob") ? "bcf.gz" : + args2.contains("--output-type u") || args2.contains("-Ou") ? "bcf" : + args2.contains("--output-type z") || args2.contains("-Oz") ? "vcf.gz" : + args2.contains("--output-type v") || args2.contains("-Ov") ? "vcf" : + "vcf" + def index = args2.contains("--write-index=tbi") || args2.contains("-W=tbi") ? "tbi" : + args2.contains("--write-index=csi") || args2.contains("-W=csi") ? "csi" : + args2.contains("--write-index") || args2.contains("-W") ? "csi" : + "" + def create_cmd = extension.endsWith(".gz") ? "echo '' | gzip >" : "touch" + def create_index = extension.endsWith(".gz") && index.matches("csi|tbi") ? "touch ${prefix}.${extension}.${index}" : "" """ - echo | gzip > ${prefix}.vcf.gz + ${create_cmd} ${prefix}.${extension} + ${create_index} cat <<-END_VERSIONS > versions.yml "${task.process}": svdb: \$( echo \$(svdb) | head -1 | sed 's/usage: SVDB-\\([0-9]\\.[0-9]\\.[0-9]\\).*/\\1/' ) - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') END_VERSIONS """ } diff --git a/modules/nf-core/svdb/merge/meta.yml b/modules/nf-core/svdb/merge/meta.yml index d6cc17580f1..c34a9cb1577 100644 --- a/modules/nf-core/svdb/merge/meta.yml +++ b/modules/nf-core/svdb/merge/meta.yml @@ -23,7 +23,7 @@ input: One or more VCF files. The order and number of files should correspond to the order and number of tags in the `priority` input channel. pattern: "*.{vcf,vcf.gz}" - - - priority: + - - input_priority: type: list description: | Prioritize the input VCF files according to this list, @@ -34,18 +34,37 @@ input: description: | Should the input files be sorted by name. The priority tag will be sorted together with it's corresponding VCF file. - output: - vcf: - meta: type: map description: | Groovy Map containing sample information - e.g. [ id:'test' ] - - "*.vcf.gz": + e.g. [ id:'test', single_end:false ] + - "*.{vcf,vcf.gz,bcf,bcf.gz}": type: file - description: merged VCF file - pattern: "*.vcf.gz" + description: VCF output file + pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}" + - tbi: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.tbi": + type: file + description: Alternative VCF file index + pattern: "*.tbi" + - csi: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.csi": + type: file + description: Default VCF file index + pattern: "*.csi" - versions: - versions.yml: type: file @@ -55,3 +74,4 @@ authors: - "@ramprasadn" maintainers: - "@ramprasadn" + - "@fellen31" diff --git a/modules/nf-core/svdb/merge/tests/main.nf.test b/modules/nf-core/svdb/merge/tests/main.nf.test index 0dddffa3e73..6a79d7a09aa 100644 --- a/modules/nf-core/svdb/merge/tests/main.nf.test +++ b/modules/nf-core/svdb/merge/tests/main.nf.test @@ -16,9 +16,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) ]) input[1] = [] input[2] = [] @@ -29,7 +27,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--vcf test.vcf") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -46,9 +44,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) ]) input[1] = [] input[2] = [] @@ -59,7 +55,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--vcf test.vcf") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -76,9 +72,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) ]) input[1] = ['tiddit'] input[2] = [] @@ -89,7 +83,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf:tiddit") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--priority tiddit --vcf test.vcf:tiddit") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -106,9 +100,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) ]) input[1] = ['tiddit'] input[2] = true @@ -119,7 +111,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf:tiddit") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--priority tiddit --vcf test.vcf:tiddit") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -150,7 +142,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test2.vcf test.vcf") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--vcf test2.vcf test.vcf") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -181,7 +173,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf test2.vcf") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--vcf test.vcf test2.vcf") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -212,7 +204,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test2.vcf:tiddit test.vcf:cnvnator") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--priority tiddit,cnvnator --vcf test2.vcf:tiddit test.vcf:cnvnator") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, @@ -243,7 +235,7 @@ nextflow_process { then { assertAll ( { assert process.success }, - { assert path(process.out.vcf.get(0).get(1)).linesGzip[2].contains("--vcf test.vcf:cnvnator test2.vcf:tiddit") }, // SVDB command line + { assert path(process.out.vcf.get(0).get(1)).linesGzip[3].contains("--priority tiddit,cnvnator --vcf test.vcf:cnvnator test2.vcf:tiddit") }, // SVDB command line { assert snapshot( path(process.out.vcf.get(0).get(1)).vcf.summary, path(process.out.vcf.get(0).get(1)).vcf.variantsMD5, diff --git a/modules/nf-core/svdb/merge/tests/main.nf.test.snap b/modules/nf-core/svdb/merge/tests/main.nf.test.snap index a5daf368604..e86662e5335 100644 --- a/modules/nf-core/svdb/merge/tests/main.nf.test.snap +++ b/modules/nf-core/svdb/merge/tests/main.nf.test.snap @@ -4,14 +4,14 @@ "VcfFile [chromosomes=[MT192765.1], sampleCount=1, variantCount=9, phased=false, phasedAutodetect=false]", "60fb4cab2aa891bebef8ffdbd0e41bc3", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:30:08.029708713" + "timestamp": "2024-10-24T09:00:25.9277471" }, "2 samples, ['tiddit', 'cnvnator'], true - stub": { "content": [ @@ -25,7 +25,19 @@ ] ], "1": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" + ], + "csi": [ + + ], + "tbi": [ + ], "vcf": [ [ @@ -36,7 +48,7 @@ ] ], "versions": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] } ], @@ -44,105 +56,105 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:32:10.741546957" + "timestamp": "2024-10-24T09:05:49.325618245" }, "2 samples, ['tiddit', 'cnvnator'], []": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=2, variantCount=9, phased=false, phasedAutodetect=false]", "254e56e4fc8356d68424828438da66e3", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:31:15.105041662" + "timestamp": "2024-10-24T09:02:27.964808463" }, "2 samples, [], []": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=2, variantCount=9, phased=false, phasedAutodetect=false]", "7ad648266e57d405b5b01aaea4613d1c", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:41:54.793936976" + "timestamp": "2024-10-24T09:02:11.013532413" }, "2 samples, ['tiddit', 'cnvnator'], true": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=2, variantCount=9, phased=false, phasedAutodetect=false]", - "74ed58e115db54f30036bfd68a7dc432", + "254e56e4fc8356d68424828438da66e3", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:31:29.320496992" + "timestamp": "2024-10-24T09:02:35.956320871" }, "1 sample, ['tiddit'], []": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=1, variantCount=9, phased=false, phasedAutodetect=false]", "9dd588cd870672b78192f48ad440b5d", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:30:30.590239659" + "timestamp": "2024-10-24T09:00:42.064583463" }, "1 sample, [], true": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=1, variantCount=9, phased=false, phasedAutodetect=false]", "60fb4cab2aa891bebef8ffdbd0e41bc3", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:30:22.670145479" + "timestamp": "2024-10-24T09:00:33.88572601" }, "1 sample, ['tiddit'], true": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=1, variantCount=9, phased=false, phasedAutodetect=false]", "9dd588cd870672b78192f48ad440b5d", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:30:40.958649472" + "timestamp": "2024-10-24T09:00:50.18149857" }, "2 samples, [], true": { "content": [ "VcfFile [chromosomes=[MT192765.1], sampleCount=2, variantCount=9, phased=false, phasedAutodetect=false]", "de0a3b56cdee89e4c9cd4fbb4ad3391d", [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] ], "meta": { "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:31:01.933044815" + "timestamp": "2024-10-24T09:02:19.556799178" }, "2 samples, ['tiddit', 'cnvnator'], [] - stub": { "content": [ @@ -156,7 +168,19 @@ ] ], "1": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" + ], + "csi": [ + + ], + "tbi": [ + ], "vcf": [ [ @@ -167,7 +191,7 @@ ] ], "versions": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] } ], @@ -175,7 +199,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:31:59.830493054" + "timestamp": "2024-10-24T09:05:40.427970257" }, "2 samples, [], [] - stub": { "content": [ @@ -189,7 +213,19 @@ ] ], "1": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" + ], + "csi": [ + + ], + "tbi": [ + ], "vcf": [ [ @@ -200,7 +236,7 @@ ] ], "versions": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] } ], @@ -208,7 +244,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:41:07.289491939" + "timestamp": "2024-10-24T09:05:24.34471465" }, "2 samples, [], true - stub": { "content": [ @@ -222,7 +258,19 @@ ] ], "1": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" + ], + "csi": [ + + ], + "tbi": [ + ], "vcf": [ [ @@ -233,7 +281,7 @@ ] ], "versions": [ - "versions.yml:md5,772f39343052d54d9bcb21d4892da203" + "versions.yml:md5,bf8271626d334b2a827f94a2daacadd0" ] } ], @@ -241,6 +289,6 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-10-17T08:31:48.40721064" + "timestamp": "2024-10-24T09:05:32.529261733" } } \ No newline at end of file diff --git a/modules/nf-core/svdb/merge/tests/nextflow.config b/modules/nf-core/svdb/merge/tests/nextflow.config index 25f38031fef..c267037ca0b 100644 --- a/modules/nf-core/svdb/merge/tests/nextflow.config +++ b/modules/nf-core/svdb/merge/tests/nextflow.config @@ -1,5 +1,6 @@ process { withName: 'SVDB_MERGE' { ext.prefix = "merged" + ext.args2 = '--output-type z --no-version' } } diff --git a/modules/nf-core/svdb/query/environment.yml b/modules/nf-core/svdb/query/environment.yml index cd35cf488a5..2af552205f8 100644 --- a/modules/nf-core/svdb/query/environment.yml +++ b/modules/nf-core/svdb/query/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::svdb=2.8.1 + - bioconda::svdb=2.8.2 diff --git a/modules/nf-core/svdb/query/main.nf b/modules/nf-core/svdb/query/main.nf index d516d3828c7..4ceb477a002 100644 --- a/modules/nf-core/svdb/query/main.nf +++ b/modules/nf-core/svdb/query/main.nf @@ -4,8 +4,8 @@ process SVDB_QUERY { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/svdb:2.8.1--py39h5371cbf_0': - 'biocontainers/svdb:2.8.1--py39h5371cbf_0' }" + 'https://depot.galaxyproject.org/singularity/svdb:2.8.2--py39h5371cbf_0': + 'biocontainers/svdb:2.8.2--py39h5371cbf_0' }" input: tuple val(meta), path(vcf) diff --git a/modules/nf-core/svdb/query/tests/main.nf.test.snap b/modules/nf-core/svdb/query/tests/main.nf.test.snap index 22021d0a240..65f2fcfaa96 100644 --- a/modules/nf-core/svdb/query/tests/main.nf.test.snap +++ b/modules/nf-core/svdb/query/tests/main.nf.test.snap @@ -4,27 +4,10 @@ "test_query.vcf", "versions.yml" ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, "timestamp": "2023-11-22T14:56:08.90223505" - }, - "versions": { - "content": [ - [ - "versions.yml:md5,e10873514a6dfc4ff377d645e7b3c9f5" - ] - ], - "timestamp": "2023-11-22T14:36:48.543666873" - }, - "vcf": { - "content": [ - [ - [ - { - "id": "test" - }, - "test_query.vcf:md5,a29542606323b2430ec52ffb5c4c7f5e" - ] - ] - ], - "timestamp": "2023-11-22T14:36:48.523155905" } } \ No newline at end of file From 467c202a876d26af544fa8c4b22a050a535462a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Thu, 24 Oct 2024 15:54:22 +0200 Subject: [PATCH 04/87] Fix fastatoelfasta and yaml schema (#6840) * fix meta.yml for fastatoelfasta * fix incorrect schema for output section * fix more meta.ymls --- modules/meta-schema.json | 9 ++++++++- modules/nf-core/arriba/download/meta.yml | 2 +- modules/nf-core/elprep/fastatoelfasta/meta.yml | 11 +++++++++-- modules/nf-core/samshee/meta.yml | 18 +++++++++--------- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/modules/meta-schema.json b/modules/meta-schema.json index 977ee1b624d..ab7bcac0662 100644 --- a/modules/meta-schema.json +++ b/modules/meta-schema.json @@ -47,7 +47,14 @@ "description": "Output channels for the module", "items": { "type": "object", - "items": { "$ref": "#/definitions/elementProperties" } + "patternProperties": { + ".*": { + "type": "array", + "items": { + "$ref": "#/definitions/elementProperties" + } + } + } } }, "tools": { diff --git a/modules/nf-core/arriba/download/meta.yml b/modules/nf-core/arriba/download/meta.yml index 892b7ac9b78..bdf542ebce0 100644 --- a/modules/nf-core/arriba/download/meta.yml +++ b/modules/nf-core/arriba/download/meta.yml @@ -22,7 +22,7 @@ input: output: - blacklist: - blacklist*${genome}*.tsv.gz: - type: str + type: string description: The blacklist removes recurrent alignment artifacts and transcripts which are present in healthy tissue pattern: ".tsv.gz" diff --git a/modules/nf-core/elprep/fastatoelfasta/meta.yml b/modules/nf-core/elprep/fastatoelfasta/meta.yml index 41a8be31af5..2d9c877dbd8 100644 --- a/modules/nf-core/elprep/fastatoelfasta/meta.yml +++ b/modules/nf-core/elprep/fastatoelfasta/meta.yml @@ -42,8 +42,15 @@ output: e.g. `[ id:'sample1', single_end:false ]` pattern: "*.elfasta" - log: - - meta: {} - - logs/elprep/elprep*: {} + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - logs/elprep/elprep*: + type: file + description: ELFasta log file + pattern: "*.log" - versions: - versions.yml: type: file diff --git a/modules/nf-core/samshee/meta.yml b/modules/nf-core/samshee/meta.yml index 50789dfbaef..4ff2ab9fa12 100644 --- a/modules/nf-core/samshee/meta.yml +++ b/modules/nf-core/samshee/meta.yml @@ -29,18 +29,18 @@ input: output: - samplesheet: - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', lane:1 ] + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', lane:1 ] - "*_formatted.csv": - type: file - description: "illumina v2 samplesheet" + type: file + description: "illumina v2 samplesheet" - versions: - versions.yml: - type: file - description: File containing software version - pattern: "versions.yml" + type: file + description: File containing software version + pattern: "versions.yml" authors: - "@nschcolnicov" maintainers: From 2ccee1830c4b65b9158f5750408ddfb6c7b12e9a Mon Sep 17 00:00:00 2001 From: KamilMaliszArdigen <32459801+KamilMaliszArdigen@users.noreply.github.com> Date: Fri, 25 Oct 2024 00:07:14 +0200 Subject: [PATCH 05/87] Limma mixed models feature (#6753) * Limma mixed models feature * Test fix * Limma voom moved to new module * Limma voom nf-tests * Limma voom nf-tests * Extension of limma module with voom and IHW correction * After review changes * Removal of IHS correction * Contrasts definition logic update * Removal of old draft * Test's and env update * Update modules/nf-core/limma/differential/templates/limma_de.R Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/environment.yml Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/main.nf Co-authored-by: Jonathan Manning * Removal of not used library's * Limma tests migration to nf-tests * Limma tests update * smap update * smap update * smap update * smap update * smap update * smap update * Nf-tests update to restore old tests logic * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Test data path correction * Meta yml update --------- Co-authored-by: Jonathan Manning --- .../limma/differential/environment.yml | 3 +- modules/nf-core/limma/differential/main.nf | 35 ++- modules/nf-core/limma/differential/meta.yml | 9 + .../limma/differential/templates/limma_de.R | 180 ++++++++--- .../limma/differential/tests/main.nf.test | 282 ++++++++++++++++++ .../differential/tests/main.nf.test.snap | 164 ++++++++++ .../limma/differential/tests/nextflow.config | 19 ++ .../tests/nextflow.exclude_samples.config | 22 ++ .../tests/nextflow.subset_to_contrast.config | 20 ++ .../differential/tests/nextflow.voom.config | 13 + .../tests/nextflow.voom_blocking.config | 14 + tests/config/pytest_modules.yml | 3 - .../nf-core/limma/differential/main.nf | 116 ------- .../limma/differential/nextflow.config | 24 -- .../nf-core/limma/differential/test.yml | 47 --- 15 files changed, 720 insertions(+), 231 deletions(-) create mode 100644 modules/nf-core/limma/differential/tests/main.nf.test create mode 100644 modules/nf-core/limma/differential/tests/main.nf.test.snap create mode 100644 modules/nf-core/limma/differential/tests/nextflow.config create mode 100644 modules/nf-core/limma/differential/tests/nextflow.exclude_samples.config create mode 100644 modules/nf-core/limma/differential/tests/nextflow.subset_to_contrast.config create mode 100644 modules/nf-core/limma/differential/tests/nextflow.voom.config create mode 100644 modules/nf-core/limma/differential/tests/nextflow.voom_blocking.config delete mode 100644 tests/modules/nf-core/limma/differential/main.nf delete mode 100644 tests/modules/nf-core/limma/differential/nextflow.config delete mode 100644 tests/modules/nf-core/limma/differential/test.yml diff --git a/modules/nf-core/limma/differential/environment.yml b/modules/nf-core/limma/differential/environment.yml index f70a20eff5b..5ff03f6cef3 100644 --- a/modules/nf-core/limma/differential/environment.yml +++ b/modules/nf-core/limma/differential/environment.yml @@ -2,4 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::bioconductor-limma=3.54.0 + - bioconda::bioconductor-edger=4.0.16 + - bioconda::bioconductor-limma=3.58.1 diff --git a/modules/nf-core/limma/differential/main.nf b/modules/nf-core/limma/differential/main.nf index 384e4649871..be6c72ecef3 100644 --- a/modules/nf-core/limma/differential/main.nf +++ b/modules/nf-core/limma/differential/main.nf @@ -4,8 +4,8 @@ process LIMMA_DIFFERENTIAL { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bioconductor-limma:3.54.0--r42hc0cfd56_0' : - 'biocontainers/bioconductor-limma:3.54.0--r42hc0cfd56_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/af/afd9579a0ff62890ff451d82b360d85e82a0d61a3da40736ee0eee4e45926269/data' : + 'community.wave.seqera.io/library/bioconductor-limma_bioconductor-edger:54dd09078d5db3b3' }" input: tuple val(meta), val(contrast_variable), val(reference), val(target) @@ -17,6 +17,7 @@ process LIMMA_DIFFERENTIAL { tuple val(meta), path("*.MArrayLM.limma.rds") , emit: rdata tuple val(meta), path("*.limma.model.txt") , emit: model tuple val(meta), path("*.R_sessionInfo.log") , emit: session_info + tuple val(meta), path("*.normalised_counts.tsv") , emit: normalised_counts, optional: true path "versions.yml" , emit: versions when: @@ -24,4 +25,34 @@ process LIMMA_DIFFERENTIAL { script: template 'limma_de.R' + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + #!/usr/bin/env Rscript + library(limma) + a <- file("${prefix}.limma.results.tsv", "w") + close(a) + a <- file("${prefix}.limma.mean_difference.png", "w") + close(a) + a <- file("${prefix}.MArrayLM.limma.rds", "w") + close(a) + a <- file("${prefix}.normalised_counts.tsv", "w") + close(a) + a <- file("${prefix}.limma.model.txt", "w") + close(a) + a <- file("${prefix}.R_sessionInfo.log", "w") + close(a) + ## VERSIONS FILE + r.version <- strsplit(version[['version.string']], ' ')[[1]][3] + limma.version <- as.character(packageVersion('limma')) + writeLines( + c( + '"${task.process}":', + paste(' r-base:', r.version), + paste(' bioconductor-limma:', limma.version) + ), + 'versions.yml' + ) + """ } diff --git a/modules/nf-core/limma/differential/meta.yml b/modules/nf-core/limma/differential/meta.yml index f76c57a42b3..dbf904305a1 100644 --- a/modules/nf-core/limma/differential/meta.yml +++ b/modules/nf-core/limma/differential/meta.yml @@ -98,6 +98,15 @@ output: type: file description: dump of R SessionInfo pattern: "*.log" + - normalised_counts: + - meta: + type: file + description: normalised TSV format expression matrix with probes by row and samples by column + pattern: "*.normalised_counts.tsv" + - "*.normalised_counts.tsv": + type: file + description: normalised TSV format expression matrix with probes by row and samples by column + pattern: "*.normalised_counts.tsv" - versions: - versions.yml: type: file diff --git a/modules/nf-core/limma/differential/templates/limma_de.R b/modules/nf-core/limma/differential/templates/limma_de.R index 1d0195694df..1cea8aa9a7f 100755 --- a/modules/nf-core/limma/differential/templates/limma_de.R +++ b/modules/nf-core/limma/differential/templates/limma_de.R @@ -77,6 +77,8 @@ opt <- list( subset_to_contrast_samples = FALSE, exclude_samples_col = NULL, exclude_samples_values = NULL, + use_voom = FALSE, + number = Inf, ndups = NULL, # lmFit spacing = NULL, # lmFit block = NULL, # lmFit @@ -142,6 +144,7 @@ opt[vector_opt] = lapply(strsplit(unlist(opt[vector_opt]), ','), as.numeric) ################################################ library(limma) +library(edgeR) ################################################ ################################################ @@ -208,7 +211,7 @@ if (!contrast_variable %in% colnames(sample.sheet)) { '\" not in sample sheet' ) ) -} else if (any(!c(opt\$reflevel, opt\$treatlevel) %in% sample.sheet[[contrast_variable]])) { +} else if (any(!c(opt\$reference_level, opt\$target_level) %in% sample.sheet[[contrast_variable]])) { stop( paste( 'Please choose reference and target levels that are present in the', @@ -255,84 +258,185 @@ if ((! is.null(opt\$exclude_samples_col)) && (! is.null(opt\$exclude_samples_val sample.sheet <- sample.sheet[selected_samples, ] } -# Now specify the model. Use cell-means style so we can be explicit with the -# contrasts +################################################ +################################################ +## Build the Model Formula ## +################################################ +################################################ -model <- paste('~ 0 +', contrast_variable) +# Build the model formula with blocking variables first +model_vars <- c() if (!is.null(opt\$blocking_variables)) { - model <- paste(model, paste(blocking.vars, collapse = '+'), sep = '+') + # Include blocking variables (including pairing variables if any) + model_vars <- c(model_vars, blocking.vars) } -# Make sure all the appropriate variables are factors +# Add the contrast variable at the end +model_vars <- c(model_vars, contrast_variable) -for (v in c(blocking.vars, contrast_variable)) { +# Construct the model formula +model <- paste('~ 0 +', paste(model_vars, collapse = '+')) + +# Make sure all the appropriate variables are factors +vars_to_factor <- model_vars # All variables in the model need to be factors +for (v in vars_to_factor) { sample.sheet[[v]] <- as.factor(sample.sheet[[v]]) } ################################################ ################################################ -## Run Limma processes ## +## Run Limma processes ## ################################################ ################################################ -# Generate the design - +# Generate the design matrix design <- model.matrix( as.formula(model), data=sample.sheet ) + +# Adjust column names for the contrast variable colnames(design) <- sub( - contrast_variable, - paste0(contrast_variable, '.'), colnames(design) + paste0('^', contrast_variable), + paste0(contrast_variable, '.'), + colnames(design) ) +# Adjust column names to be syntactically valid +colnames(design) <- make.names(colnames(design)) + + +# Perform voom normalisation for RNA-seq data +if (!is.null(opt\$use_voom) && opt\$use_voom) { + # Create a DGEList object for RNA-seq data + dge <- DGEList(counts = intensities.table) + + # Normalize counts using TMM + dge <- calcNormFactors(dge, method = "TMM") + + # Run voom to transform the data + voom_result <- voom(dge, design) + data_for_fit <- voom_result + + # Write the normalized counts matrix to a TSV file + normalized_counts <- voom_result\$E + normalized_counts_with_genes <- data.frame(Gene = rownames(normalized_counts), normalized_counts, row.names = NULL) + colnames(normalized_counts_with_genes)[1] <- opt\$probe_id_col + write.table(normalized_counts_with_genes, + file = paste(opt\$output_prefix, "normalised_counts.tsv", sep = '.'), + sep = "\t", + quote = FALSE, + row.names = FALSE) + +} else { + # Use as.matrix for regular microarray analysis + data_for_fit <- as.matrix(intensities.table) +} + # Prepare for and run lmFit() -lmfit_args = c( - list( - object = as.matrix(intensities.table), - design = design - ), - opt[c('ndups', 'spacing', 'block', 'method')] +lmfit_args <- list( + object = data_for_fit, + design = design ) +# Include optional parameters if provided +if (! is.null(opt\$ndups)){ + lmfit_args[['ndups']] <- as.numeric(opt\$ndups) +} +if (! is.null(opt\$spacing)){ + lmfit_args[['spacing']] <- as.numeric(opt\$spacing) +} if (! is.null(opt\$block)){ - lmfit_args[['block']] = sample.sheet[[opt\$block]] + lmfit_args[['block']] <- sample.sheet[[opt\$block]] } if (! is.null(opt\$correlation)){ - lmfit_args[['correlation']] = opt\$correlation + lmfit_args[['correlation']] <- as.numeric(opt\$correlation) +} +if (! is.null(opt\$method)){ + lmfit_args[['method']] <- opt\$method } fit <- do.call(lmFit, lmfit_args) # Contrasts bit -contrast <- paste(paste(contrast_variable, c(opt\$target_level, opt\$reference_level), sep='.'), collapse='-') -contrast.matrix <- makeContrasts(contrasts=contrast, levels=design) + +# Create the contrast string for the specified comparison + +# Construct the expected column names for the target and reference levels in the design matrix +treatment_target <- paste0(contrast_variable, ".", opt\$target_level) +treatment_reference <- paste0(contrast_variable, ".", opt\$reference_level) + +# Determine how to construct the contrast string based on which levels are present in the design matrix +if ((treatment_target %in% colnames(design)) && (treatment_reference %in% colnames(design))) { + # Both target and reference levels are present in the design matrix + # We can directly compare the two levels + contrast_string <- paste0(treatment_target, "-", treatment_reference) +} else if (treatment_target %in% colnames(design)) { + # Only the target level is present in the design matrix + # The reference level may have been omitted due to collinearity or being set as the baseline + # We compare the target level to zero (implicit reference) + contrast_string <- paste0(treatment_target, "- 0") +} else if (treatment_reference %in% colnames(design)) { + # Only the reference level is present in the design matrix + # The target level may have been omitted from the design matrix + # We compare zero (implicit target) to the reference level + contrast_string <- paste0("0 - ", treatment_reference) +} else { + # Neither level is present in the design matrix + # This indicates an error; the specified levels are not found + stop(paste0(treatment_target, " and ", treatment_reference, " not found in design matrix")) +} + +# Create the contrast matrix +contrast.matrix <- makeContrasts(contrasts=contrast_string, levels=design) fit2 <- contrasts.fit(fit, contrast.matrix) -# Prepare for and run ebayes +# Prepare for and run eBayes -ebayes_args = c( - list( - fit = fit2 - ), - opt[c('proportion', 'stdev.coef.lim', 'trend', 'robust', 'winsor.tail.p')] +ebayes_args <- list( + fit = fit2 ) +if (! is.null(opt\$proportion)){ + ebayes_args[['proportion']] <- as.numeric(opt\$proportion) +} +if (! is.null(opt\$stdev.coef.lim)){ + ebayes_args[['stdev.coef.lim']] <- as.numeric(opt\$stdev.coef.lim) +} +if (! is.null(opt\$trend)){ + ebayes_args[['trend']] <- as.logical(opt\$trend) +} +if (! is.null(opt\$robust)){ + ebayes_args[['robust']] <- as.logical(opt\$robust) +} +if (! is.null(opt\$winsor.tail.p)){ + ebayes_args[['winsor.tail.p']] <- as.numeric(opt\$winsor.tail.p) +} + fit2 <- do.call(eBayes, ebayes_args) # Run topTable() to generate a results data frame - -toptable_args = c( - list( - fit = fit2, - sort.by = 'none', - number = nrow(intensities.table) - ), - opt[c('adjust.method', 'p.value', 'lfc', 'confint')] +toptable_args <- list( + fit = fit2, + sort.by = 'none', + number = nrow(intensities.table) ) +if (! is.null(opt\$adjust.method)){ + toptable_args[['adjust.method']] <- opt\$adjust.method +} +if (! is.null(opt\$p.value)){ + toptable_args[['p.value']] <- as.numeric(opt\$p.value) +} +if (! is.null(opt\$lfc)){ + toptable_args[['lfc']] <- as.numeric(opt\$lfc) +} +if (! is.null(opt\$confint)){ + toptable_args[['confint']] <- as.logical(opt\$confint) +} + comp.results <- do.call(topTable, toptable_args)[rownames(intensities.table),] ################################################ @@ -345,7 +449,7 @@ contrast.name <- paste(opt\$target_level, opt\$reference_level, sep = "_vs_") cat("Saving results for ", contrast.name, " ...\n", sep = "") -# Differential expression table- note very limited rounding for consistency of +# Differential expression table - note very limited rounding for consistency of # results out_df <- cbind( @@ -368,7 +472,7 @@ png( width = 600, height = 600 ) -plotMD(intensities.table) +plotMD(fit2) dev.off() # R object for other processes to use diff --git a/modules/nf-core/limma/differential/tests/main.nf.test b/modules/nf-core/limma/differential/tests/main.nf.test new file mode 100644 index 00000000000..00f33240ede --- /dev/null +++ b/modules/nf-core/limma/differential/tests/main.nf.test @@ -0,0 +1,282 @@ +nextflow_process { + + name "Test Process LIMMA_DIFFERENTIAL" + script "../main.nf" + process "LIMMA_DIFFERENTIAL" + + tag "modules" + tag "modules_nfcore" + tag "limma" + tag "limma/differential" + tag "affy" + tag "affy/justrma" + tag "untar" + + test("test_limma_differential") { + + config "./nextflow.config" + + setup { + run("UNTAR") { + script "../../../untar/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751_RAW.tar", checkIfExists: true) + ] + """ + } + } + run("AFFY_JUSTRMA") { + script "../../../affy/justrma/main.nf" + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = ch_samplesheet.join(UNTAR.out.untar) + input[1] = [[],[]] + """ + } + } + } + + when { + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[1] = ch_samplesheet + .join(AFFY_JUSTRMA.out.expression) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.session_info[0][1]).getText().contains("limma_3.58.1") }, + { assert path(process.out.results[0][1]).getText().contains("1007_s_at\t-0.2775254") }, + { assert path(process.out.results[0][1]).getText().contains("1053_at\t-0.071547786") } + ) + } + + } + + test("test_limma_differential - exclude_samples") { + + config "./nextflow.exclude_samples.config" + + setup { + run("UNTAR") { + script "../../../untar/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751_RAW.tar", checkIfExists: true) + ] + """ + } + } + run("AFFY_JUSTRMA") { + script "../../../affy/justrma/main.nf" + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = ch_samplesheet.join(UNTAR.out.untar) + input[1] = [[],[]] + """ + } + } + } + + when { + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[1] = ch_samplesheet + .join(AFFY_JUSTRMA.out.expression) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.session_info[0][1]).getText().contains("limma_3.58.1") }, + { assert path(process.out.results[0][1]).getText().contains("1007_s_at\t-0.4778282") }, + { assert path(process.out.results[0][1]).getText().contains("1053_at\t-0.08958278") } + ) + } + + } + + test("test_limma_differential - subset_to_contrast") { + + config "./nextflow.subset_to_contrast.config" + + + setup { + run("UNTAR") { + script "../../../untar/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751_RAW.tar", checkIfExists: true) + ] + """ + } + } + run("AFFY_JUSTRMA") { + script "../../../affy/justrma/main.nf" + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = ch_samplesheet.join(UNTAR.out.untar) + input[1] = [[],[]] + """ + } + } + } + + when { + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test' ], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[1] = ch_samplesheet + .join(AFFY_JUSTRMA.out.expression) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.session_info[0][1]).getText().contains("limma_3.58.1") }, + { assert path(process.out.results[0][1]).getText().contains("1007_s_at\t-0.2775254") }, + { assert path(process.out.results[0][1]).getText().contains("1053_at\t-0.071547786") } + ) + } + + } + + test("test_limma_differential - voom_blocking") { + + config "./nextflow.voom_blocking.config" + + when { + process { + """ + input[0] = Channel.of(['id': 'test', 'variable': 'treatment', 'reference': 'hND6', 'target': 'mCherry']) + .map{tuple(it, it.variable, it.reference, it.target)} + input[1] = Channel.of([[id:'test'], + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000023978\t-4.89014922224241") }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000059991\t0.779227180297504") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000023978\t6.11247620232167") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000059991\t4.52751370160052") } + ) + } + + } + + test("test_limma_differential - voom") { + + config "./nextflow.voom.config" + + when { + process { + """ + input[0] = Channel.of(['id': 'test', 'variable': 'treatment', 'reference': 'hND6', 'target': 'mCherry']) + .map{tuple(it, it.variable, it.reference, it.target)} + input[1] = Channel.of([[id:'test'], + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000023978\t-2.84055986312942") }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000059991\t0.705508451587681") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000023978\t6.11247620232167") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000059991\t4.52751370160052") } + ) + } + + } + + test("test_limma_differential - stub") { + + options "-stub" + + when { + process { """ + input[0] = Channel.of(['id': 'test', 'variable': 'treatment', 'reference': 'hND6', 'target': 'mCherry']) + .map{tuple(it, it.variable, it.reference, it.target)} + input[1] = Channel.of([[id:'test'], + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot([process.out.results, process.out.model, process.out.normalised_counts, process.out.versions]).match() } + ) + } + } +} diff --git a/modules/nf-core/limma/differential/tests/main.nf.test.snap b/modules/nf-core/limma/differential/tests/main.nf.test.snap new file mode 100644 index 00000000000..daa1489920b --- /dev/null +++ b/modules/nf-core/limma/differential/tests/main.nf.test.snap @@ -0,0 +1,164 @@ +{ + "test_limma_differential - voom_blocking": { + "content": [ + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.model.txt:md5,3b96713b4e3f027b0347859f02a9038d" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:25:38.991424" + }, + "test_limma_differential - voom": { + "content": [ + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.model.txt:md5,d2113d82b76046c319e6602da2ad74d6" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:26:07.303675" + }, + "test_limma_differential - subset_to_contrast": { + "content": [ + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia.limma.model.txt:md5,70b000f632b8bdba4917046362dd876b" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:25:09.535356" + }, + "test_limma_differential - exclude_samples": { + "content": [ + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia.limma.model.txt:md5,70b000f632b8bdba4917046362dd876b" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:24:15.276012" + }, + "test_limma_differential - stub": { + "content": [ + [ + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.results.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.model.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.normalised_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:26:17.624889" + }, + "test_limma_differential": { + "content": [ + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia.limma.model.txt:md5,70b000f632b8bdba4917046362dd876b" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-23T18:23:19.185283" + } +} \ No newline at end of file diff --git a/modules/nf-core/limma/differential/tests/nextflow.config b/modules/nf-core/limma/differential/tests/nextflow.config new file mode 100644 index 00000000000..98c5e882164 --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.config @@ -0,0 +1,19 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col name", + "--blocking_variables $meta.blocking" + ].join(' ').trim() } + } + + withName: 'AFFY_JUSTRMA' { + ext.args = "--sample_name_col name" + publishDir = [ enabled: false ] + } + withName: 'UNTAR' { + publishDir = [ enabled: false ] + } +} diff --git a/modules/nf-core/limma/differential/tests/nextflow.exclude_samples.config b/modules/nf-core/limma/differential/tests/nextflow.exclude_samples.config new file mode 100644 index 00000000000..1f4c0214158 --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.exclude_samples.config @@ -0,0 +1,22 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col name", + "--exclude_samples_col name", + "--exclude_samples_values Dima_1;Dima_9" + ].join(' ').trim() } + } + + withName: 'AFFY_JUSTRMA' { + ext.args = "--sample_name_col name" + publishDir = [ enabled: false ] + } + + withName: 'UNTAR' { + publishDir = [ enabled: false ] + } + +} diff --git a/modules/nf-core/limma/differential/tests/nextflow.subset_to_contrast.config b/modules/nf-core/limma/differential/tests/nextflow.subset_to_contrast.config new file mode 100644 index 00000000000..09d6776b203 --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.subset_to_contrast.config @@ -0,0 +1,20 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col name", + "--subset_to_contrast_samples TRUE" + ].join(' ').trim() } + } + + withName: 'AFFY_JUSTRMA' { + ext.args = "--sample_name_col name" + publishDir = [ enabled: false ] + } + + withName: 'UNTAR' { + publishDir = [ enabled: false ] + } +} diff --git a/modules/nf-core/limma/differential/tests/nextflow.voom.config b/modules/nf-core/limma/differential/tests/nextflow.voom.config new file mode 100644 index 00000000000..a1e505570e1 --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.voom.config @@ -0,0 +1,13 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col sample", + "--probe_id_col gene_id", + "--use_voom TRUE" + ].join(' ').trim() } + } + +} diff --git a/modules/nf-core/limma/differential/tests/nextflow.voom_blocking.config b/modules/nf-core/limma/differential/tests/nextflow.voom_blocking.config new file mode 100644 index 00000000000..d4e24f8538f --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.voom_blocking.config @@ -0,0 +1,14 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col sample", + "--probe_id_col gene_id", + "--use_voom TRUE", + "--blocking_variables sample_number" + ].join(' ').trim() } + } + +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index babb50ac4c9..c1242df8247 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -386,9 +386,6 @@ krona/ktimporttext: leehom: - modules/nf-core/leehom/** - tests/modules/nf-core/leehom/** -limma/differential: - - modules/nf-core/limma/differential/** - - tests/modules/nf-core/limma/differential/** maxquant/lfq: - modules/nf-core/maxquant/lfq/** - tests/modules/nf-core/maxquant/lfq/** diff --git a/tests/modules/nf-core/limma/differential/main.nf b/tests/modules/nf-core/limma/differential/main.nf deleted file mode 100644 index c1e097b0e55..00000000000 --- a/tests/modules/nf-core/limma/differential/main.nf +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNTAR } from '../../../../../modules/nf-core/untar/main.nf' -include { AFFY_JUSTRMA } from '../../../../../modules/nf-core/affy/justrma/main.nf' -include { LIMMA_DIFFERENTIAL } from '../../../../../modules/nf-core/limma/differential/main.nf' - -workflow test_limma_differential { - - // Make a microarray intensities matrix using affy/justrma - - samples = file(params.test_data['homo_sapiens']['genome']['affy_array_samplesheet'], checkIfExists: true) - cel_archive = file(params.test_data['homo_sapiens']['genome']['affy_array_celfiles_tar'], checkIfExists: true) - - def meta = [ id:'test' ] - ch_samplesheet = Channel.of([ meta, samples ]) - ch_celfiles_archive = Channel.of([ meta, cel_archive ]) - - UNTAR ( ch_celfiles_archive ) - - ch_input = ch_samplesheet.join(UNTAR.out.untar) - - AFFY_JUSTRMA ( - ch_input, - [[],[]] - ) - - // Now do the actual differential analysis - - ch_intensities = ch_samplesheet - .join(AFFY_JUSTRMA.out.expression) - - ch_contrasts = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) - .map{ - tuple(it, it.variable, it.reference, it.target) - } - - LIMMA_DIFFERENTIAL ( - ch_contrasts, - ch_intensities - ) -} - -workflow test_limma_differential_subset_to_contrast { - - // Make a microarray intensities matrix using affy/justrma - - samples = file(params.test_data['homo_sapiens']['genome']['affy_array_samplesheet'], checkIfExists: true) - cel_archive = file(params.test_data['homo_sapiens']['genome']['affy_array_celfiles_tar'], checkIfExists: true) - - def meta = [ id:'test' ] - ch_samplesheet = Channel.of([ meta, samples ]) - ch_celfiles_archive = Channel.of([ meta, cel_archive ]) - - UNTAR ( ch_celfiles_archive ) - - ch_input = ch_samplesheet.join(UNTAR.out.untar) - - AFFY_JUSTRMA ( - ch_input, - [[],[]] - ) - - // Now do the actual differential analysis - - ch_intensities = ch_samplesheet - .join(AFFY_JUSTRMA.out.expression) - - ch_contrasts = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) - .map{ - tuple(it, it.variable, it.reference, it.target) - } - - LIMMA_DIFFERENTIAL ( - ch_contrasts, - ch_intensities - ) -} - - -workflow test_limma_differential_exclude_samples { - - // Make a microarray intensities matrix using affy/justrma - - samples = file(params.test_data['homo_sapiens']['genome']['affy_array_samplesheet'], checkIfExists: true) - cel_archive = file(params.test_data['homo_sapiens']['genome']['affy_array_celfiles_tar'], checkIfExists: true) - - def meta = [ id:'test' ] - ch_samplesheet = Channel.of([ meta, samples ]) - ch_celfiles_archive = Channel.of([ meta, cel_archive ]) - - UNTAR ( ch_celfiles_archive ) - - ch_input = ch_samplesheet.join(UNTAR.out.untar) - - AFFY_JUSTRMA ( - ch_input, - [[],[]] - ) - - // Now do the actual differential analysis - - ch_intensities = ch_samplesheet - .join(AFFY_JUSTRMA.out.expression) - - ch_contrasts = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) - .map{ - tuple(it, it.variable, it.reference, it.target) - } - - LIMMA_DIFFERENTIAL ( - ch_contrasts, - ch_intensities - ) -} diff --git a/tests/modules/nf-core/limma/differential/nextflow.config b/tests/modules/nf-core/limma/differential/nextflow.config deleted file mode 100644 index 78c1827cee9..00000000000 --- a/tests/modules/nf-core/limma/differential/nextflow.config +++ /dev/null @@ -1,24 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: 'test_limma_differential:LIMMA_DIFFERENTIAL' { - ext.args = { [ - "--sample_id_col name", - "--blocking_variables $meta.blocking" - ].join(' ').trim() } - } - withName: 'test_limma_.*:AFFY_JUSTRMA' { - ext.args = '--sample_name_col name' - publishDir = [ enabled: false ] - } - withName: 'test_limma_.*:UNTAR' { - publishDir = [ enabled: false ] - } - withName: 'test_limma_differential_subset_to_contrast:LIMMA_DIFFERENTIAL' { - ext.args = { "--sample_id_col name --subset_to_contrast_samples TRUE" } - } - withName: 'test_limma_differential_exclude_samples:LIMMA_DIFFERENTIAL' { - ext.args = { "--sample_id_col name --exclude_samples_col name --exclude_samples_values Dima_1;Dima_9" } - } -} diff --git a/tests/modules/nf-core/limma/differential/test.yml b/tests/modules/nf-core/limma/differential/test.yml deleted file mode 100644 index 4f352e44e48..00000000000 --- a/tests/modules/nf-core/limma/differential/test.yml +++ /dev/null @@ -1,47 +0,0 @@ -- name: limma differential test_limma_differential - command: nextflow run ./tests/modules/nf-core/limma/differential -entry test_limma_differential -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/limma/differential/nextflow.config - tags: - - limma - - limma/differential - files: - - path: output/limma/diagnosis_normal_uremia.MArrayLM.limma.rds - - path: output/limma/diagnosis_normal_uremia.R_sessionInfo.log - contains: ["limma_3.54.0"] - - path: output/limma/diagnosis_normal_uremia.limma.mean_difference.png - - path: output/limma/diagnosis_normal_uremia.limma.results.tsv - contains: ["1007_s_at\t-0.2775254", "1053_at\t-0.071547786"] - - path: output/limma/diagnosis_normal_uremia.limma.model.txt - md5sum: 70b000f632b8bdba4917046362dd876b - - path: output/limma/versions.yml - -- name: limma differential test_limma_differential_subset_to_contrast - command: nextflow run ./tests/modules/nf-core/limma/differential -entry test_limma_differential_subset_to_contrast -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/limma/differential/nextflow.config - tags: - - limma - - limma/differential - files: - - path: output/limma/diagnosis_normal_uremia.MArrayLM.limma.rds - - path: output/limma/diagnosis_normal_uremia.R_sessionInfo.log - contains: ["limma_3.54.0"] - - path: output/limma/diagnosis_normal_uremia.limma.mean_difference.png - - path: output/limma/diagnosis_normal_uremia.limma.results.tsv - contains: ["1007_s_at\t-0.2775254", "1053_at\t-0.071547786"] - - path: output/limma/diagnosis_normal_uremia.limma.model.txt - md5sum: 70b000f632b8bdba4917046362dd876b - - path: output/limma/versions.yml - -- name: limma differential test_limma_differential_exclude_samples - command: nextflow run ./tests/modules/nf-core/limma/differential -entry test_limma_differential_exclude_samples -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/limma/differential/nextflow.config - tags: - - limma - - limma/differential - files: - - path: output/limma/diagnosis_normal_uremia.MArrayLM.limma.rds - - path: output/limma/diagnosis_normal_uremia.R_sessionInfo.log - contains: ["limma_3.54.0"] - - path: output/limma/diagnosis_normal_uremia.limma.mean_difference.png - - path: output/limma/diagnosis_normal_uremia.limma.results.tsv - contains: ["1007_s_at\t-0.4778282", "1053_at\t-0.08958278"] - - path: output/limma/diagnosis_normal_uremia.limma.model.txt - md5sum: 70b000f632b8bdba4917046362dd876b - - path: output/limma/versions.yml From 277e706ae1d902e85cea4e0cdff5c5a883d8e23c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 04:47:43 +0200 Subject: [PATCH 06/87] Update GitHub Actions (#6843) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/fix-linting.yml | 2 +- .github/workflows/test.yml | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index a9cad1fd5a9..bc559eb532a 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -32,7 +32,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 - name: Install Prettier run: npm install -g prettier @prettier/plugin-php diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbead51a9c6..e5ffd422c09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 # FIXME Flip this off once we get to less than a couple hundred. Adding # this so it will only run against changed files. It'll make it much @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Install NodeJS - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: node-version: "20" @@ -60,7 +60,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4 + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 with: node-version: "20" @@ -151,7 +151,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.11" @@ -166,7 +166,7 @@ jobs: - name: Install pip run: python -m pip install --upgrade pip - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: "temurin" java-version: "17" @@ -197,14 +197,14 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.11" - name: Install pip run: python -m pip install --upgrade pip - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: "temurin" java-version: "17" @@ -401,7 +401,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.11" @@ -416,7 +416,7 @@ jobs: - name: Install Python dependencies run: python -m pip install --upgrade pip pytest-workflow cryptography - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: "temurin" java-version: "17" @@ -657,7 +657,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: "temurin" java-version: "17" @@ -680,7 +680,7 @@ jobs: mkdir -p $NXF_SINGULARITY_LIBRARYDIR - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5 + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 with: python-version: "3.11" From dfd89399e3c6e2422c4cdcf0aaa8cf2393dc51c9 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Fri, 25 Oct 2024 19:35:13 +0530 Subject: [PATCH 07/87] Fix/bismark bwameth align (#6848) * rm undefined input in stub * update the symlink creation with -f * use single config for tests --- modules/nf-core/bismark/align/main.nf | 4 +-- .../nf-core/bismark/align/tests/main.nf.test | 25 +++++++++++++++---- ...extflow_bowtie2.config => nextflow.config} | 6 ++--- .../align/tests/nextflow_hisat2.config | 8 ------ .../align/tests/nextflow_minimap2.config | 8 ------ modules/nf-core/bismark/summary/main.nf | 2 +- modules/nf-core/bwameth/align/main.nf | 4 +-- 7 files changed, 26 insertions(+), 31 deletions(-) rename modules/nf-core/bismark/align/tests/{nextflow_bowtie2.config => nextflow.config} (54%) delete mode 100644 modules/nf-core/bismark/align/tests/nextflow_hisat2.config delete mode 100644 modules/nf-core/bismark/align/tests/nextflow_minimap2.config diff --git a/modules/nf-core/bismark/align/main.nf b/modules/nf-core/bismark/align/main.nf index d8ce3d017a0..1de78f3296d 100644 --- a/modules/nf-core/bismark/align/main.nf +++ b/modules/nf-core/bismark/align/main.nf @@ -56,9 +56,7 @@ process BISMARK_ALIGN { } } """ - if [ ! -f $index/$fasta ]; then - ln -s \$(readlink $fasta) $index/$fasta; - fi + ln -sf \$(readlink $fasta) $index/$fasta bismark \\ $fastq \\ diff --git a/modules/nf-core/bismark/align/tests/main.nf.test b/modules/nf-core/bismark/align/tests/main.nf.test index fcd693c8bb4..059057d30d2 100644 --- a/modules/nf-core/bismark/align/tests/main.nf.test +++ b/modules/nf-core/bismark/align/tests/main.nf.test @@ -25,9 +25,12 @@ nextflow_process { } test("bowtie2 single-end / sarscov2 genome [fasta]") { - config './nextflow_bowtie2.config' + config './nextflow.config' when { + params { + bismark_args = '--bowtie2' + } process { """ input[0] = Channel.of([ @@ -55,9 +58,12 @@ nextflow_process { } test("bowtie2 paired-end / sarscov2 genome [fasta]") { - config './nextflow_bowtie2.config' + config './nextflow.config' when { + params { + bismark_args = '--bowtie2' + } process { """ input[0] = Channel.of([ @@ -88,9 +94,12 @@ nextflow_process { } test("hisat2 single-end / sarscov2 genome [fasta]") { - config './nextflow_hisat2.config' + config './nextflow.config' when { + params { + bismark_args = '--hisat2' + } process { """ input[0] = Channel.of([ @@ -118,9 +127,12 @@ nextflow_process { } test("hisat2 paired-end / sarscov2 genome [fasta]") { - config './nextflow_hisat2.config' + config './nextflow.config' when { + params { + bismark_args = '--hisat2' + } process { """ input[0] = Channel.of([ @@ -151,9 +163,12 @@ nextflow_process { } test("minimap2 single-end / sarscov2 genome [fasta]") { - config './nextflow_minimap2.config' + config './nextflow.config' when { + params { + bismark_args = '--minimap2' + } process { """ input[0] = Channel.of([ diff --git a/modules/nf-core/bismark/align/tests/nextflow_bowtie2.config b/modules/nf-core/bismark/align/tests/nextflow.config similarity index 54% rename from modules/nf-core/bismark/align/tests/nextflow_bowtie2.config rename to modules/nf-core/bismark/align/tests/nextflow.config index cf0357e2fc8..3313dfa884c 100644 --- a/modules/nf-core/bismark/align/tests/nextflow_bowtie2.config +++ b/modules/nf-core/bismark/align/tests/nextflow.config @@ -1,8 +1,8 @@ process { withName: BISMARK_ALIGN { - ext.args = '--bowtie2' + ext.args = params.bismark_args } withName: BISMARK_GENOMEPREPARATION { - ext.args = '--bowtie2' + ext.args = params.bismark_args } -} \ No newline at end of file +} diff --git a/modules/nf-core/bismark/align/tests/nextflow_hisat2.config b/modules/nf-core/bismark/align/tests/nextflow_hisat2.config deleted file mode 100644 index 5b962ae0cc8..00000000000 --- a/modules/nf-core/bismark/align/tests/nextflow_hisat2.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - withName: BISMARK_ALIGN { - ext.args = '--hisat2' - } - withName: BISMARK_GENOMEPREPARATION { - ext.args = '--hisat2' - } -} \ No newline at end of file diff --git a/modules/nf-core/bismark/align/tests/nextflow_minimap2.config b/modules/nf-core/bismark/align/tests/nextflow_minimap2.config deleted file mode 100644 index dd46fe269e3..00000000000 --- a/modules/nf-core/bismark/align/tests/nextflow_minimap2.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - withName: BISMARK_ALIGN { - ext.args = '--minimap2' - } - withName: BISMARK_GENOMEPREPARATION { - ext.args = '--minimap2' - } -} \ No newline at end of file diff --git a/modules/nf-core/bismark/summary/main.nf b/modules/nf-core/bismark/summary/main.nf index 2aadfc03c94..94533c401b0 100644 --- a/modules/nf-core/bismark/summary/main.nf +++ b/modules/nf-core/bismark/summary/main.nf @@ -33,7 +33,7 @@ process BISMARK_SUMMARY { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + def prefix = task.ext.prefix ?: "${bam.baseName()}" """ touch ${prefix}.report.txt touch ${prefix}.report.html diff --git a/modules/nf-core/bwameth/align/main.nf b/modules/nf-core/bwameth/align/main.nf index 2e6ff2d0969..99f5f63a492 100644 --- a/modules/nf-core/bwameth/align/main.nf +++ b/modules/nf-core/bwameth/align/main.nf @@ -29,9 +29,7 @@ process BWAMETH_ALIGN { # See https://github.com/nf-core/methylseq/pull/217 touch -c $index/* - if [ ! -f $index/$fasta ]; then - ln -s \$(readlink $fasta) $index/$fasta; - fi + ln -sf \$(readlink $fasta) $index/$fasta bwameth.py \\ $args \\ From 7face45982adfd0259c55b56e040593646bdd5aa Mon Sep 17 00:00:00 2001 From: Benedetto Polimeni <34317613+bepoli@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:07:31 +0200 Subject: [PATCH 08/87] Add irescue module (#6691) * Add irescue module * Fix meta.yml not matching main.nf * Fix linting * Better tools description * Apply suggestions from code review Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Remove trailing whitespaces --------- Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/irescue/environment.yml | 7 ++ modules/nf-core/irescue/main.nf | 64 +++++++++++++ modules/nf-core/irescue/meta.yml | 95 +++++++++++++++++++ modules/nf-core/irescue/tests/main.nf.test | 71 ++++++++++++++ .../nf-core/irescue/tests/main.nf.test.snap | 50 ++++++++++ 5 files changed, 287 insertions(+) create mode 100644 modules/nf-core/irescue/environment.yml create mode 100644 modules/nf-core/irescue/main.nf create mode 100644 modules/nf-core/irescue/meta.yml create mode 100644 modules/nf-core/irescue/tests/main.nf.test create mode 100644 modules/nf-core/irescue/tests/main.nf.test.snap diff --git a/modules/nf-core/irescue/environment.yml b/modules/nf-core/irescue/environment.yml new file mode 100644 index 00000000000..30766a63c50 --- /dev/null +++ b/modules/nf-core/irescue/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::irescue=1.1.2" diff --git a/modules/nf-core/irescue/main.nf b/modules/nf-core/irescue/main.nf new file mode 100644 index 00000000000..d5b158f8663 --- /dev/null +++ b/modules/nf-core/irescue/main.nf @@ -0,0 +1,64 @@ +process IRESCUE { + 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/irescue:1.1.2--pyhdfd78af_0': + 'biocontainers/irescue:1.1.2--pyhdfd78af_0' }" + + input: + tuple val(meta), path(bam) + val genome + path bed + + output: + tuple val(meta), path("${prefix}") , emit: results + tuple val(meta), path("${prefix}/counts") , emit: counts + tuple val(meta), path("${prefix}/irescue.log"), emit: log + tuple val(meta), path("${prefix}/tmp") , emit: tmp, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def reference = bed ? "--regions $bed" : '' + def genome_assembly = reference ? '' : "--genome $genome" + """ + mkdir -p $prefix + + irescue \\ + --bam $bam \\ + $reference \\ + $genome_assembly \\ + --outdir $prefix \\ + --threads $task.cpus \\ + $args 2> >(tee -a ${prefix}/irescue.log >&2) + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + irescue: \$(irescue --version |& sed '1!d ; s/IRescue //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p ${prefix}/counts + touch \\ + ${prefix}/counts/matrix.mtx \\ + ${prefix}/counts/barcodes.tsv \\ + ${prefix}/counts/features.tsv \\ + ${prefix}/irescue.log + gzip ${prefix}/counts/* + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + irescue: \$(irescue --version |& sed '1!d ; s/IRescue //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/irescue/meta.yml b/modules/nf-core/irescue/meta.yml new file mode 100644 index 00000000000..81e98b011cb --- /dev/null +++ b/modules/nf-core/irescue/meta.yml @@ -0,0 +1,95 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "irescue" +description: Quantification of transposable elements expression in scRNA-seq +keywords: + - scRNA-seq + - transposons + - repeats +tools: + - "irescue": + description: "IRescue is a tool for uncertainty-aware quantification of transposable elements expression in scRNA-seq" + homepage: "https://pypi.org/project/IRescue" + documentation: "https://pypi.org/project/IRescue" + tool_dev_url: "https://github.com/bodegalab/irescue" + doi: "10.1093/nar/gkae793" + licence: ["MIT"] + identifier: biotools:irescue + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM file + pattern: "*.bam" + ontologies: + - edam: "http://edamontology.org/format_2572" + - - genome: + type: string + description: | + Genome assembly symbol. Not used when bed file is provided. + In this case, it can be any value or an empty string. + - - bed: + type: file + description: Bed file of repeats genomic coordinates (optional). + pattern: "*.bed" + ontologies: + - edam: "http://edamontology.org/format_3003" + +output: + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + - results: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}: + type: directory + description: Folder containing count matrices and logs + pattern: "${prefix}" + - counts: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/counts: + type: directory + description: Folder containing count matrices + pattern: "${prefix}/counts" + - log: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/irescue.log: + type: file + description: Text file contianing run informations + pattern: "${prefix}/irescue.log" + - tmp: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ${prefix}/tmp: + type: directory + description: | + Folder containing temporary files, + if kept using the "--keeptmp" argument (optional). + pattern: "${prefix}/tmp" + +authors: + - "@bepoli" +maintainers: + - "@bepoli" diff --git a/modules/nf-core/irescue/tests/main.nf.test b/modules/nf-core/irescue/tests/main.nf.test new file mode 100644 index 00000000000..f69965eb4e0 --- /dev/null +++ b/modules/nf-core/irescue/tests/main.nf.test @@ -0,0 +1,71 @@ +nextflow_process { + + name "Test Process IRESCUE" + script "../main.nf" + process "IRESCUE" + + tag "modules" + tag "modules_nfcore" + tag "irescue" + + test("homo_sapiens 10xgenomics - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) + ] + input[1] = 'test' + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.counts, + process.out.versions + ).match() + }, + { assert file(process.out.log.get(0).get(1)).exists() } + ) + } + + } + + test("homo_sapiens 10xgenomics - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/10x_cr12.bam', checkIfExists: true) + ] + input[1] = 'test' + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.counts, + process.out.versions + ).match() + }, + { assert file(process.out.log.get(0).get(1)).exists() } + ) + } + + } + +} diff --git a/modules/nf-core/irescue/tests/main.nf.test.snap b/modules/nf-core/irescue/tests/main.nf.test.snap new file mode 100644 index 00000000000..83065e545ce --- /dev/null +++ b/modules/nf-core/irescue/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "homo_sapiens 10xgenomics - bam": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "barcodes.tsv.gz:md5,5c151d3b6f48e4919687c47684c62395", + "features.tsv.gz:md5,473997691921db70febf048bcdd20848", + "matrix.mtx.gz:md5,8a3e6634400dd455f3199a6de258d526" + ] + ] + ], + [ + "versions.yml:md5,5097199e8c09d02a961b2277b2a91c9f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-25T09:34:16.073380434" + }, + "homo_sapiens 10xgenomics - bam - stub": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "barcodes.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e", + "features.tsv.gz:md5,d41d8cd98f00b204e9800998ecf8427e", + "matrix.mtx.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + [ + "versions.yml:md5,5097199e8c09d02a961b2277b2a91c9f" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-25T09:34:27.46106643" + } +} \ No newline at end of file From 55e411128ca5036def5dae1aa28a09e3776f59ea Mon Sep 17 00:00:00 2001 From: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:51:11 +0200 Subject: [PATCH 09/87] Update stitch (#6832) * Update stitch * Add bam test and sort snapshot * Set R version for repetability * Add htslib to environment for conda * Fix environment * Add rsync to environment * Fix linting * Update path --- modules/nf-core/stitch/environment.yml | 3 + modules/nf-core/stitch/main.nf | 4 +- modules/nf-core/stitch/meta.yml | 36 ++-- modules/nf-core/stitch/tests/main.nf.test | 178 ++++++++++++++++++ .../nf-core/stitch/tests/main.nf.test.snap | 170 +++++++++++++++++ .../stitch/tests/stitch_generate_input.config | 6 + .../stitch/tests/stitch_impute_only.config | 5 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/stitch/main.nf | 135 ------------- tests/modules/nf-core/stitch/nextflow.config | 12 -- tests/modules/nf-core/stitch/test.yml | 109 ----------- 11 files changed, 382 insertions(+), 279 deletions(-) create mode 100644 modules/nf-core/stitch/tests/main.nf.test create mode 100644 modules/nf-core/stitch/tests/main.nf.test.snap create mode 100644 modules/nf-core/stitch/tests/stitch_generate_input.config create mode 100644 modules/nf-core/stitch/tests/stitch_impute_only.config delete mode 100644 tests/modules/nf-core/stitch/main.nf delete mode 100644 tests/modules/nf-core/stitch/nextflow.config delete mode 100644 tests/modules/nf-core/stitch/test.yml diff --git a/modules/nf-core/stitch/environment.yml b/modules/nf-core/stitch/environment.yml index 039968d65c9..4978bec281f 100644 --- a/modules/nf-core/stitch/environment.yml +++ b/modules/nf-core/stitch/environment.yml @@ -2,4 +2,7 @@ channels: - conda-forge - bioconda dependencies: + - conda-forge::r-base=4.3.1 + - conda-forge::rsync=3.2.7 - bioconda::r-stitch=1.6.10 + - bioconda::htslib=1.18 diff --git a/modules/nf-core/stitch/main.nf b/modules/nf-core/stitch/main.nf index 2f76987f9ab..0f8d8109dd2 100644 --- a/modules/nf-core/stitch/main.nf +++ b/modules/nf-core/stitch/main.nf @@ -8,8 +8,8 @@ process STITCH { 'biocontainers/r-stitch:1.6.10--r43h06b5641_0' }" input: - tuple val(meta) , path(posfile), path(input, stageAs: "input"), path(rdata, stageAs: "RData_in"), val(chromosome_name), val(K), val(nGen) - tuple val(meta2), path(collected_crams), path(collected_crais), path(cramlist) + tuple val(meta), path(collected_crams), path(collected_crais), path(cramlist) + tuple val(meta2), path(posfile), path(input, stageAs: "input"), path(rdata, stageAs: "RData_in"), val(chromosome_name), val(K), val(nGen) tuple val(meta3), path(fasta), path(fasta_fai) val seed diff --git a/modules/nf-core/stitch/meta.yml b/modules/nf-core/stitch/meta.yml index 48a21c4996f..0035d34696e 100644 --- a/modules/nf-core/stitch/meta.yml +++ b/modules/nf-core/stitch/meta.yml @@ -23,6 +23,24 @@ tools: identifier: biotools:stitch-snijderlab input: - - meta: + type: map + description: | + Groovy Map containing information about the set of samples + e.g. `[ id:'test' ]` + - collected_crams: + type: file + description: List of sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + - collected_crais: + type: file + description: List of BAM/CRAM/SAM index files + pattern: "*.{bai,crai,sai}" + - cramlist: + type: file + description: | + Text file with the path to the cram files to use in imputation, one per line. Since the cram files are staged to the working directory for the process, this file should just contain the file names without any pre-pending path. + pattern: "*.txt" + - - meta2: type: map description: | Groovy Map containing information about the set of positions to run the imputation over @@ -55,24 +73,6 @@ input: description: Number of generations since founding of the population to use for imputation. Refer to the documentation for the `--nGen` argument of STITCH for more information. - - - meta2: - type: map - description: | - Groovy Map containing information about the set of samples - e.g. `[ id:'test' ]` - - collected_crams: - type: file - description: List of sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - - collected_crais: - type: file - description: List of BAM/CRAM/SAM index files - pattern: "*.{bai,crai,sai}" - - cramlist: - type: file - description: | - Text file with the path to the cram files to use in imputation, one per line. Since the cram files are staged to the working directory for the process, this file should just contain the file names without any pre-pending path. - pattern: "*.txt" - - meta3: type: map description: | diff --git a/modules/nf-core/stitch/tests/main.nf.test b/modules/nf-core/stitch/tests/main.nf.test new file mode 100644 index 00000000000..9a7d1803302 --- /dev/null +++ b/modules/nf-core/stitch/tests/main.nf.test @@ -0,0 +1,178 @@ +def pathbam = "file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/" +def pathgenome = "file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/" +// positions and essential parameters +def posfile = "${pathgenome}dbsnp_138.hg38.first_10_biallelic_sites.tsv', checkIfExists: true)" +def stitch_params = "[ [ id: 'test_positions' ], $posfile, [], [], 'chr21', 2, 1 ]" + +// sequencing data in cram format +def crams_val = "[${pathbam}cram/test.paired_end.recalibrated.sorted.cram', checkIfExists: true), ${pathbam}cram/test2.paired_end.recalibrated.sorted.cram', checkIfExists: true)]" +def crais_val = "[${pathbam}cram/test.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true), ${pathbam}cram/test2.paired_end.recalibrated.sorted.cram.crai', checkIfExists: true)]" +def reads_cram = "[ [ id: 'test_reads' ], $crams_val, $crais_val ]" + +// sequencing data in bam format +def bams_val = "[${pathbam}bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), ${pathbam}bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true)]" +def bais_val = "[${pathbam}bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), ${pathbam}bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true)]" +def reads_bam = "[ [ id:'test_reads' ], $bams_val, $bais_val ]" + +// reference genome +def reference = "[[ id:'test_reference' ], ${pathgenome}genome.fasta', checkIfExists: true), ${pathgenome}genome.fasta.fai', checkIfExists: true)]" + +// for reproducibility +def seed = 1 + +nextflow_process { + name "Test Process STITCH" + script "../main.nf" + process "STITCH" + + tag "modules" + tag "modules_nfcore" + tag "stitch" + + test("test_no_seed") { + when { + process { + """ + filelist = Channel.fromPath( $crams_val ) + .map { it[-1] as String } // get only filename + .collectFile( name: "cramlist.txt", newLine: true, sort: true ) + + input[0] = Channel.of( $reads_cram ).combine( filelist ) + input[1] = $stitch_params + input[2] = $reference + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.input.collect{ file(it[1]).listFiles().sort().name }, + process.out.rdata.collect{ file(it[1]).listFiles().sort().name }, + process.out.plots.collect{ file(it[1]).listFiles().sort().name }, + process.out.vcf.collect{ file(it[1]).name }, + process.out.versions + ).match() } + ) + } + } + + test("test_with_seed") { + when { + process { + """ + filelist = Channel.fromPath( $crams_val ) + .map { it[-1] as String } // get only filename + .collectFile( name: "cramlist.txt", newLine: true, sort: true ) + input[0] = Channel.of( $reads_cram ).combine( filelist ) + input[1] = $stitch_params + input[2] = $reference + input[3] = $seed + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.input.collect{ file(it[1]).listFiles().sort().name }, + process.out.rdata.collect{ file(it[1]).listFiles().sort().name }, + process.out.plots.collect{ file(it[1]).listFiles().sort().name }, + process.out.vcf.collect{ file(it[1]).name }, + process.out.versions + ).match() } + ) + } + } + + test("test_two_stage_imputation") { + setup { + run ("STITCH", alias: "STITCH_GENERATE_INPUTS") { + script "../main.nf" + config "./stitch_generate_input.config" + process { + """ + filelist = Channel.fromPath( $crams_val ) + .map { it[-1] as String } // get only filename + .collectFile( name: "cramlist.txt", newLine: true, sort: true ) + input[0] = Channel.of( $reads_cram ).combine( filelist ) + input[1] = $stitch_params + input[2] = $reference + input[3] = $seed + """ + } + } + } + + when { + config "./stitch_impute_only.config" + process { + """ + ch_input_2step = Channel.of( $stitch_params ) + .map { + meta, positions, target, rdata, chromosome_name, K, nGen -> + [ meta, positions ] + } + .combine( + STITCH_GENERATE_INPUTS.out.input + .join ( STITCH_GENERATE_INPUTS.out.rdata ) + ) + .map { + meta, positions, metaT, target, rdata -> + [ metaT, positions, target, rdata, "chr21", 2, 1 ] + } + input[0] = [[id: null], [], [], []] + input[1] = ch_input_2step + input[2] = [[id: null], [], []] + input[3] = $seed + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.input.collect{ file(it[1]).listFiles().sort().name }, + process.out.rdata.collect{ file(it[1]).listFiles().sort().name }, + process.out.plots.collect{ file(it[1]).listFiles().sort().name }, + process.out.vcf.collect{ file(it[1]).name }, + process.out.versions + ).match() } + ) + } + } + + test("test_with_bam") { + when { + process { + """ + filelist = Channel.fromPath( $bams_val ) + .map { it[-1] as String } // get only filename + .collectFile( name: "cramlist.txt", newLine: true, sort: true ) + input[0] = Channel.of( $reads_bam ).combine( filelist ) + input[1] = $stitch_params + input[2] = $reference + input[3] = $seed + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.input.collect{ file(it[1]).listFiles().sort().name }, + process.out.rdata.collect{ file(it[1]).listFiles().sort().name }, + process.out.plots.collect{ file(it[1]).listFiles().sort().name }, + process.out.vcf.collect{ file(it[1]).name }, + process.out.versions + ).match() } + ) + } + } + +} diff --git a/modules/nf-core/stitch/tests/main.nf.test.snap b/modules/nf-core/stitch/tests/main.nf.test.snap new file mode 100644 index 00000000000..ee28277fbcd --- /dev/null +++ b/modules/nf-core/stitch/tests/main.nf.test.snap @@ -0,0 +1,170 @@ +{ + "test_with_bam": { + "content": [ + [ + [ + "sample.1.input.chr21.RData", + "sample.2.input.chr21.RData" + ] + ], + [ + [ + "EM.all.chr21.RData", + "end.chr21.RData", + "endEM.chr21.RData", + "sampleNames.chr21.RData", + "start.chr21.RData", + "startEM.chr21.RData" + ] + ], + [ + [ + "alphaMat.chr21.all.s.1.png", + "alphaMat.chr21.normalized.s.1.png", + "hapSum.chr21.s.1.png", + "hapSum_log.chr21.s.1.png", + "metricsForPostImputationQC.chr21.sample.jpg", + "metricsForPostImputationQCChromosomeWide.chr21.sample.jpg", + "r2.chr21.goodonly.jpg" + ] + ], + [ + "stitch.chr21.vcf.gz" + ], + [ + "versions.yml:md5,23ba0a3cec10c1bdb411b3e1f31b008e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T20:16:19.412761604" + }, + "test_no_seed": { + "content": [ + [ + [ + "sample.1.input.chr21.RData", + "sample.2.input.chr21.RData" + ] + ], + [ + [ + "EM.all.chr21.RData", + "end.chr21.RData", + "endEM.chr21.RData", + "sampleNames.chr21.RData", + "start.chr21.RData", + "startEM.chr21.RData" + ] + ], + [ + [ + "alphaMat.chr21.all.s.1.png", + "alphaMat.chr21.normalized.s.1.png", + "hapSum.chr21.s.1.png", + "hapSum_log.chr21.s.1.png", + "metricsForPostImputationQC.chr21.sample.jpg", + "metricsForPostImputationQCChromosomeWide.chr21.sample.jpg", + "r2.chr21.goodonly.jpg" + ] + ], + [ + "stitch.chr21.vcf.gz" + ], + [ + "versions.yml:md5,23ba0a3cec10c1bdb411b3e1f31b008e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T18:49:25.941823568" + }, + "test_two_stage_imputation": { + "content": [ + [ + [ + "sample.1.input.chr21.RData", + "sample.2.input.chr21.RData" + ] + ], + [ + [ + "EM.all.chr21.RData", + "end.chr21.RData", + "endEM.chr21.RData", + "sampleNames.chr21.RData", + "start.chr21.RData", + "startEM.chr21.RData" + ] + ], + [ + [ + "alphaMat.chr21.all.s.1.png", + "alphaMat.chr21.normalized.s.1.png", + "hapSum.chr21.s.1.png", + "hapSum_log.chr21.s.1.png", + "metricsForPostImputationQC.chr21.sample.jpg", + "metricsForPostImputationQCChromosomeWide.chr21.sample.jpg", + "r2.chr21.goodonly.jpg" + ] + ], + [ + "stitch.chr21.vcf.gz" + ], + [ + "versions.yml:md5,019f1127aacfb7d14a0c4ae3d740a07d" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T20:14:01.151837306" + }, + "test_with_seed": { + "content": [ + [ + [ + "sample.1.input.chr21.RData", + "sample.2.input.chr21.RData" + ] + ], + [ + [ + "EM.all.chr21.RData", + "end.chr21.RData", + "endEM.chr21.RData", + "sampleNames.chr21.RData", + "start.chr21.RData", + "startEM.chr21.RData" + ] + ], + [ + [ + "alphaMat.chr21.all.s.1.png", + "alphaMat.chr21.normalized.s.1.png", + "hapSum.chr21.s.1.png", + "hapSum_log.chr21.s.1.png", + "metricsForPostImputationQC.chr21.sample.jpg", + "metricsForPostImputationQCChromosomeWide.chr21.sample.jpg", + "r2.chr21.goodonly.jpg" + ] + ], + [ + "stitch.chr21.vcf.gz" + ], + [ + "versions.yml:md5,23ba0a3cec10c1bdb411b3e1f31b008e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T18:59:46.592393397" + } +} \ No newline at end of file diff --git a/modules/nf-core/stitch/tests/stitch_generate_input.config b/modules/nf-core/stitch/tests/stitch_generate_input.config new file mode 100644 index 00000000000..3e0a5666f07 --- /dev/null +++ b/modules/nf-core/stitch/tests/stitch_generate_input.config @@ -0,0 +1,6 @@ +process { + withName: STITCH_GENERATE_INPUTS { + ext.args2 = "--generateInputOnly TRUE" + } +} + diff --git a/modules/nf-core/stitch/tests/stitch_impute_only.config b/modules/nf-core/stitch/tests/stitch_impute_only.config new file mode 100644 index 00000000000..f3304ceac7e --- /dev/null +++ b/modules/nf-core/stitch/tests/stitch_impute_only.config @@ -0,0 +1,5 @@ +process { + withName: STITCH { + ext.args2 = "--regenerateInputWithDefaultValues TRUE" + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index c1242df8247..5f98df7f0fd 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -636,9 +636,6 @@ srst2/srst2: stecfinder: - modules/nf-core/stecfinder/** - tests/modules/nf-core/stecfinder/** -stitch: - - modules/nf-core/stitch/** - - tests/modules/nf-core/stitch/** subworkflows/align_bowtie2: - subworkflows/nf-core/align_bowtie2/** - tests/subworkflows/nf-core/align_bowtie2/** diff --git a/tests/modules/nf-core/stitch/main.nf b/tests/modules/nf-core/stitch/main.nf deleted file mode 100644 index e98b7438cbe..00000000000 --- a/tests/modules/nf-core/stitch/main.nf +++ /dev/null @@ -1,135 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { STITCH as STITCH_ONE_STEP } from '../../../../modules/nf-core/stitch/main.nf' -include { STITCH as STITCH_GENERATE_INPUTS } from '../../../../modules/nf-core/stitch/main.nf' -include { STITCH as STITCH_IMPUTE_ONLY } from '../../../../modules/nf-core/stitch/main.nf' - -// positions and essential parameters -def posfile = file(params.test_data['homo_sapiens']['genome']['genome_21_stitch_posfile'], checkIfExists: true) -def input_empty = [] -def rdata_empty = [] -def chromosome_name_val = "chr21" -def K_val = 2 -def nGen_val = 1 -def stitch_input = [ [ id: "test_positions" ], posfile, input_empty, rdata_empty, chromosome_name_val, K_val, nGen_val ] - -// sequencing data in cram format -def crams_val = [ - params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram' ], - params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram'], -] -def crais_val = [ - params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai' ], - params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_cram_crai'], -] -def reads = [ [ id:"test_reads" ], crams_val, crais_val ] - -// sequencing data in bam format -def bams_val = [ - params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam' ], - params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam'], -] -def bais_val = [ - params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_bam_bai' ], - params.test_data['homo_sapiens']['illumina']['test2_paired_end_recalibrated_sorted_bam_bai'], -] -def reads_bam = [ [ id:"test_reads" ], bams_val, bais_val ] - -// reference genome -def reference = [ - [ id:"test_reference" ], - file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'] , checkIfExists: true), - file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true), -] - -// for reproducibility -def seed = 1 - -// -// Test workflows -// - -workflow GET_READS { - main: - cramlist = Channel.fromPath( crams_val ) - .map { it[-1] as String } // get only filename - .collectFile( name: "cramlist.txt", newLine: true, sort: true ) - - - emit: - Channel.of( reads ).combine( cramlist ).first() -} - -workflow GET_READS_BAM { - main: - bamlist = Channel.fromPath( bams_val ) - .map { it[-1] as String } // get only filename - .collectFile( name: "bamlist.txt", newLine: true, sort: true ) - - - emit: - Channel.of( reads_bam ).combine( bamlist ).first() -} - - -workflow test_with_seed { - GET_READS() - STITCH_ONE_STEP ( - stitch_input, - GET_READS.out, - reference, - seed, - ) -} - -workflow test_no_seed { - GET_READS() - STITCH_ONE_STEP ( - stitch_input, - GET_READS.out, - reference, - [], - ) -} - -workflow test_two_stage_imputation { - GET_READS() - STITCH_GENERATE_INPUTS ( - stitch_input, - GET_READS.out, - reference, - seed, - ) - - Channel.of( stitch_input ) - .map { - meta, positions, input, rdata, chromosome_name, K, nGen -> - [ meta, positions ] - } - .join ( STITCH_GENERATE_INPUTS.out.input ) - .join ( STITCH_GENERATE_INPUTS.out.rdata ) - .map { - meta, positions, input, rdata -> - [ meta, positions, input, rdata, chromosome_name_val, K_val, nGen_val ] - } - .set { stitch_input_second_step } - - STITCH_IMPUTE_ONLY( - stitch_input_second_step, - [[id: null], [], [], []], - [[id: null], [], []], - seed, - ) -} - -workflow test_bam { - GET_READS_BAM() - STITCH_ONE_STEP ( - stitch_input, - GET_READS_BAM.out, - reference, - seed, - ) -} diff --git a/tests/modules/nf-core/stitch/nextflow.config b/tests/modules/nf-core/stitch/nextflow.config deleted file mode 100644 index 89433c53f2a..00000000000 --- a/tests/modules/nf-core/stitch/nextflow.config +++ /dev/null @@ -1,12 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: STITCH_GENERATE_INPUTS { - ext.args2 = "--generateInputOnly TRUE" - } - withName: STITCH_IMPUTE_ONLY { - ext.args2 = "--regenerateInputWithDefaultValues TRUE" - } - -} diff --git a/tests/modules/nf-core/stitch/test.yml b/tests/modules/nf-core/stitch/test.yml deleted file mode 100644 index aec395e046e..00000000000 --- a/tests/modules/nf-core/stitch/test.yml +++ /dev/null @@ -1,109 +0,0 @@ -- name: stitch test_with_seed - command: nextflow run ./tests/modules/nf-core/stitch -entry test_with_seed -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/stitch/nextflow.config - tags: - - stitch - files: - - path: output/stitch/RData/EM.all.chr21.RData - md5sum: 41d63ae9ba7696e97ce7e3dafd1454ea - - path: output/stitch/RData/sampleNames.chr21.RData - md5sum: df745cab2454edcdafc0825136f17664 - - path: output/stitch/RData/start.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/end.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/startEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/endEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/input/sample.1.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/input/sample.2.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/plots/alphaMat.chr21.all.s.1.png - - path: output/stitch/plots/alphaMat.chr21.normalized.s.1.png - - path: output/stitch/plots/hapSum.chr21.s.1.png - - path: output/stitch/plots/hapSum_log.chr21.s.1.png - - path: output/stitch/plots/metricsForPostImputationQC.chr21.sample.jpg - - path: output/stitch/plots/metricsForPostImputationQCChromosomeWide.chr21.sample.jpg - - path: output/stitch/plots/r2.chr21.goodonly.jpg - - path: output/stitch/stitch.chr21.vcf.gz - md5sum: a7650b4053d0f6abb675a4763d73626f - - path: output/stitch/versions.yml - -- name: stitch test_no_seed - command: nextflow run ./tests/modules/nf-core/stitch -entry test_no_seed -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/stitch/nextflow.config - tags: - - stitch - files: - - path: output/stitch/RData/EM.all.chr21.RData - - path: output/stitch/RData/sampleNames.chr21.RData - md5sum: df745cab2454edcdafc0825136f17664 - - path: output/stitch/RData/start.chr21.RData - - path: output/stitch/RData/end.chr21.RData - - path: output/stitch/RData/startEM.chr21.RData - - path: output/stitch/RData/endEM.chr21.RData - - path: output/stitch/input/sample.1.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/input/sample.2.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/plots/alphaMat.chr21.all.s.1.png - - path: output/stitch/plots/alphaMat.chr21.normalized.s.1.png - - path: output/stitch/plots/hapSum.chr21.s.1.png - - path: output/stitch/plots/hapSum_log.chr21.s.1.png - - path: output/stitch/plots/metricsForPostImputationQC.chr21.sample.jpg - - path: output/stitch/plots/metricsForPostImputationQCChromosomeWide.chr21.sample.jpg - - path: output/stitch/plots/r2.chr21.goodonly.jpg - - path: output/stitch/stitch.chr21.vcf.gz - - path: output/stitch/versions.yml - -- name: stitch test_two_stage_imputation - command: nextflow run ./tests/modules/nf-core/stitch -entry test_two_stage_imputation -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/stitch/nextflow.config - tags: - - stitch - files: - - path: output/stitch/RData/EM.all.chr21.RData - md5sum: 41d63ae9ba7696e97ce7e3dafd1454ea - - path: output/stitch/RData/sampleNames.chr21.RData - md5sum: df745cab2454edcdafc0825136f17664 - - path: output/stitch/RData/start.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/end.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/startEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/endEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/input/sample.1.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/input/sample.2.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/plots/alphaMat.chr21.all.s.1.png - - path: output/stitch/plots/alphaMat.chr21.normalized.s.1.png - - path: output/stitch/plots/hapSum.chr21.s.1.png - - path: output/stitch/plots/hapSum_log.chr21.s.1.png - - path: output/stitch/plots/metricsForPostImputationQC.chr21.sample.jpg - - path: output/stitch/plots/metricsForPostImputationQCChromosomeWide.chr21.sample.jpg - - path: output/stitch/plots/r2.chr21.goodonly.jpg - - path: output/stitch/stitch.chr21.vcf.gz - md5sum: a7650b4053d0f6abb675a4763d73626f - - path: output/stitch/versions.yml - -- name: stitch test_bam - command: nextflow run ./tests/modules/nf-core/stitch -entry test_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/stitch/nextflow.config - tags: - - stitch - files: - - path: output/stitch/RData/EM.all.chr21.RData - md5sum: 41d63ae9ba7696e97ce7e3dafd1454ea - - path: output/stitch/RData/sampleNames.chr21.RData - md5sum: df745cab2454edcdafc0825136f17664 - - path: output/stitch/RData/start.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/end.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/startEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/RData/endEM.chr21.RData # it contains the execution time so md5 checkusm not possible even with seed - - path: output/stitch/input/sample.1.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/input/sample.2.input.chr21.RData - md5sum: 39741bab12230d0cfcbff64621708da0 - - path: output/stitch/plots/alphaMat.chr21.all.s.1.png - - path: output/stitch/plots/alphaMat.chr21.normalized.s.1.png - - path: output/stitch/plots/hapSum.chr21.s.1.png - - path: output/stitch/plots/hapSum_log.chr21.s.1.png - - path: output/stitch/plots/metricsForPostImputationQC.chr21.sample.jpg - - path: output/stitch/plots/metricsForPostImputationQCChromosomeWide.chr21.sample.jpg - - path: output/stitch/plots/r2.chr21.goodonly.jpg - - path: output/stitch/stitch.chr21.vcf.gz - md5sum: a7650b4053d0f6abb675a4763d73626f - - path: output/stitch/versions.yml From 567c24fe09b5b8c89c6c2602cf87cc712451cec3 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Sun, 27 Oct 2024 15:19:05 +0530 Subject: [PATCH 10/87] add fq2bammeth tests + snap (#6857) * add fq2bammeth tests + snap * Added sub tests and moved --low-memory to args * Excluded from testing for now * Skip nf-test * Touched seqkit/rmdup to test GHA CI --------- Co-authored-by: GallVp --- .github/workflows/test.yml | 8 + modules/nf-core/parabricks/fq2bammeth/main.nf | 9 +- .../nf-core/parabricks/fq2bammeth/meta.yml | 1 + .../parabricks/fq2bammeth/tests/main.nf.test | 75 +++++++- .../fq2bammeth/tests/main.nf.test.snap | 174 ++++++++++++++++++ .../fq2bammeth/tests/nextflow.config | 8 + .../nf-core/seqkit/rmdup/tests/main.nf.test | 1 - 7 files changed, 264 insertions(+), 12 deletions(-) create mode 100644 modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test.snap create mode 100644 modules/nf-core/parabricks/fq2bammeth/tests/nextflow.config diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5ffd422c09..5d19d07ba69 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -638,6 +638,12 @@ jobs: path: modules/nf-core/islandpath - profile: conda path: modules/nf-core/scimap/mcmicro + - profile: conda + path: modules/nf-core/parabricks/fq2bammeth + - profile: docker_self_hosted + path: modules/nf-core/parabricks/fq2bammeth + - profile: singularity + path: modules/nf-core/parabricks/fq2bammeth - profile: conda path: subworkflows/nf-core/vcf_annotate_ensemblvep - profile: conda @@ -721,6 +727,7 @@ jobs: # Test the module - name: Run nf-test + if: ${{ matrix.path != '' }} env: NFT_DIFF: "pdiff" NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2" @@ -742,6 +749,7 @@ jobs: ${{ matrix.path }} - uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1 + if: ${{ matrix.path != '' }} with: path: >- test.tap diff --git a/modules/nf-core/parabricks/fq2bammeth/main.nf b/modules/nf-core/parabricks/fq2bammeth/main.nf index c5200d6be1c..dcad7cdcc3f 100644 --- a/modules/nf-core/parabricks/fq2bammeth/main.nf +++ b/modules/nf-core/parabricks/fq2bammeth/main.nf @@ -32,19 +32,18 @@ process PARABRICKS_FQ2BAMMETH { def in_fq_command = meta.single_end ? "--in-se-fq $reads" : "--in-fq $reads" def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : "" def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : "" + def num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : '' """ - INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` - mv $fasta \$INDEX + ln -sf \$(readlink $fasta) $index/$fasta pbrun \\ fq2bam_meth \\ - --ref \$INDEX \\ + --ref $index/$fasta \\ $in_fq_command \\ - --read-group-sm $meta.id \\ --out-bam ${prefix}.bam \\ $known_sites_command \\ $known_sites_output \\ - --num-gpus $task.accelerator.request \\ + $num_gpus \\ $args cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/parabricks/fq2bammeth/meta.yml b/modules/nf-core/parabricks/fq2bammeth/meta.yml index d44e6a4482e..4f295b8806e 100644 --- a/modules/nf-core/parabricks/fq2bammeth/meta.yml +++ b/modules/nf-core/parabricks/fq2bammeth/meta.yml @@ -92,3 +92,4 @@ authors: - "@sateeshperi" maintainers: - "@sateeshperi" + - "@gallvp" diff --git a/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test b/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test index da20b7151fe..42e436a3ba3 100644 --- a/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test +++ b/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test @@ -3,6 +3,7 @@ nextflow_process { name "Test Process PARABRICKS_FQ2BAMMETH" script "../main.nf" process "PARABRICKS_FQ2BAMMETH" + config "./nextflow.config" tag "bwameth/index" tag "modules" @@ -17,7 +18,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) ]) """ } @@ -25,7 +26,7 @@ nextflow_process { } - test("sarscov2 - bam") { + test("SRR389222 - fastq - se") { when { process { @@ -33,12 +34,12 @@ nextflow_process { input[0] = Channel.of([ [ id:'test', single_end:true ], // meta map [ - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true) + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true) ] ]) input[1] = Channel.of([ - [ id:'test' ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) ]) input[2] = BWAMETH_INDEX.out.index input[3] = [] @@ -49,11 +50,73 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.bai, + process.out.versions + ).match() } ) } + } + + test("SRR389222 - fastq - se - stub") { + options '-stub' + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [ + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) + ]) + input[2] = BWAMETH_INDEX.out.index + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } } + test("E. coli - fastq - pe - stub") { + options '-stub' + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/Ecoli_10K_methylated_R1.fastq.gz', checkIfExists: true), + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/Ecoli_10K_methylated_R2.fastq.gz', checkIfExists: true), + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) + ]) + input[2] = BWAMETH_INDEX.out.index + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test.snap b/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test.snap new file mode 100644 index 00000000000..265bb4bf917 --- /dev/null +++ b/modules/nf-core/parabricks/fq2bammeth/tests/main.nf.test.snap @@ -0,0 +1,174 @@ +{ + "SRR389222 - fastq - se - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + "alignment.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + "duplicate-metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "5": [ + "versions.yml:md5,882d996a64ad457fcaf85e3a75514baf" + ], + "bai": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bqsr_table": [ + + ], + "duplicate_metrics": [ + "duplicate-metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "qc_metrics": [ + [ + "alignment.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,882d996a64ad457fcaf85e3a75514baf" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-26T21:29:35.546741" + }, + "E. coli - fastq - pe - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + "alignment.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + + ], + "4": [ + "duplicate-metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "5": [ + "versions.yml:md5,882d996a64ad457fcaf85e3a75514baf" + ], + "bai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bqsr_table": [ + + ], + "duplicate_metrics": [ + "duplicate-metrics.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "qc_metrics": [ + [ + "alignment.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,882d996a64ad457fcaf85e3a75514baf" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-26T21:33:35.78287" + }, + "SRR389222 - fastq - se": { + "content": [ + "a7f7ca7b5eb503ab58790d64a0273ed6", + [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,9ec20dda17ee0441fee0598ec0e2152c" + ] + ], + [ + "versions.yml:md5,882d996a64ad457fcaf85e3a75514baf" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-26T21:29:14.709022" + } +} \ No newline at end of file diff --git a/modules/nf-core/parabricks/fq2bammeth/tests/nextflow.config b/modules/nf-core/parabricks/fq2bammeth/tests/nextflow.config new file mode 100644 index 00000000000..6ad9d5350a4 --- /dev/null +++ b/modules/nf-core/parabricks/fq2bammeth/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + withName: 'PARABRICKS_FQ2BAMMETH' { + ext.args = '--low-memory' + } + // Ref: https://forums.developer.nvidia.com/t/problem-with-gpu/256825/6 + // Parabricks’s fq2bam requires 24GB of memory. + // Using --low-memory for testing +} \ No newline at end of file diff --git a/modules/nf-core/seqkit/rmdup/tests/main.nf.test b/modules/nf-core/seqkit/rmdup/tests/main.nf.test index e990443f286..beac3a4ce7c 100644 --- a/modules/nf-core/seqkit/rmdup/tests/main.nf.test +++ b/modules/nf-core/seqkit/rmdup/tests/main.nf.test @@ -147,7 +147,6 @@ nextflow_process { } test("file_name_conflict-fail_with_error-stub") { - options '-stub' when { From cc64e71652f67ce627064af51008fe0a00850987 Mon Sep 17 00:00:00 2001 From: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:12:42 +0100 Subject: [PATCH 11/87] Update glimpse2 modules (#6825) * Update glimpse2 modules * Update glimpse2 phase tuple * Update snapshot * Add versions --------- Co-authored-by: LouisLeNezet Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/glimpse2/chunk/main.nf | 3 +- modules/nf-core/glimpse2/chunk/meta.yml | 5 - .../nf-core/glimpse2/chunk/tests/main.nf.test | 23 +- .../glimpse2/concordance/tests/main.nf.test | 199 ++++++++++++++++++ .../concordance/tests/main.nf.test.snap | 86 ++++++++ .../concordance/tests/nextflow.config | 6 + .../concordance/tests/nextflow_R2.config | 14 +- .../glimpse2/concordance/tests/tags.yml | 2 + .../glimpse2/ligate/tests/main.nf.test | 2 +- modules/nf-core/glimpse2/phase/main.nf | 13 +- modules/nf-core/glimpse2/phase/meta.yml | 6 + .../nf-core/glimpse2/phase/tests/main.nf.test | 87 ++++++-- .../glimpse2/phase/tests/main.nf.test.snap | 40 +++- .../glimpse2/phase/tests/nextflow.config | 5 + tests/config/pytest_modules.yml | 3 - .../nf-core/glimpse2/concordance/main.nf | 94 --------- .../nf-core/glimpse2/concordance/test.yml | 46 ---- 17 files changed, 434 insertions(+), 200 deletions(-) create mode 100644 modules/nf-core/glimpse2/concordance/tests/main.nf.test create mode 100644 modules/nf-core/glimpse2/concordance/tests/main.nf.test.snap create mode 100644 modules/nf-core/glimpse2/concordance/tests/nextflow.config rename tests/modules/nf-core/glimpse2/concordance/nextflow.config => modules/nf-core/glimpse2/concordance/tests/nextflow_R2.config (77%) create mode 100644 modules/nf-core/glimpse2/concordance/tests/tags.yml create mode 100644 modules/nf-core/glimpse2/phase/tests/nextflow.config delete mode 100644 tests/modules/nf-core/glimpse2/concordance/main.nf delete mode 100644 tests/modules/nf-core/glimpse2/concordance/test.yml diff --git a/modules/nf-core/glimpse2/chunk/main.nf b/modules/nf-core/glimpse2/chunk/main.nf index c7f5d47a300..4c72990d072 100644 --- a/modules/nf-core/glimpse2/chunk/main.nf +++ b/modules/nf-core/glimpse2/chunk/main.nf @@ -17,8 +17,7 @@ process GLIMPSE2_CHUNK { 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" input: - tuple val(meta) , path(input), path(input_index), val(region) - tuple val(meta2), path(map) + tuple val(meta), path(input), path(input_index), val(region), path(map) val(model) output: diff --git a/modules/nf-core/glimpse2/chunk/meta.yml b/modules/nf-core/glimpse2/chunk/meta.yml index 7757a7a445e..bcb089d5f46 100644 --- a/modules/nf-core/glimpse2/chunk/meta.yml +++ b/modules/nf-core/glimpse2/chunk/meta.yml @@ -38,11 +38,6 @@ input: description: | Target region, usually a full chromosome (e.g. chr20:1000000-2000000 or chr20). For chrX, please treat PAR and non-PAR regions as different choromosome in order to avoid mixing ploidy. - - - meta2: - type: map - description: | - Groovy Map containing genomic map information - e.g. [ map:'GRCh38' ] - map: type: file description: File containing the genetic map. diff --git a/modules/nf-core/glimpse2/chunk/tests/main.nf.test b/modules/nf-core/glimpse2/chunk/tests/main.nf.test index 0f9e8850ca1..406aa7b8e8b 100644 --- a/modules/nf-core/glimpse2/chunk/tests/main.nf.test +++ b/modules/nf-core/glimpse2/chunk/tests/main.nf.test @@ -9,19 +9,18 @@ nextflow_process { tag "modules" test("Should run without map") { - config "modules/nf-core/glimpse2/chunk/tests/nextflow.config" + config "./nextflow.config" when { process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), - "chr21" + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), + "chr21", [] ] - input[1]= [[ id:'map'],[]] - input[2]= "recursive" + input[1]= "recursive" """ } } @@ -36,19 +35,19 @@ nextflow_process { } test("Should run with map") { - config "modules/nf-core/glimpse2/chunk/tests/nextflow.config" + config "./nextflow.config" when { process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), - "chr21" + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true), + "chr21", + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true) ] - input[1]= [[ id:'map'],file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true)] - input[2]= "recursive" + input[1]= "recursive" """ } } diff --git a/modules/nf-core/glimpse2/concordance/tests/main.nf.test b/modules/nf-core/glimpse2/concordance/tests/main.nf.test new file mode 100644 index 00000000000..9c5625207ac --- /dev/null +++ b/modules/nf-core/glimpse2/concordance/tests/main.nf.test @@ -0,0 +1,199 @@ +nextflow_process { + + name "Test Process GLIMPSE2_CONCORDANCE" + script "../main.nf" + process "GLIMPSE2_CONCORDANCE" + tag "glimpse2" + tag "glimpse2/concordance" + tag "glimpse2/phase" + tag "bcftools/index" + tag "modules_nfcore" + tag "modules" + + setup { + run("GLIMPSE2_PHASE") { + script "../../phase/main.nf" + process { + """ + input_vcf = Channel.of([ + [ id:'input'], // meta map + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), + [] + ]) + + samples_infos = Channel.of('NA12878 2').collectFile(name: 'sampleinfos.txt') + region = Channel.of(["chr21:16600000-16800000","chr21:16650000-16750000"]) + + ch_ref_panel = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + ]) + + ch_map = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), + ]) + + // [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map] + input[0] = input_vcf + .combine(samples_infos) + .combine(region) + .combine( ch_ref_panel ) + .combine( ch_map ) + input[1]= Channel.of([[],[],[]]) + """ + } + } + + run("BCFTOOLS_INDEX") { + script "../../../bcftools/index/main.nf" + process { + """ + input[0] = GLIMPSE2_PHASE.output.phased_variants + """ + } + } + } + + + test("test_glimpse2_concordance") { + config "./nextflow.config" + + when { + process { + """ + allele_freq = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) + ]) + + truth = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) + ]) + list_inputs = GLIMPSE2_PHASE.output.phased_variants + .join( BCFTOOLS_INDEX.out.csi ) + .combine( truth ) + .combine( allele_freq ) + .combine( Channel.of([[]]) ) + .combine( Channel.of(["chr21"]) ) + + input[0] = list_inputs + input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]) + input[2] = 0.9999 + input[3] = 8 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.errors_cal.collect{ file(it[1]).name }, + process.out.errors_grp.collect{ file(it[1]).name }, + process.out.errors_spl.collect{ file(it[1]).name }, + process.out.rsquare_grp.collect{ file(it[1]).name }, + process.out.rsquare_spl.collect{ file(it[1]).name }, + process.out.versions + ).match() } + ) + } + + } + + test("test_list_region") { + config "./nextflow.config" + + when { + process { + """ + allele_freq = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) + ]) + + truth = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) + ]) + list_inputs = GLIMPSE2_PHASE.output.phased_variants + .join( BCFTOOLS_INDEX.out.csi ) + .combine( truth ) + .combine( allele_freq ) + .combine( Channel.of([[]]) ) + .combine( Channel.of(["chr21", "chr21"]) ) + + input[0] = list_inputs + input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]) + input[2] = 0.9999 + input[3] = 8 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.errors_cal.collect{ file(it[1]).name }, + process.out.errors_grp.collect{ file(it[1]).name }, + process.out.errors_spl.collect{ file(it[1]).name }, + process.out.rsquare_grp.collect{ file(it[1]).name }, + process.out.rsquare_spl.collect{ file(it[1]).name }, + process.out.versions + ).match() + } + ) + } + + } + + test("test_r2_per_site") { + config "./nextflow_R2.config" + + when { + process { + """ + allele_freq = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) + ]) + + truth = Channel.of([ + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), + file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) + ]) + list_inputs = GLIMPSE2_PHASE.output.phased_variants + .join( BCFTOOLS_INDEX.out.csi ) + .combine( truth ) + .combine( allele_freq ) + .combine( Channel.of([[]]) ) + .combine( Channel.of(["chr21"]) ) + input[0] = list_inputs + input[1] = Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]) + input[2] = 0.9999 + input[3] = 8 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.errors_cal.collect{ file(it[1]).name }, + process.out.errors_grp.collect{ file(it[1]).name }, + process.out.errors_spl.collect{ file(it[1]).name }, + process.out.rsquare_grp.collect{ file(it[1]).name }, + process.out.rsquare_spl.collect{ file(it[1]).name }, + process.out.rsquare_per_site.collect{ file(it[1]).name }, + process.out.versions + ).match() + } + ) + } + + } + +} diff --git a/modules/nf-core/glimpse2/concordance/tests/main.nf.test.snap b/modules/nf-core/glimpse2/concordance/tests/main.nf.test.snap new file mode 100644 index 00000000000..12bded93619 --- /dev/null +++ b/modules/nf-core/glimpse2/concordance/tests/main.nf.test.snap @@ -0,0 +1,86 @@ +{ + "test_r2_per_site": { + "content": [ + [ + "input.error.cal.txt.gz" + ], + [ + "input.error.grp.txt.gz" + ], + [ + "input.error.spl.txt.gz" + ], + [ + "input.rsquare.grp.txt.gz" + ], + [ + "input.rsquare.spl.txt.gz" + ], + [ + "input_r2_sites.txt.gz" + ], + [ + "versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T16:23:00.623182365" + }, + "test_glimpse2_concordance": { + "content": [ + [ + "input.error.cal.txt.gz" + ], + [ + "input.error.grp.txt.gz" + ], + [ + "input.error.spl.txt.gz" + ], + [ + "input.rsquare.grp.txt.gz" + ], + [ + "input.rsquare.spl.txt.gz" + ], + [ + "versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T16:22:26.823581573" + }, + "test_list_region": { + "content": [ + [ + "input.error.cal.txt.gz" + ], + [ + "input.error.grp.txt.gz" + ], + [ + "input.error.spl.txt.gz" + ], + [ + "input.rsquare.grp.txt.gz" + ], + [ + "input.rsquare.spl.txt.gz" + ], + [ + "versions.yml:md5,ba729289bab6b9fbb8c36a620c86bb82" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T16:22:43.352729014" + } +} \ No newline at end of file diff --git a/modules/nf-core/glimpse2/concordance/tests/nextflow.config b/modules/nf-core/glimpse2/concordance/tests/nextflow.config new file mode 100644 index 00000000000..e5721995778 --- /dev/null +++ b/modules/nf-core/glimpse2/concordance/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withName: GLIMPSE2_CHUNK { + ext.prefix = { "${meta.id}" } + } + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } +} \ No newline at end of file diff --git a/tests/modules/nf-core/glimpse2/concordance/nextflow.config b/modules/nf-core/glimpse2/concordance/tests/nextflow_R2.config similarity index 77% rename from tests/modules/nf-core/glimpse2/concordance/nextflow.config rename to modules/nf-core/glimpse2/concordance/tests/nextflow_R2.config index b821ba12a63..88174ccd131 100644 --- a/tests/modules/nf-core/glimpse2/concordance/nextflow.config +++ b/modules/nf-core/glimpse2/concordance/tests/nextflow_R2.config @@ -1,7 +1,7 @@ -process { - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName:GLIMPSE2_CONCORDANCE_R2_PER_SITE { - ext.args = "--out-r2-per-site" - } -} +process { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName:GLIMPSE2_CONCORDANCE { + ext.args = "--out-r2-per-site" + } +} diff --git a/modules/nf-core/glimpse2/concordance/tests/tags.yml b/modules/nf-core/glimpse2/concordance/tests/tags.yml new file mode 100644 index 00000000000..76ef847a03e --- /dev/null +++ b/modules/nf-core/glimpse2/concordance/tests/tags.yml @@ -0,0 +1,2 @@ +glimpse2/concordance: + - modules/nf-core/glimpse2/concordance/** diff --git a/modules/nf-core/glimpse2/ligate/tests/main.nf.test b/modules/nf-core/glimpse2/ligate/tests/main.nf.test index d45c448b4c8..6706d58646e 100644 --- a/modules/nf-core/glimpse2/ligate/tests/main.nf.test +++ b/modules/nf-core/glimpse2/ligate/tests/main.nf.test @@ -22,7 +22,7 @@ nextflow_process { [ id:'input' ], // meta map file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000" ]) diff --git a/modules/nf-core/glimpse2/phase/main.nf b/modules/nf-core/glimpse2/phase/main.nf index 5419f95beb9..8d5cc254a31 100644 --- a/modules/nf-core/glimpse2/phase/main.nf +++ b/modules/nf-core/glimpse2/phase/main.nf @@ -18,13 +18,13 @@ process GLIMPSE2_PHASE { 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" input: - tuple val(meta) , path(input, arity: '1..*'), path(input_index), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) + tuple val(meta) , path(input, arity: '1..*'), path(input_index), path(bamlist), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) tuple val(meta2), path(fasta_reference), path(fasta_reference_index) output: tuple val(meta), path("*.{vcf,vcf.gz,bcf,bgen}"), emit: phased_variants - tuple val(meta), path("*.txt.gz") , emit: stats_coverage, optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*.txt.gz") , emit: stats_coverage, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -45,7 +45,7 @@ process GLIMPSE2_PHASE { it.toString().endsWithAny("cram", "bam") ? "bam" : it.toString().endsWithAny("vcf", "bcf", "vcf.gz") ? "gl" : it.getExtension() - }.unique() + }.unique() if (input_type.size() > 1 | !(input_type.contains("gl") | input_type.contains("bam"))) { error "Input files must be of the same type and either .bam/.cram or .vcf/.vcf.gz/.bcf format. Found: ${input_type}" @@ -58,7 +58,10 @@ process GLIMPSE2_PHASE { def input_list = input.size() > 1 """ - if $input_list ; + if [ -n "$bamlist" ] ; + then + input_command="--bam-list $bamlist" + elif $input_list ; then ls -1 | grep '\\.cram\$\\|\\.bam\$' > all_bam.txt input_command="--bam-list all_bam.txt" diff --git a/modules/nf-core/glimpse2/phase/meta.yml b/modules/nf-core/glimpse2/phase/meta.yml index 11d0860b745..dd720fd4bec 100644 --- a/modules/nf-core/glimpse2/phase/meta.yml +++ b/modules/nf-core/glimpse2/phase/meta.yml @@ -31,6 +31,12 @@ input: type: file description: Index file of the input BAM/CRAM/VCF/BCF file. pattern: "*.{bam.bai,cram.crai,vcf.gz.csi,bcf.gz.csi}" + - bamlist: + type: file + description: | + File containing the list of BAM/CRAM files to be phased. + One file per line and a second column can be added to indicate the sample name. + pattern: "*.{txt,tsv}" - samples_file: type: file description: | diff --git a/modules/nf-core/glimpse2/phase/tests/main.nf.test b/modules/nf-core/glimpse2/phase/tests/main.nf.test index 69642590a4e..04b89f2a28d 100644 --- a/modules/nf-core/glimpse2/phase/tests/main.nf.test +++ b/modules/nf-core/glimpse2/phase/tests/main.nf.test @@ -19,7 +19,7 @@ nextflow_process { [ id:'input' ], // meta map file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000" ]) @@ -62,7 +62,7 @@ nextflow_process { [id:'input'], file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.bam", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.bam.bai", checkIfExists: true), - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000", ]) @@ -105,7 +105,7 @@ nextflow_process { [id:'input'], file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.cram", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.cram.crai", checkIfExists: true), - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000", ]) @@ -141,6 +141,7 @@ nextflow_process { ) } } + test("Should run with list of bam files and reference genome") { when { @@ -148,11 +149,11 @@ nextflow_process { """ input_bam = Channel.of([ [id:'input'], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.bam", checkIfExists: true), - file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA19401/NA19401.s.bam", checkIfExists: true)], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.bam.bai", checkIfExists: true), - file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA19401/NA19401.s.bam.bai", checkIfExists: true)], - [], + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA19401/NA19401.s.bam", checkIfExists: true)], + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExists: true)], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000", ]) @@ -196,11 +197,11 @@ nextflow_process { """ input_bam = Channel.of([ [id:'input'], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.bam", checkIfExists: true), + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true)], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.bam.bai", checkIfExists: true), + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true)], - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000", ]) @@ -235,16 +236,17 @@ nextflow_process { } test("Should run into error only one vcf allowed") { + when { process { """ input_bam = Channel.of([ [id:'input'], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.1x.bcf", checkIfExists: true), + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.1x.bcf", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true)], - [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.1x.bcf.csi", checkIfExists: true), + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.1x.bcf.csi", checkIfExists: true), file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true)], - [], + [], [], "chr21:16600000-16800000", "chr21:16650000-16750000", ]) @@ -277,4 +279,61 @@ nextflow_process { ) } } + + test("Should run with a bamlist to rename samples") { + config "./nextflow.config" + + when { + process { + """ + bamlist = Channel.of( + "NA12878.s.bam\tNA12878", + "NA19401.s.bam\tNA19401" + ).collectFile(name: 'bamlist.txt', newLine: true) + + input_bam = Channel.of([ + [id:'input'], + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA19401/NA19401.s.bam", checkIfExists: true)], + [file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA12878/NA12878.s.bam.bai", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/hum_data/individuals/NA19401/NA19401.s.bam.bai", checkIfExists: true)], + ]).combine(bamlist).map{ map, bam, bai, bamlist -> [ + map, bam, bai, bamlist, [], + "chr21:16600000-16800000", + "chr21:16650000-16750000", + ] + } + ref_panel = Channel.of([ + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + ]) + + map_file = Channel.of([ + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true) + ]) + reference_genome = Channel.of([ + [id:'refHG38_chr21'], + file(params.modules_testdata_base_path + "delete_me/glimpse/hs38DH.chr21.fa.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/hs38DH.chr21.fa.gz.fai", checkIfExists: true) + ]) + // [meta, vcf, index, sample_infos, regionin, regionout,ref, index, map] [meta, fasta, fai] + input[0] = input_bam + .combine(ref_panel) + .combine(map_file) + input[1] = reference_genome + """ + } + } + + then { + assertAll( + { assert process.success }, + // File has a timestamp in it and is in binary format, so we can only check the name + { assert snapshot( + process.out.phased_variants.collect{ path(it[1]).vcf.header.getGenotypeSamples().sort() }, + process.out.phased_variants.collect{ path(it[1]).vcf.summary.replaceAll(", phasedAutodetect=(false|true)", "") } + ).match()}, + ) + } + } } diff --git a/modules/nf-core/glimpse2/phase/tests/main.nf.test.snap b/modules/nf-core/glimpse2/phase/tests/main.nf.test.snap index d32e27c3aea..180af8cc9c5 100644 --- a/modules/nf-core/glimpse2/phase/tests/main.nf.test.snap +++ b/modules/nf-core/glimpse2/phase/tests/main.nf.test.snap @@ -11,7 +11,7 @@ }, "timestamp": "2024-03-13T16:58:34.365910006" }, - "VCF": { + "List_versions": { "content": [ [ "versions.yml:md5,c68de03046a6503cdbcf3a1495fc512f" @@ -21,26 +21,27 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-13T16:58:05.013609832" + "timestamp": "2024-07-09T20:35:30.97466287" }, - "List_coverage": { + "Should run with a bamlist to rename samples": { "content": [ [ [ - { - "id": "input" - }, - "input_chr21_16650000-16750000_stats_coverage.txt.gz:md5,ac61370fc14738b103e160b7298727b9" + "NA12878", + "NA19401" ] + ], + [ + "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=4719, phased=true]" ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.04.3" }, - "timestamp": "2024-07-09T20:35:30.943277837" + "timestamp": "2024-10-22T15:23:37.368119579" }, - "List_versions": { + "VCF": { "content": [ [ "versions.yml:md5,c68de03046a6503cdbcf3a1495fc512f" @@ -50,7 +51,24 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-07-09T20:35:30.97466287" + "timestamp": "2024-03-13T16:58:05.013609832" + }, + "List_coverage": { + "content": [ + [ + [ + { + "id": "input" + }, + "input_chr21_16650000-16750000_stats_coverage.txt.gz:md5,ac61370fc14738b103e160b7298727b9" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-07-09T20:35:30.943277837" }, "BAM_coverage": { "content": [ diff --git a/modules/nf-core/glimpse2/phase/tests/nextflow.config b/modules/nf-core/glimpse2/phase/tests/nextflow.config new file mode 100644 index 00000000000..5fa19c88822 --- /dev/null +++ b/modules/nf-core/glimpse2/phase/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: GLIMPSE2_PHASE { + ext.suffix = { "vcf" } + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 5f98df7f0fd..cb62c33fbe0 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -263,9 +263,6 @@ gfastats: gget/gget: - modules/nf-core/gget/gget/** - tests/modules/nf-core/gget/gget/** -glimpse2/concordance: - - modules/nf-core/glimpse2/concordance/** - - tests/modules/nf-core/glimpse2/concordance/** glnexus: - modules/nf-core/glnexus/** - tests/modules/nf-core/glnexus/** diff --git a/tests/modules/nf-core/glimpse2/concordance/main.nf b/tests/modules/nf-core/glimpse2/concordance/main.nf deleted file mode 100644 index 90d6acf3e21..00000000000 --- a/tests/modules/nf-core/glimpse2/concordance/main.nf +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BCFTOOLS_INDEX } from '../../../../../modules/nf-core/bcftools/index/main.nf' -include { GLIMPSE2_PHASE } from '../../../../../modules/nf-core/glimpse2/phase/main.nf' -include { GLIMPSE_LIGATE } from '../../../../../modules/nf-core/glimpse/ligate/main.nf' -include { GLIMPSE2_CONCORDANCE } from '../../../../../modules/nf-core/glimpse2/concordance/main.nf' -include { - GLIMPSE2_CONCORDANCE as GLIMPSE2_CONCORDANCE_R2_PER_SITE - } from '../../../../../modules/nf-core/glimpse2/concordance/main.nf' - -workflow preprocessing { - samples_infos = Channel.of('NA12878 2').collectFile(name: 'sampleinfos.txt') - region = Channel.of(["chr21:16600000-16800000","chr21:16650000-16750000"]) - input_vcf = Channel.of([ - [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) - ]) - - input_vcf_with_samples_infos = input_vcf.combine(samples_infos).combine(region) - - - ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) - ]) - - ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), - ]) - - GLIMPSE2_PHASE ( - input_vcf_with_samples_infos.combine( ref_panel ) - .combine( ch_map ), - Channel.of([[],[],[]]) - ) // [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map] - - allele_freq = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) - ]) - - truth = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) - ]) - - BCFTOOLS_INDEX ( GLIMPSE2_PHASE.output.phased_variants ) - - list_inputs = GLIMPSE2_PHASE.output.phased_variants - .join( BCFTOOLS_INDEX.out.csi ) - .combine( truth ) - .combine( allele_freq ) - .combine( Channel.of([[]]) ) - .combine( Channel.of(["chr21"]) ) - - emit: - list_inputs -} - - -workflow test_glimpse2_concordance { - list_inputs = preprocessing() - GLIMPSE2_CONCORDANCE ( list_inputs, - Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]), - 0.9999, - 8) // [meta, estimate, estimate_index, truth, truth_index, freq, freq_index, samples, region], [meta, group, bins, ac_bins, allele_count], min-val-gl, min-val-dp -} - - -workflow test_list_region { - list_inputs_list_region = preprocessing().map{ - def reg = it[8] - def ret = it.clone() - ret[8] = [reg, reg] - return ( ret ) - } - - GLIMPSE2_CONCORDANCE ( list_inputs_list_region, - Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]), - 0.9999, - 8) // [meta, estimate, estimate_index, truth, truth_index, freq, freq_index, samples, region], [meta, group, bins, ac_bins, allele_count], min-val-gl, min-val-dp -} - - -workflow test_r2_per_site { - list_inputs = preprocessing() - GLIMPSE2_CONCORDANCE_R2_PER_SITE ( list_inputs, - Channel.of([[id:"params"],[],"0 0.01 0.05 0.1 0.2 0.5",[],[]]), - 0.9999, - 8) // [meta, estimate, estimate_index, truth, truth_index, freq, freq_index, samples, region], [meta, group, bins, ac_bins, allele_count], min-val-gl, min-val-dp -} diff --git a/tests/modules/nf-core/glimpse2/concordance/test.yml b/tests/modules/nf-core/glimpse2/concordance/test.yml deleted file mode 100644 index 10405f705ec..00000000000 --- a/tests/modules/nf-core/glimpse2/concordance/test.yml +++ /dev/null @@ -1,46 +0,0 @@ -- name: glimpse2 concordance test_glimpse2_concordance - command: nextflow run ./tests/modules/nf-core/glimpse2/concordance -entry test_glimpse2_concordance -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/concordance/nextflow.config - tags: - - glimpse2 - - glimpse2/concordance - files: - - path: output/bcftools/input_chr21_16650000-16750000.bcf.csi - - path: output/bcftools/versions.yml - - path: output/glimpse2/input.error.cal.txt.gz - - path: output/glimpse2/input.error.grp.txt.gz - - path: output/glimpse2/input.error.spl.txt.gz - - path: output/glimpse2/input.rsquare.grp.txt.gz - - path: output/glimpse2/input.rsquare.spl.txt.gz - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/versions.yml -- name: glimpse2 concordance test_list_region - command: nextflow run ./tests/modules/nf-core/glimpse2/concordance -entry test_list_region -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/concordance/nextflow.config - tags: - - glimpse2 - - glimpse2/concordance - files: - - path: output/bcftools/input_chr21_16650000-16750000.bcf.csi - - path: output/bcftools/versions.yml - - path: output/glimpse2/input.error.cal.txt.gz - - path: output/glimpse2/input.error.grp.txt.gz - - path: output/glimpse2/input.error.spl.txt.gz - - path: output/glimpse2/input.rsquare.grp.txt.gz - - path: output/glimpse2/input.rsquare.spl.txt.gz - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/versions.yml -- name: glimpse2 concordance test_r2_per_site - command: nextflow run ./tests/modules/nf-core/glimpse2/concordance -entry test_r2_per_site -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/concordance/nextflow.config - tags: - - glimpse2 - - glimpse2/concordance - files: - - path: output/bcftools/input_chr21_16650000-16750000.bcf.csi - - path: output/bcftools/versions.yml - - path: output/glimpse2/input.error.cal.txt.gz - - path: output/glimpse2/input.error.grp.txt.gz - - path: output/glimpse2/input.error.spl.txt.gz - - path: output/glimpse2/input.rsquare.grp.txt.gz - - path: output/glimpse2/input.rsquare.spl.txt.gz - - path: output/glimpse2/input_r2_sites.txt.gz - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/versions.yml From 91a84f951358143e93dc9e03470db4e6a4a7105c Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Mon, 28 Oct 2024 09:42:04 +0100 Subject: [PATCH 12/87] Bump genmod and add stub tests (#6846) Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- .../nf-core/genmod/annotate/environment.yml | 2 +- modules/nf-core/genmod/annotate/main.nf | 6 +-- .../genmod/annotate/tests/main.nf.test | 31 +++++++++++- .../genmod/annotate/tests/main.nf.test.snap | 50 +++++++++++++++++++ .../nf-core/genmod/compound/environment.yml | 2 +- modules/nf-core/genmod/compound/main.nf | 6 +-- .../genmod/compound/tests/main.nf.test | 31 +++++++++++- .../genmod/compound/tests/main.nf.test.snap | 50 +++++++++++++++++++ modules/nf-core/genmod/models/environment.yml | 2 +- modules/nf-core/genmod/models/main.nf | 6 +-- .../nf-core/genmod/models/tests/main.nf.test | 32 +++++++++++- .../genmod/models/tests/main.nf.test.snap | 50 +++++++++++++++++++ modules/nf-core/genmod/score/environment.yml | 2 +- modules/nf-core/genmod/score/main.nf | 6 +-- .../nf-core/genmod/score/tests/main.nf.test | 33 +++++++++++- .../genmod/score/tests/main.nf.test.snap | 50 +++++++++++++++++++ 16 files changed, 335 insertions(+), 24 deletions(-) create mode 100644 modules/nf-core/genmod/annotate/tests/main.nf.test.snap create mode 100644 modules/nf-core/genmod/compound/tests/main.nf.test.snap create mode 100644 modules/nf-core/genmod/models/tests/main.nf.test.snap create mode 100644 modules/nf-core/genmod/score/tests/main.nf.test.snap diff --git a/modules/nf-core/genmod/annotate/environment.yml b/modules/nf-core/genmod/annotate/environment.yml index bbc3fd973a9..227ee89204f 100644 --- a/modules/nf-core/genmod/annotate/environment.yml +++ b/modules/nf-core/genmod/annotate/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::genmod=3.8.3 + - bioconda::genmod=3.9 diff --git a/modules/nf-core/genmod/annotate/main.nf b/modules/nf-core/genmod/annotate/main.nf index 033caa9ae93..0b8b232de83 100644 --- a/modules/nf-core/genmod/annotate/main.nf +++ b/modules/nf-core/genmod/annotate/main.nf @@ -4,15 +4,15 @@ process GENMOD_ANNOTATE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/genmod:3.8.3--pyhdfd78af_0': - 'biocontainers/genmod:3.8.3--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/genmod:3.9--pyhdfd78af_0': + 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: tuple val(meta), path(input_vcf) output: tuple val(meta), path("*_annotate.vcf"), emit: vcf - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/genmod/annotate/tests/main.nf.test b/modules/nf-core/genmod/annotate/tests/main.nf.test index d17ebc9ea96..a4b3fccba92 100644 --- a/modules/nf-core/genmod/annotate/tests/main.nf.test +++ b/modules/nf-core/genmod/annotate/tests/main.nf.test @@ -24,8 +24,35 @@ nextflow_process { then { assertAll( - {assert process.success}, - {assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.2")} + { assert process.success }, + { assert snapshot( + process.out.versions, + path(process.out.vcf.get(0).get(1)).vcf.summary, + ).match() } + ) + } + + } + + test("genmod_annotate - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/genmod.vcf.gz', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/genmod/annotate/tests/main.nf.test.snap b/modules/nf-core/genmod/annotate/tests/main.nf.test.snap new file mode 100644 index 00000000000..402b5c01cf1 --- /dev/null +++ b/modules/nf-core/genmod/annotate/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "genmod_annotate": { + "content": [ + [ + "versions.yml:md5,6ce3597967a536ab027d02f75d02056c" + ], + "VcfFile [chromosomes=[1], sampleCount=3, variantCount=57, phased=false, phasedAutodetect=false]" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:44:57.176895794" + }, + "genmod_annotate - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_annotate.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,6ce3597967a536ab027d02f75d02056c" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_annotate.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6ce3597967a536ab027d02f75d02056c" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:49:16.409331019" + } +} \ No newline at end of file diff --git a/modules/nf-core/genmod/compound/environment.yml b/modules/nf-core/genmod/compound/environment.yml index bbc3fd973a9..227ee89204f 100644 --- a/modules/nf-core/genmod/compound/environment.yml +++ b/modules/nf-core/genmod/compound/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::genmod=3.8.3 + - bioconda::genmod=3.9 diff --git a/modules/nf-core/genmod/compound/main.nf b/modules/nf-core/genmod/compound/main.nf index 4831da855fa..ca6a22a1994 100644 --- a/modules/nf-core/genmod/compound/main.nf +++ b/modules/nf-core/genmod/compound/main.nf @@ -4,15 +4,15 @@ process GENMOD_COMPOUND { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/genmod:3.8.3--pyhdfd78af_0': - 'biocontainers/genmod:3.8.3--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/genmod:3.9--pyhdfd78af_0': + 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: tuple val(meta), path(input_vcf) output: tuple val(meta), path("*_compound.vcf"), emit: vcf - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/genmod/compound/tests/main.nf.test b/modules/nf-core/genmod/compound/tests/main.nf.test index 43ed9f0dcf0..4c667c17373 100644 --- a/modules/nf-core/genmod/compound/tests/main.nf.test +++ b/modules/nf-core/genmod/compound/tests/main.nf.test @@ -23,8 +23,35 @@ nextflow_process { then { assertAll( - {assert process.success}, - {assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.2")} + { assert process.success }, + { assert snapshot( + process.out.versions, + path(process.out.vcf.get(0).get(1)).vcf.summary, + ).match() } + ) + } + + } + + test("genmod_compound - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/genmod_compound.vcf', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/genmod/compound/tests/main.nf.test.snap b/modules/nf-core/genmod/compound/tests/main.nf.test.snap new file mode 100644 index 00000000000..b114cc3310c --- /dev/null +++ b/modules/nf-core/genmod/compound/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "genmod_compound": { + "content": [ + [ + "versions.yml:md5,822fb501a48a6f8c28ba8f678d27ba2e" + ], + "VcfFile [chromosomes=[MT], sampleCount=3, variantCount=22, phased=false, phasedAutodetect=false]" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:49:41.417545149" + }, + "genmod_compound - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_compound.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,822fb501a48a6f8c28ba8f678d27ba2e" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_compound.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,822fb501a48a6f8c28ba8f678d27ba2e" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:49:48.678803012" + } +} \ No newline at end of file diff --git a/modules/nf-core/genmod/models/environment.yml b/modules/nf-core/genmod/models/environment.yml index bbc3fd973a9..227ee89204f 100644 --- a/modules/nf-core/genmod/models/environment.yml +++ b/modules/nf-core/genmod/models/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::genmod=3.8.3 + - bioconda::genmod=3.9 diff --git a/modules/nf-core/genmod/models/main.nf b/modules/nf-core/genmod/models/main.nf index 90c1fd48233..ff71b660fb5 100644 --- a/modules/nf-core/genmod/models/main.nf +++ b/modules/nf-core/genmod/models/main.nf @@ -4,8 +4,8 @@ process GENMOD_MODELS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/genmod:3.8.3--pyhdfd78af_0': - 'biocontainers/genmod:3.8.3--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/genmod:3.9--pyhdfd78af_0': + 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: tuple val(meta), path(input_vcf) @@ -14,7 +14,7 @@ process GENMOD_MODELS { output: tuple val(meta), path("*_models.vcf"), emit: vcf - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/genmod/models/tests/main.nf.test b/modules/nf-core/genmod/models/tests/main.nf.test index 9eba8dd5231..afa85dfc626 100644 --- a/modules/nf-core/genmod/models/tests/main.nf.test +++ b/modules/nf-core/genmod/models/tests/main.nf.test @@ -25,11 +25,39 @@ nextflow_process { then { assertAll( - {assert process.success}, - {assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.2")} + { assert process.success }, + { assert snapshot( + process.out.versions, + path(process.out.vcf.get(0).get(1)).vcf.summary, + ).match() } ) } } + test("genmod_models - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } } diff --git a/modules/nf-core/genmod/models/tests/main.nf.test.snap b/modules/nf-core/genmod/models/tests/main.nf.test.snap new file mode 100644 index 00000000000..7484a7fd0f9 --- /dev/null +++ b/modules/nf-core/genmod/models/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "genmod_models - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_models.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,10442b1602069000967f51837d7b5b63" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_models.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,10442b1602069000967f51837d7b5b63" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:51:04.841425679" + }, + "genmod_models": { + "content": [ + [ + "versions.yml:md5,10442b1602069000967f51837d7b5b63" + ], + "VcfFile [chromosomes=[1], sampleCount=3, variantCount=57, phased=false, phasedAutodetect=false]" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:49:56.642318737" + } +} \ No newline at end of file diff --git a/modules/nf-core/genmod/score/environment.yml b/modules/nf-core/genmod/score/environment.yml index bbc3fd973a9..227ee89204f 100644 --- a/modules/nf-core/genmod/score/environment.yml +++ b/modules/nf-core/genmod/score/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::genmod=3.8.3 + - bioconda::genmod=3.9 diff --git a/modules/nf-core/genmod/score/main.nf b/modules/nf-core/genmod/score/main.nf index 522e05b6581..41d57bdc194 100644 --- a/modules/nf-core/genmod/score/main.nf +++ b/modules/nf-core/genmod/score/main.nf @@ -4,8 +4,8 @@ process GENMOD_SCORE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/genmod:3.8.3--pyhdfd78af_0': - 'biocontainers/genmod:3.8.3--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/genmod:3.9--pyhdfd78af_0': + 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: tuple val(meta), path(input_vcf) @@ -14,7 +14,7 @@ process GENMOD_SCORE { output: tuple val(meta), path("*_score.vcf"), emit: vcf - path "versions.yml" , emit: versions + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/genmod/score/tests/main.nf.test b/modules/nf-core/genmod/score/tests/main.nf.test index 030ef6ba7f9..98c8f35ae2d 100644 --- a/modules/nf-core/genmod/score/tests/main.nf.test +++ b/modules/nf-core/genmod/score/tests/main.nf.test @@ -25,8 +25,37 @@ nextflow_process { then { assertAll( - {assert process.success}, - {assert path(process.out.vcf.get(0).get(1)).readLines().contains("##fileformat=VCFv4.2")} + { assert process.success }, + { assert snapshot( + process.out.versions, + path(process.out.vcf.get(0).get(1)).vcf.summary, + ).match() } + ) + } + + } + + test("genmod_score - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) + input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/genmod/svrank_model_-v1.8-.ini', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/genmod/score/tests/main.nf.test.snap b/modules/nf-core/genmod/score/tests/main.nf.test.snap new file mode 100644 index 00000000000..b484b8e12ae --- /dev/null +++ b/modules/nf-core/genmod/score/tests/main.nf.test.snap @@ -0,0 +1,50 @@ +{ + "genmod_score": { + "content": [ + [ + "versions.yml:md5,f310225b3c35456e84d52e2c400e2fd8" + ], + "VcfFile [chromosomes=[1], sampleCount=3, variantCount=57, phased=false, phasedAutodetect=false]" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:50:12.03483811" + }, + "genmod_score - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_score.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,f310225b3c35456e84d52e2c400e2fd8" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test_score.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,f310225b3c35456e84d52e2c400e2fd8" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T11:50:19.675962486" + } +} \ No newline at end of file From 2fd2cd6d0e7b273747f32e465fdc6bcc3ae0814e Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Mon, 28 Oct 2024 11:53:15 +0100 Subject: [PATCH 13/87] fails with lenient mode (#6865) --- subworkflows/nf-core/utils_nfschema_plugin/tests/main.nf.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subworkflows/nf-core/utils_nfschema_plugin/tests/main.nf.test b/subworkflows/nf-core/utils_nfschema_plugin/tests/main.nf.test index 842dc432af7..8fb30164876 100644 --- a/subworkflows/nf-core/utils_nfschema_plugin/tests/main.nf.test +++ b/subworkflows/nf-core/utils_nfschema_plugin/tests/main.nf.test @@ -42,7 +42,7 @@ nextflow_workflow { params { test_data = '' - outdir = 1 + outdir = null } workflow { @@ -94,7 +94,7 @@ nextflow_workflow { params { test_data = '' - outdir = 1 + outdir = null } workflow { From 2f04da318223fd982f8aa3d5546dabdf42afa4eb Mon Sep 17 00:00:00 2001 From: msantorsola Date: Mon, 28 Oct 2024 12:12:56 +0100 Subject: [PATCH 14/87] Happy (#6867) * fixing wrong happy parameter * fixing wrong happy parameter * fixing happy parameters --- modules/nf-core/happy/happy/main.nf | 2 +- modules/nf-core/happy/happy/tests/main.nf.test.snap | 6 +++--- modules/nf-core/happy/prepy/tests/main.nf.test.snap | 12 ++++++------ modules/nf-core/happy/sompy/main.nf | 2 +- modules/nf-core/happy/sompy/tests/main.nf.test.snap | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/nf-core/happy/happy/main.nf b/modules/nf-core/happy/happy/main.nf index a5757db0ee5..a883ce22537 100644 --- a/modules/nf-core/happy/happy/main.nf +++ b/modules/nf-core/happy/happy/main.nf @@ -36,7 +36,7 @@ process HAPPY_HAPPY { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def regions = regions_bed ? "-R ${regions_bed}" : "" + def regions = regions_bed ? "-f ${regions_bed}" : "" def targets = targets_bed ? "-T ${targets_bed}" : "" def false_positives = false_positives_bed ? "--false-positives ${false_positives_bed}" : "" def stratification = stratification_tsv ? "--stratification ${stratification_tsv}" : "" diff --git a/modules/nf-core/happy/happy/tests/main.nf.test.snap b/modules/nf-core/happy/happy/tests/main.nf.test.snap index 5c69e7ffe5b..75516dbdc70 100644 --- a/modules/nf-core/happy/happy/tests/main.nf.test.snap +++ b/modules/nf-core/happy/happy/tests/main.nf.test.snap @@ -24,7 +24,7 @@ { "id": "test" }, - "test.extended.csv:md5,4b53c835cd20fe0b14fcb4b2ef6b0f52" + "test.extended.csv:md5,5ec5e0b3a260ddcb53a2628871547d79" ] ], [ @@ -32,10 +32,10 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-08-19T14:11:48.021071904" + "timestamp": "2024-10-28T10:29:30.466331046" }, "versions_1": { "content": [ diff --git a/modules/nf-core/happy/prepy/tests/main.nf.test.snap b/modules/nf-core/happy/prepy/tests/main.nf.test.snap index f26077dfee4..ac355f9b9c0 100644 --- a/modules/nf-core/happy/prepy/tests/main.nf.test.snap +++ b/modules/nf-core/happy/prepy/tests/main.nf.test.snap @@ -13,10 +13,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.04.4" }, - "timestamp": "2024-03-13T15:12:58.950764084" + "timestamp": "2024-10-28T10:59:08.458181341" }, "preprocessed_vcf": { "content": [ @@ -56,10 +56,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.04.4" }, - "timestamp": "2024-03-13T14:54:02.152541068" + "timestamp": "2024-10-28T10:59:08.658379853" }, "stub_preprocessed_vcf": { "content": [ diff --git a/modules/nf-core/happy/sompy/main.nf b/modules/nf-core/happy/sompy/main.nf index ba23fd16765..a81639a2ca0 100644 --- a/modules/nf-core/happy/sompy/main.nf +++ b/modules/nf-core/happy/sompy/main.nf @@ -28,7 +28,7 @@ process HAPPY_SOMPY { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def regions = regions_bed ? "-R ${regions_bed}" : "" + def regions = regions_bed ? "-f ${regions_bed}" : "" def targets = targets_bed ? "-T ${targets_bed}" : "" def false_positives = false_positives_bed ? "--false-positives ${false_positives_bed}" : "" def ambiguous = ambiguous_beds ? "--ambiguous ${ambiguous_beds}" : "" diff --git a/modules/nf-core/happy/sompy/tests/main.nf.test.snap b/modules/nf-core/happy/sompy/tests/main.nf.test.snap index b6b25e6decf..e483f1cfe7f 100644 --- a/modules/nf-core/happy/sompy/tests/main.nf.test.snap +++ b/modules/nf-core/happy/sompy/tests/main.nf.test.snap @@ -6,7 +6,7 @@ { "id": "test" }, - "test.stats.csv:md5,8b35dd00bf7b5bd697a05d73fb8c0816" + "test.stats.csv:md5,0fa86a9726fcc3e2172342dd1305cf82" ] ], [ @@ -16,10 +16,10 @@ "test.features.csv" ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-08-26T08:56:57.589412212" + "timestamp": "2024-10-28T10:43:13.082233148" }, "homo_sapiens - vcf - bam": { "content": [ @@ -28,7 +28,7 @@ { "id": "test" }, - "test.stats.csv:md5,5e9aae3e92641f1934c10fe88f250e59" + "test.stats.csv:md5,2502fe315dcf32d00c9961b9462759aa" ] ], [ @@ -38,10 +38,10 @@ "test.features.csv" ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-08-26T08:57:13.752402851" + "timestamp": "2024-10-28T10:43:32.122793995" }, "homo_sapiens - vcf - stub": { "content": [ From fba537c95064a1ab27b1d82afcd3c876a5658b70 Mon Sep 17 00:00:00 2001 From: Meriam van Os <84883985+MeriamOs@users.noreply.github.com> Date: Mon, 28 Oct 2024 12:18:13 +0100 Subject: [PATCH 15/87] New module Sourcepredict (#6841) * added sourcepredict module * Update nextflow.config edited nextflow.config * Update main.nf.test Edited the test file * added test data for new sourcepredict module * edited sourcepredict files * fixed numba and ete3 * added test data location to test_data.config * changed paths to nf-core new test data * fixed whitspaces * fixed whitspaces * fixed prettier * Update modules/nf-core/sourcepredict/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/sourcepredict/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/sourcepredict/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/sourcepredict/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/sourcepredict/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/sourcepredict/tests/main.nf.test Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * fixed commits after first PR --------- Co-authored-by: Meriam van Os meriam.vanos@postgrad.otago.ac.nz Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/sourcepredict/environment.yml | 7 ++ modules/nf-core/sourcepredict/main.nf | 56 +++++++++++++ modules/nf-core/sourcepredict/meta.yml | 71 ++++++++++++++++ .../nf-core/sourcepredict/tests/main.nf.test | 80 +++++++++++++++++++ .../sourcepredict/tests/main.nf.test.snap | 68 ++++++++++++++++ .../sourcepredict/tests/nextflow.config | 5 ++ tests/config/test_data.config | 9 +++ 7 files changed, 296 insertions(+) create mode 100644 modules/nf-core/sourcepredict/environment.yml create mode 100644 modules/nf-core/sourcepredict/main.nf create mode 100644 modules/nf-core/sourcepredict/meta.yml create mode 100644 modules/nf-core/sourcepredict/tests/main.nf.test create mode 100644 modules/nf-core/sourcepredict/tests/main.nf.test.snap create mode 100644 modules/nf-core/sourcepredict/tests/nextflow.config diff --git a/modules/nf-core/sourcepredict/environment.yml b/modules/nf-core/sourcepredict/environment.yml new file mode 100644 index 00000000000..29ce8ea5cd7 --- /dev/null +++ b/modules/nf-core/sourcepredict/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::sourcepredict=0.5.1" diff --git a/modules/nf-core/sourcepredict/main.nf b/modules/nf-core/sourcepredict/main.nf new file mode 100644 index 00000000000..536cf087f54 --- /dev/null +++ b/modules/nf-core/sourcepredict/main.nf @@ -0,0 +1,56 @@ +process SOURCEPREDICT { + 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/sourcepredict:0.5.1--pyhdfd78af_0': + 'biocontainers/sourcepredict:0.5.1--pyhdfd78af_0' }" + + input: + tuple val(meta), path(kraken_parse) + path sources + path labels + path(taxa_sqlite, stageAs: '.etetoolkit/*') + path(taxa_sqlite_traverse_pkl, stageAs: '.etetoolkit/*') + + output: + tuple val(meta), path("*.sourcepredict.csv") , emit: report + 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}" + """ + export NUMBA_CACHE_DIR='./tmp' + export HOME='./' + + sourcepredict \\ + -s $sources \\ + -l $labels \\ + $args \\ + -t $task.cpus \\ + -o ${prefix}.sourcepredict.csv \\ + ${kraken_parse} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sourcepredict: \$(python -c "import sourcepredict; print(sourcepredict.__version__)") + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.sourcepredict.csv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sourcepredict: \$(python -c "import sourcepredict; print(sourcepredict.__version__)") + END_VERSIONS + """ +} diff --git a/modules/nf-core/sourcepredict/meta.yml b/modules/nf-core/sourcepredict/meta.yml new file mode 100644 index 00000000000..c0189969e76 --- /dev/null +++ b/modules/nf-core/sourcepredict/meta.yml @@ -0,0 +1,71 @@ +name: "sourcepredict" +description: Classifies and predicts the origin of metagenomic samples +keywords: + - source tracking + - metagenomics + - machine learning +tools: + - "sourcepredict": + description: "Classification and prediction of the origin of metagenomic samples." + homepage: "https://github.com/maxibor/sourcepredict" + documentation: "https://sourcepredict.readthedocs.io/en/latest/index.html" + tool_dev_url: "https://github.com/maxibor/sourcepredict" + doi: "10.21105/joss.01540" + licence: ["GPL v3-or-later"] + identifier: biotools:sourcepredict + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - kraken_parse: + type: file + description: Sink TAXID count table in csv format + pattern: "*.csv" + + - - sources: + type: file + description: Sources TAXID count table in csv format. Default can be downloaded from + https://raw.githubusercontent.com/maxibor/sourcepredict/master/data/modern_gut_microbiomes_sources.csv + pattern: "*.csv" + + - - labels: + type: file + description: Labels for the sources table in csv format. Default can be downloaded from + https://raw.githubusercontent.com/maxibor/sourcepredict/master/data/modern_gut_microbiomes_labels.csv + pattern: "*.csv" + + - - taxa_sqlite: + type: file + description: taxa.sqlite file downloaded with ete3 toolkit + pattern: "taxa.sqlite" + + - - taxa_sqlite_traverse_pkl: + type: file + description: taxa.sqlite.traverse.pkl file downloaded with ete3 toolkit + pattern: "taxa.sqlite.traverse.pkl" + +output: + - report: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.sourcepredict.csv": + type: file + description: Table containing the predicted proportion of each source in each sample + pattern: "*.sourcepredict.csv" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@MeriamOs" +maintainers: + - "@MeriamOs" diff --git a/modules/nf-core/sourcepredict/tests/main.nf.test b/modules/nf-core/sourcepredict/tests/main.nf.test new file mode 100644 index 00000000000..12b1479164f --- /dev/null +++ b/modules/nf-core/sourcepredict/tests/main.nf.test @@ -0,0 +1,80 @@ +nextflow_process { + + name "Test Process SOURCEPREDICT" + script "../main.nf" + process "SOURCEPREDICT" + config "./nextflow.config" + tag "modules" + tag "modules_nfcore" + tag "xz/decompress" + tag "sourcepredict" + + setup { + run("XZ_DECOMPRESS") { + script "../../xz/decompress/main.nf" + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/taxa_sqlite.xz', checkIfExists: true) + ]) + """ + } + } + } + + test("metagenome - csv") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sink_taxid.csv', checkIfExists: true), + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sources_taxid.csv', checkIfExists: true) + input[2] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sources_labels.csv', checkIfExists: true) + input[3] = XZ_DECOMPRESS.out.file.map{ it[1] } + input[4] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/taxa_sqlite_traverse.pkl', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("metagenome - csv - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sink_taxid.csv', checkIfExists: true), + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sources_taxid.csv', checkIfExists: true) + input[2] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/sources_labels.csv', checkIfExists: true) + input[3] = XZ_DECOMPRESS.out.file.map{ it[1] } + input[4] = file(params.modules_testdata_base_path + 'genomics/prokaryotes/metagenome/taxonomy/misc/taxa_sqlite_traverse.pkl', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/sourcepredict/tests/main.nf.test.snap b/modules/nf-core/sourcepredict/tests/main.nf.test.snap new file mode 100644 index 00000000000..2c4c73ca6c6 --- /dev/null +++ b/modules/nf-core/sourcepredict/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "metagenome - csv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.sourcepredict.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,d0e1400b2ad38aa0f76376e617a80015" + ], + "report": [ + [ + { + "id": "test" + }, + "test.sourcepredict.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d0e1400b2ad38aa0f76376e617a80015" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-28T10:34:52.530249987" + }, + "metagenome - csv": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.sourcepredict.csv:md5,fd90e16e7d7ce577d9b561afb1ebb24b" + ] + ], + "1": [ + "versions.yml:md5,d0e1400b2ad38aa0f76376e617a80015" + ], + "report": [ + [ + { + "id": "test" + }, + "test.sourcepredict.csv:md5,fd90e16e7d7ce577d9b561afb1ebb24b" + ] + ], + "versions": [ + "versions.yml:md5,d0e1400b2ad38aa0f76376e617a80015" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-28T10:34:21.413712277" + } +} \ No newline at end of file diff --git a/modules/nf-core/sourcepredict/tests/nextflow.config b/modules/nf-core/sourcepredict/tests/nextflow.config new file mode 100644 index 00000000000..976b5fd06b1 --- /dev/null +++ b/modules/nf-core/sourcepredict/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'SOURCEPREDICT' { + ext.args = '-me MDS' + } +} diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 852544d51f4..a03e334e56e 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -691,6 +691,15 @@ params { genome_aln_nwk = "${params.test_data_base}/data/genomics/prokaryotes/haemophilus_influenzae/genome/genome.aln.nwk" } } + 'metagenome' { + 'taxonomy' { + sink_taxid_csv = "${params.test_data_base}/data/genomics/prokaryotes/metagenome/taxonomy/misc/sink_taxid.csv" + sources_taxid_csv = "${params.test_data_base}/data/genomics/prokaryotes/metagenome/taxonomy/misc/sources_labels.csv" + sources_labels_csv = "${params.test_data_base}/data/genomics/prokaryotes/metagenome/taxonomy/misc/sources_taxid.csv" + taxa_sqlite = "${params.test_data_base}/data/genomics/prokaryotes/metagenome/taxonomy/misc/taxa_sqlite.xz" + taxa_sqlite_traverse_pkl = "${params.test_data_base}/data/genomics/prokaryotes/metagenome/taxonomy/misc/taxa_sqlite_traverse.pkl" + } + } 'saccharomyces_cerevisiae' { 'genome' { samplesheet = "${params.test_data_base}/data/genomics/eukaryotes/saccharomyces_cerevisiae/samplesheet.csv" From 1233c0744ab4a4b0db3028997ecaf5d485c11745 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:38:36 +0530 Subject: [PATCH 16/87] activate gitpod nextlow extension (#6869) --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 22c6ada3130..cc34f90f78b 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -13,6 +13,6 @@ vscode: - EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files - Gruntfuggly.todo-tree # Display TODO and FIXME in a tree view in the activity bar - mechatroner.rainbow-csv # Highlight columns in csv files in different colors - # - nextflow.nextflow # Nextflow syntax highlighting + - nextflow.nextflow # Nextflow syntax highlighting - oderwat.indent-rainbow # Highlight indentation level - streetsidesoftware.code-spell-checker # Spelling checker for source code From 4ac2ef5c1ceba6bb28a73033802643093fe923b3 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Tue, 29 Oct 2024 08:38:35 +0100 Subject: [PATCH 17/87] Add args2 and revert default output format back to vcf.gz for SVDB merge (#6858) * revert default output format back to vcf.gz * add args2 --- modules/nf-core/svdb/merge/main.nf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/svdb/merge/main.nf b/modules/nf-core/svdb/merge/main.nf index 5b19a299310..96d21eba910 100644 --- a/modules/nf-core/svdb/merge/main.nf +++ b/modules/nf-core/svdb/merge/main.nf @@ -59,7 +59,7 @@ process SVDB_MERGE { args2.contains("--output-type u") || args2.contains("-Ou") ? "bcf" : args2.contains("--output-type z") || args2.contains("-Oz") ? "vcf.gz" : args2.contains("--output-type v") || args2.contains("-Ov") ? "vcf" : - "vcf" + "vcf.gz" """ svdb \\ --merge \\ @@ -67,6 +67,7 @@ process SVDB_MERGE { $prio \\ --vcf $input |\\ bcftools view \\ + $args2 \\ --threads ${task.cpus} \\ --output ${prefix}.${extension} @@ -84,7 +85,7 @@ process SVDB_MERGE { args2.contains("--output-type u") || args2.contains("-Ou") ? "bcf" : args2.contains("--output-type z") || args2.contains("-Oz") ? "vcf.gz" : args2.contains("--output-type v") || args2.contains("-Ov") ? "vcf" : - "vcf" + "vcf.gz" def index = args2.contains("--write-index=tbi") || args2.contains("-W=tbi") ? "tbi" : args2.contains("--write-index=csi") || args2.contains("-W=csi") ? "csi" : args2.contains("--write-index") || args2.contains("-W") ? "csi" : From 21a84fbbaa559b64892b7cff687139effffa8222 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:25:30 +0530 Subject: [PATCH 18/87] fix fq2bammeth stub (#6880) fix stub --- modules/nf-core/parabricks/fq2bammeth/main.nf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/modules/nf-core/parabricks/fq2bammeth/main.nf b/modules/nf-core/parabricks/fq2bammeth/main.nf index dcad7cdcc3f..44f266604bd 100644 --- a/modules/nf-core/parabricks/fq2bammeth/main.nf +++ b/modules/nf-core/parabricks/fq2bammeth/main.nf @@ -35,7 +35,6 @@ process PARABRICKS_FQ2BAMMETH { def num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : '' """ ln -sf \$(readlink $fasta) $index/$fasta - pbrun \\ fq2bam_meth \\ --ref $index/$fasta \\ @@ -45,7 +44,6 @@ process PARABRICKS_FQ2BAMMETH { $known_sites_output \\ $num_gpus \\ $args - cat <<-END_VERSIONS > versions.yml "${task.process}": pbrun: \$(echo \$(pbrun version 2>&1) | sed 's/^Please.* //' ) @@ -59,19 +57,9 @@ process PARABRICKS_FQ2BAMMETH { } def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def in_fq_command = meta.single_end ? "--in-se-fq $reads" : "--in-fq $reads" - def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : "" - def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : "" - def metrics_output_command = args = "--out-duplicate-metrics duplicate-metrics.txt" ? "touch duplicate-metrics.txt" : "" - def known_sites_output_command = known_sites ? "touch ${prefix}.table" : "" - def qc_metrics_output_command = args = "--out-qc-metrics-dir qc_metrics " ? "mkdir qc_metrics && touch qc_metrics/alignment.txt" : "" """ touch ${prefix}.bam touch ${prefix}.bam.bai - $metrics_output_command - $known_sites_output_command - $qc_metrics_output_command - cat <<-END_VERSIONS > versions.yml "${task.process}": pbrun: \$(echo \$(pbrun version 2>&1) | sed 's/^Please.* //' ) From 56372688d8979092cafbe0c5c3895b491166ca1c Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:55:49 +0530 Subject: [PATCH 19/87] fix Should print version test assertion (#6887) --- .../tests/main.workflow.nf.test | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test index ca964ce8e1e..02dbf094cd8 100644 --- a/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test +++ b/subworkflows/nf-core/utils_nextflow_pipeline/tests/main.workflow.nf.test @@ -52,10 +52,12 @@ nextflow_workflow { } then { - assertAll( - { assert workflow.success }, - { assert workflow.stdout.contains("nextflow_workflow v9.9.9") } - ) + expect { + with(workflow) { + assert success + assert "nextflow_workflow v9.9.9" in stdout + } + } } } From 79a77abeff6ddae436b2e8385f877bcdf0dd2240 Mon Sep 17 00:00:00 2001 From: Kobe Lavaerts <77338340+kobelavaerts@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:02:04 +0100 Subject: [PATCH 20/87] mcstaging/phenoimager2mc update nf-test file staging (#6883) --- .../phenoimager2mc/tests/main.nf.test | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/mcstaging/phenoimager2mc/tests/main.nf.test b/modules/nf-core/mcstaging/phenoimager2mc/tests/main.nf.test index 2ed83e82cc8..c38eae2b05c 100644 --- a/modules/nf-core/mcstaging/phenoimager2mc/tests/main.nf.test +++ b/modules/nf-core/mcstaging/phenoimager2mc/tests/main.nf.test @@ -14,12 +14,19 @@ nextflow_process { when { process { """ + // stage input tif files in a folder + tmpdir = file("tmpdir", type: 'dir') + tmpdir.mkdir() + tif_file_1 = file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile1.tif', checkIfExists: true) + tif_file_2 = file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile2.tif', checkIfExists: true) + tif_file_1.copyTo(tmpdir) + tif_file_2.copyTo(tmpdir) + // define inputs of the process here. Example: input[0] = [ [ id:'test' ], [ - file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile1.tif', checkIfExists: true), - file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile2.tif', checkIfExists: true) + file(tmpdir, type:'dir', checkIfExists: true) ] ] """ @@ -42,12 +49,19 @@ test("phenoimager2mc - tif - stub") { when { process { """ + // stage input tif files in a folder + tmpdir = file("tmpdir", type: 'dir') + tmpdir.mkdir() + tif_file_1 = file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile1.tif', checkIfExists: true) + tif_file_2 = file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile2.tif', checkIfExists: true) + tif_file_1.copyTo(tmpdir) + tif_file_2.copyTo(tmpdir) + // define inputs of the process here. Example: input[0] = [ [ id:'test' ], [ - file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile1.tif', checkIfExists: true), - file(params.modules_testdata_base_path + 'imaging/staging/phenoimager/tile2.tif', checkIfExists: true) + file(tmpdir, type:'dir', checkIfExists: true) ] ] """ From e01435f46b46adff59546d6a4b4002e31f6c4457 Mon Sep 17 00:00:00 2001 From: Chao-Jen Wong Date: Tue, 29 Oct 2024 07:59:05 -0700 Subject: [PATCH 21/87] cellbender/removebackgroud: update cellbender version and include container image for gpu usage (#6868) * Update environment.yml * Update main.nf to include image for gpu usage * Update cellbander version from 0.3.0 to 0.3.2 * fixed trailing white space and remove name: cellbender_removebackground from environment.yml * remove main.nf.test.snap * added tests/main.nf.test.snap * remove -defaults from channel * add -defaults back to channels: * remove -defaults from channels again --- .../removebackground/environment.yml | 3 +- .../cellbender/removebackground/main.nf | 7 +-- .../removebackground/tests/main.nf.test.snap | 52 +++++++++---------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/modules/nf-core/cellbender/removebackground/environment.yml b/modules/nf-core/cellbender/removebackground/environment.yml index a157c522b2b..d6fb2687868 100644 --- a/modules/nf-core/cellbender/removebackground/environment.yml +++ b/modules/nf-core/cellbender/removebackground/environment.yml @@ -2,4 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::cellbender=0.3.0 + - bioconda::cellbender=0.3.2 + - conda-forge::webcolors=1.13 diff --git a/modules/nf-core/cellbender/removebackground/main.nf b/modules/nf-core/cellbender/removebackground/main.nf index f3cfd1ffee7..a2d25647749 100644 --- a/modules/nf-core/cellbender/removebackground/main.nf +++ b/modules/nf-core/cellbender/removebackground/main.nf @@ -4,9 +4,10 @@ process CELLBENDER_REMOVEBACKGROUND { label 'process_gpu' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'oras://community.wave.seqera.io/library/cellbender:0.3.0--c4addb97ab2d83fe': - 'community.wave.seqera.io/library/cellbender:0.3.0--41318a055fc3aacb' }" + container "${ task.ext.use_gpu ? 'us.gcr.io/broad-dsde-methods/cellbender:0.3.2' : + workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/cellbender_webcolors:25a137ec5e8341f2': + 'community.wave.seqera.io/library/cellbender_webcolors:9cfb55914fc5dcea' }" input: tuple val(meta), path(h5ad) diff --git a/modules/nf-core/cellbender/removebackground/tests/main.nf.test.snap b/modules/nf-core/cellbender/removebackground/tests/main.nf.test.snap index fdb51d66982..1355cf712f8 100644 --- a/modules/nf-core/cellbender/removebackground/tests/main.nf.test.snap +++ b/modules/nf-core/cellbender/removebackground/tests/main.nf.test.snap @@ -2,14 +2,14 @@ "cellbender_removebackground_versions": { "content": [ [ - "versions.yml:md5,b236ac7595dfa6cd4d51ac73e51cb05a" + "versions.yml:md5,53e48cca1f71828723220055334da62d" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:09.33127881" + "timestamp": "2024-10-29T00:16:40.640352416" }, "cellbender_removebackground_filtered_h5_stub": { "content": [ @@ -24,9 +24,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.833598082" + "timestamp": "2024-10-29T00:17:23.997873197" }, "cellbender_removebackground_pdf_stub": { "content": [ @@ -41,9 +41,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.891829278" + "timestamp": "2024-10-29T00:17:24.027411206" }, "cellbender_removebackground_metrics": { "content": [ @@ -58,21 +58,21 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:09.327155805" + "timestamp": "2024-10-29T00:16:40.635672235" }, "cellbender_removebackground_versions_stub": { "content": [ [ - "versions.yml:md5,b236ac7595dfa6cd4d51ac73e51cb05a" + "versions.yml:md5,53e48cca1f71828723220055334da62d" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.904614838" + "timestamp": "2024-10-29T00:17:24.043570388" }, "cellbender_removebackground_h5_stub": { "content": [ @@ -87,9 +87,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.829304361" + "timestamp": "2024-10-29T00:17:23.990494185" }, "cellbender_removebackground_metrics_stub": { "content": [ @@ -104,9 +104,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.870469733" + "timestamp": "2024-10-29T00:17:24.016273723" }, "cellbender_removebackground_log_stub": { "content": [ @@ -121,9 +121,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.899293304" + "timestamp": "2024-10-29T00:17:24.034871432" }, "cellbender_removebackground_barcodes": { "content": [ @@ -138,9 +138,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:09.316098811" + "timestamp": "2024-10-29T00:16:40.625893673" }, "cellbender_removebackground_report_stub": { "content": [ @@ -155,9 +155,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.885307244" + "timestamp": "2024-10-29T00:17:24.021659519" }, "cellbender_removebackground_posterior_h5_stub": { "content": [ @@ -172,9 +172,9 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.838032754" + "timestamp": "2024-10-29T00:17:24.002921726" }, "cellbender_removebackground_barcodes_stub": { "content": [ @@ -189,8 +189,8 @@ ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.3" + "nextflow": "24.04.4" }, - "timestamp": "2024-08-12T13:41:20.861284979" + "timestamp": "2024-10-29T00:17:24.010868521" } } \ No newline at end of file From 06fa1219e57fe1b2154e5ec966ddbff3e1c7daba Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Tue, 29 Oct 2024 17:37:07 +0100 Subject: [PATCH 22/87] Fix a join bug (#6899) * Fix a join bug * Exclude Conda from tests --- .github/workflows/test.yml | 2 ++ subworkflows/nf-core/fasta_newick_epang_gappa/main.nf | 2 +- .../nf-core/fasta_newick_epang_gappa/tests/main.nf.test | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d19d07ba69..c6c9ae459c5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -654,6 +654,8 @@ jobs: path: subworkflows/nf-core/fastq_align_bamcmp_bwa - profile: conda path: subworkflows/nf-core/fastq_align_bwa + - profile: conda + path: subworkflows/nf-core/fasta_newick_epang_gappa env: NXF_ANSI_LOG: false NFTEST_VER: "0.9.0" diff --git a/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf b/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf index b3d9d15e96a..28016014f94 100644 --- a/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf +++ b/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf @@ -139,7 +139,7 @@ workflow FASTA_NEWICK_EPANG_GAPPA { GAPPA_ASSIGN ( EPANG_PLACE.out.jplace .map { [ [ id:it[0].id ], it[1] ] } - .join( ch_pp_data.map { [ it.meta, it.data.taxonomy ] } ) + .join( ch_pp_data.map { [ [ id: it.meta.id ], it.data.taxonomy ] } ) ) ch_versions = ch_versions.mix(GAPPA_ASSIGN.out.versions) diff --git a/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test b/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test index edf1679ef59..619d90c256f 100644 --- a/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test +++ b/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test @@ -32,7 +32,7 @@ nextflow_workflow { """ input[0] = Channel.of( [ - meta: [ id: "hmmer" ], + meta: [ id: "hmmer", min_bitscore: 4 ], data: [ alignmethod: 'hmmer', queryseqfile: file("https://github.com/nf-core/test-datasets/raw/phyloplace/testdata/PF14720_3_sequences.faa", checkIfExists: true), From 3abde3de0970781e8e9aeec3cfeed759008a6ef4 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Wed, 30 Oct 2024 13:39:11 +0530 Subject: [PATCH 23/87] add tests for fq2bam (#6902) * add tests for fq2bam * Added tests for PE and stub * Fixed linting * Removed pytests --------- Co-authored-by: GallVp --- .github/workflows/test.yml | 6 + modules/nf-core/parabricks/fq2bam/main.nf | 37 ++-- modules/nf-core/parabricks/fq2bam/meta.yml | 11 +- .../parabricks/fq2bam/tests/main.nf.test | 174 +++++++++++++++ .../parabricks/fq2bam/tests/main.nf.test.snap | 172 +++++++++++++++ .../parabricks/fq2bam/tests/nextflow.config | 8 + tests/config/pytest_modules.yml | 3 - .../modules/nf-core/parabricks/fq2bam/main.nf | 191 ----------------- .../nf-core/parabricks/fq2bam/nextflow.config | 17 -- .../nf-core/parabricks/fq2bam/test.yml | 120 ----------- .../parabricks/fq2bam/test_GPU_config.txt | 22 -- .../parabricks/fq2bam/test_GPU_yml.txt | 201 ------------------ 12 files changed, 380 insertions(+), 582 deletions(-) create mode 100644 modules/nf-core/parabricks/fq2bam/tests/main.nf.test create mode 100644 modules/nf-core/parabricks/fq2bam/tests/main.nf.test.snap create mode 100644 modules/nf-core/parabricks/fq2bam/tests/nextflow.config delete mode 100644 tests/modules/nf-core/parabricks/fq2bam/main.nf delete mode 100644 tests/modules/nf-core/parabricks/fq2bam/nextflow.config delete mode 100644 tests/modules/nf-core/parabricks/fq2bam/test.yml delete mode 100644 tests/modules/nf-core/parabricks/fq2bam/test_GPU_config.txt delete mode 100644 tests/modules/nf-core/parabricks/fq2bam/test_GPU_yml.txt diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c6c9ae459c5..12d201a5d51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -644,6 +644,12 @@ jobs: path: modules/nf-core/parabricks/fq2bammeth - profile: singularity path: modules/nf-core/parabricks/fq2bammeth + - profile: conda + path: modules/nf-core/parabricks/fq2bam + - profile: docker_self_hosted + path: modules/nf-core/parabricks/fq2bam + - profile: singularity + path: modules/nf-core/parabricks/fq2bam - profile: conda path: subworkflows/nf-core/vcf_annotate_ensemblvep - profile: conda diff --git a/modules/nf-core/parabricks/fq2bam/main.nf b/modules/nf-core/parabricks/fq2bam/main.nf index dac03b34c87..a68a64bf948 100644 --- a/modules/nf-core/parabricks/fq2bam/main.nf +++ b/modules/nf-core/parabricks/fq2bam/main.nf @@ -2,21 +2,22 @@ process PARABRICKS_FQ2BAM { tag "$meta.id" label 'process_high' - container "nvcr.io/nvidia/clara/clara-parabricks:4.3.0-1" + container "nvcr.io/nvidia/clara/clara-parabricks:4.3.2-1" input: - tuple val(meta), path(reads), path(interval_file) + tuple val(meta), path(reads) tuple val(meta2), path(fasta) tuple val(meta3), path(index) - path known_sites + path(interval_file) + path(known_sites) output: - tuple val(meta), path("*.bam") , emit: bam - tuple val(meta), path("*.bai") , emit: bai - path "versions.yml" , emit: versions - path "qc_metrics", optional:true , emit: qc_metrics - path("*.table"), optional:true , emit: bqsr_table - path("duplicate-metrics.txt"), optional:true , emit: duplicate_metrics + tuple val(meta), path("*.bam") , emit: bam + tuple val(meta), path("*.bai") , emit: bai + path "versions.yml" , emit: versions + path "qc_metrics" , emit: qc_metrics , optional:true + path("*.table") , emit: bqsr_table , optional:true + path("duplicate-metrics.txt") , emit: duplicate_metrics , optional:true when: task.ext.when == null || task.ext.when @@ -32,21 +33,20 @@ process PARABRICKS_FQ2BAM { def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : "" def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : "" def interval_file_command = interval_file ? interval_file.collect{"--interval-file $it"}.join(' ') : "" + def num_gpus = task.accelerator ? "--num-gpus $task.accelerator.request" : '' """ - INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` - mv $fasta \$INDEX + cp $fasta \$INDEX pbrun \\ fq2bam \\ --ref \$INDEX \\ $in_fq_command \\ - --read-group-sm $meta.id \\ --out-bam ${prefix}.bam \\ $known_sites_command \\ $known_sites_output \\ $interval_file_command \\ - --num-gpus $task.accelerator.request \\ + $num_gpus \\ $args cat <<-END_VERSIONS > versions.yml @@ -62,19 +62,10 @@ process PARABRICKS_FQ2BAM { } def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def in_fq_command = meta.single_end ? "--in-se-fq $reads" : "--in-fq $reads" - def known_sites_command = known_sites ? known_sites.collect{"--knownSites $it"}.join(' ') : "" - def known_sites_output = known_sites ? "--out-recal-file ${prefix}.table" : "" - def interval_file_command = interval_file ? interval_file.collect{"--interval-file $it"}.join(' ') : "" - def metrics_output_command = args = "--out-duplicate-metrics duplicate-metrics.txt" ? "touch duplicate-metrics.txt" : "" - def known_sites_output_command = known_sites ? "touch ${prefix}.table" : "" - def qc_metrics_output_command = args = "--out-qc-metrics-dir qc_metrics " ? "mkdir qc_metrics && touch qc_metrics/alignment.txt" : "" """ touch ${prefix}.bam touch ${prefix}.bam.bai - $metrics_output_command - $known_sites_output_command - $qc_metrics_output_command + cat <<-END_VERSIONS > versions.yml "${task.process}": pbrun: \$(echo \$(pbrun version 2>&1) | sed 's/^Please.* //' ) diff --git a/modules/nf-core/parabricks/fq2bam/meta.yml b/modules/nf-core/parabricks/fq2bam/meta.yml index c86ff19aade..b1cae9c4fa4 100644 --- a/modules/nf-core/parabricks/fq2bam/meta.yml +++ b/modules/nf-core/parabricks/fq2bam/meta.yml @@ -24,11 +24,6 @@ input: type: file description: fastq.gz files pattern: "*.fastq.gz" - - interval_file: - type: file - description: (optional) file(s) containing genomic intervals for use in base - quality score recalibration (BQSR) - pattern: "*.{bed,interval_list,picard,list,intervals}" - - meta2: type: map description: | @@ -45,6 +40,11 @@ input: type: file description: reference BWA index pattern: "*.{amb,ann,bwt,pac,sa}" + - - interval_file: + type: file + description: (optional) file(s) containing genomic intervals for use in base + quality score recalibration (BQSR) + pattern: "*.{bed,interval_list,picard,list,intervals}" - - known_sites: type: file description: (optional) known sites file(s) for calculating BQSR. markdups must @@ -99,3 +99,4 @@ authors: maintainers: - "@bsiranosian" - "@adamrtalbot" + - "@gallvp" diff --git a/modules/nf-core/parabricks/fq2bam/tests/main.nf.test b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test new file mode 100644 index 00000000000..46d06322c32 --- /dev/null +++ b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test @@ -0,0 +1,174 @@ +nextflow_process { + + name "Test Process PARABRICKS_FQ2BAM" + script "../main.nf" + process "PARABRICKS_FQ2BAM" + config "./nextflow.config" + + tag "bwa/index" + tag "modules" + tag "parabricks/fq2bam" + tag "modules_nfcore" + tag "parabricks" + + setup { + run("BWA_INDEX") { + script "../../../bwa/index/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) + ]) + """ + } + } + + run("BWA_INDEX", alias: 'BWA_INDEX_PE') { + script "../../../bwa/index/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + """ + } + } + } + + test("SRR389222 - fastq - se") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [ + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) + ]) + input[2] = BWA_INDEX.out.index + input[3] = [] + input[4] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + file(process.out.bai[0][1]).name, + process.out.versions + ).match() } + ) + } + } + + test("SRR389222 - fastq - se - stub") { + options '-stub' + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [ + file('https://github.com/nf-core/test-datasets/raw/methylseq/testdata/SRR389222_sub1.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) + ]) + input[2] = BWA_INDEX.out.index + input[3] = [] + input[4] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 - fastq - pe") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BWA_INDEX_PE.out.index + input[3] = [] + input[4] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + file(process.out.bai[0][1]).name, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq - pe - stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BWA_INDEX_PE.out.index + input[3] = [] + input[4] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/parabricks/fq2bam/tests/main.nf.test.snap b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test.snap new file mode 100644 index 00000000000..50d96e78ffb --- /dev/null +++ b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test.snap @@ -0,0 +1,172 @@ +{ + "SRR389222 - fastq - se - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "bai": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bqsr_table": [ + + ], + "duplicate_metrics": [ + + ], + "qc_metrics": [ + + ], + "versions": [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T00:20:56.208782" + }, + "sarscov2 - fastq - pe - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "bai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bqsr_table": [ + + ], + "duplicate_metrics": [ + + ], + "qc_metrics": [ + + ], + "versions": [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T00:35:07.267293" + }, + "sarscov2 - fastq - pe": { + "content": [ + "2d64e4363d9f3c0e2167fce49d5087cf", + "test.bam.bai", + [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T00:30:39.910679" + }, + "SRR389222 - fastq - se": { + "content": [ + "3d5b94990c7fdf90a682edb5ee0f59de", + "test.bam.bai", + [ + "versions.yml:md5,c054e8254095319b660a92bdc07d990f" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T00:22:15.94157" + } +} \ No newline at end of file diff --git a/modules/nf-core/parabricks/fq2bam/tests/nextflow.config b/modules/nf-core/parabricks/fq2bam/tests/nextflow.config new file mode 100644 index 00000000000..507305cbf69 --- /dev/null +++ b/modules/nf-core/parabricks/fq2bam/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + withName: 'PARABRICKS_FQ2BAM' { + ext.args = '--low-memory' + } + // Ref: https://forums.developer.nvidia.com/t/problem-with-gpu/256825/6 + // Parabricks’s fq2bam requires 24GB of memory. + // Using --low-memory for testing +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index cb62c33fbe0..0bf3c88fbc6 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -476,9 +476,6 @@ parabricks/dbsnp: parabricks/deepvariant: - modules/nf-core/parabricks/deepvariant/** - tests/modules/nf-core/parabricks/deepvariant/** -parabricks/fq2bam: - - modules/nf-core/parabricks/fq2bam/** - - tests/modules/nf-core/parabricks/fq2bam/** parabricks/genotypegvcf: - modules/nf-core/parabricks/genotypegvcf/** - tests/modules/nf-core/parabricks/genotypegvcf/** diff --git a/tests/modules/nf-core/parabricks/fq2bam/main.nf b/tests/modules/nf-core/parabricks/fq2bam/main.nf deleted file mode 100644 index da33475ad79..00000000000 --- a/tests/modules/nf-core/parabricks/fq2bam/main.nf +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { PARABRICKS_FQ2BAM } from '../../../../../modules/nf-core/parabricks/fq2bam/main.nf' -include { PARABRICKS_FQ2BAM as PARABRICKS_FQ2BAM_MKDUP_NOQC } from '../../../../../modules/nf-core/parabricks/fq2bam/main.nf' -include { PARABRICKS_FQ2BAM as PARABRICKS_FQ2BAM_NOMKDUP_NOQC } from '../../../../../modules/nf-core/parabricks/fq2bam/main.nf' -include { PARABRICKS_FQ2BAM as PARABRICKS_FQ2BAM_MKDUP_QC } from '../../../../../modules/nf-core/parabricks/fq2bam/main.nf' -include { PARABRICKS_FQ2BAM as PARABRICKS_FQ2BAM_NOMKDUP_QC } from '../../../../../modules/nf-core/parabricks/fq2bam/main.nf' -include { BWA_INDEX } from '../../../../../modules/nf-core/bwa/index/main.nf' - -workflow test_parabricks_fq2bam_pe_default { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) - -} - -workflow test_parabricks_fq2bam_se_default { - - input = [ - [ id:'test', single_end:true], - [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)], - [] - ] - - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - - - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) -} - -workflow test_parabricks_fq2bam_pe_mkdup_noqc { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM_MKDUP_NOQC ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) -} - -workflow test_parabricks_fq2bam_pe_nomkdup_noqc { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM_NOMKDUP_NOQC ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) -} - -workflow test_parabricks_fq2bam_pe_mkdup_qc { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM_MKDUP_QC ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) -} - -workflow test_parabricks_fq2bam_pe_nomkdup_qc { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM_NOMKDUP_QC ( input, fasta, BWA_INDEX.out.index, known_sites=[] ) -} - -workflow test_parabricks_fq2bam_pe_bqsr { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - known_sites = [ - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true) - ] - - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM ( input, fasta, BWA_INDEX.out.index, known_sites=known_sites ) -} - -workflow test_parabricks_fq2bam_pe_bqsr2 { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - known_sites = [ - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true) - ] - - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM ( input, fasta, BWA_INDEX.out.index, known_sites=known_sites ) -} - - -workflow test_parabricks_fq2bam_pe_bqsr_intervals { - - input = [ - [ id:'test', single_end:false], - [ - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) - ], - [ - file(params.test_data['sarscov2']['genome']['baits_interval_list'], checkIfExists: true), - file(params.test_data['sarscov2']['genome']['targets_interval_list'], checkIfExists: true) - ] - ] - fasta = [ - [id: 'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - ] - known_sites = [ - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test2_vcf_gz'], checkIfExists: true) - ] - - BWA_INDEX ( fasta ) - PARABRICKS_FQ2BAM ( input, fasta, BWA_INDEX.out.index, known_sites=known_sites ) -} \ No newline at end of file diff --git a/tests/modules/nf-core/parabricks/fq2bam/nextflow.config b/tests/modules/nf-core/parabricks/fq2bam/nextflow.config deleted file mode 100644 index 09b089b7fee..00000000000 --- a/tests/modules/nf-core/parabricks/fq2bam/nextflow.config +++ /dev/null @@ -1,17 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: PARABRICKS_FQ2BAM_MKDUP_NOQC { - ext.args = "--out-duplicate-metrics duplicate-metrics.txt" - } - withName: PARABRICKS_FQ2BAM_NOMKDUP_NOQC { - ext.args = "--no-markdups" - } - withName: PARABRICKS_FQ2BAM_MKDUP_QC { - ext.args = "--out-duplicate-metrics duplicate-metrics.txt --out-qc-metrics-dir qc_metrics" - } - withName: PARABRICKS_FQ2BAM_NOMKDUP_QC { - ext.args = "--no-markdups --out-qc-metrics-dir qc_metrics" - } -} diff --git a/tests/modules/nf-core/parabricks/fq2bam/test.yml b/tests/modules/nf-core/parabricks/fq2bam/test.yml deleted file mode 100644 index c6818b67aae..00000000000 --- a/tests/modules/nf-core/parabricks/fq2bam/test.yml +++ /dev/null @@ -1,120 +0,0 @@ -- name: parabricks fq2bam test_parabricks_fq2bam_pe_default - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_default -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_se_default - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_se_default -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_mkdup_noqc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_mkdup_noqc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/duplicate-metrics.txt - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_nomkdup_noqc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_nomkdup_noqc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_mkdup_qc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_mkdup_qc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/qc_metrics/alignment.txt - should_exist: true - - path: output/parabricks/duplicate-metrics.txt - should_exist: true - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_nomkdup_qc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_nomkdup_qc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/qc_metrics/alignment.txt - should_exist: true - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr2 - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr2 -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr_intervals - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr_intervals -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config -stub-run - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - should_exist: true diff --git a/tests/modules/nf-core/parabricks/fq2bam/test_GPU_config.txt b/tests/modules/nf-core/parabricks/fq2bam/test_GPU_config.txt deleted file mode 100644 index 91609e89818..00000000000 --- a/tests/modules/nf-core/parabricks/fq2bam/test_GPU_config.txt +++ /dev/null @@ -1,22 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - memory = "15.GB" - cpus = 4 - accelerator = 1 - - withName: PARABRICKS_FQ2BAM_MKDUP_NOQC { - ext.args = "--out-duplicate-metrics duplicate-metrics.txt" - } - withName: PARABRICKS_FQ2BAM_NOMKDUP_NOQC { - ext.args = "--no-markdups" - } - withName: PARABRICKS_FQ2BAM_MKDUP_QC { - ext.args = "--out-duplicate-metrics duplicate-metrics.txt --out-qc-metrics-dir qc_metrics" - } - withName: PARABRICKS_FQ2BAM_NOMKDUP_QC { - ext.args = "--no-markdups --out-qc-metrics-dir qc_metrics" - } -} -docker.runOptions = "--gpus all" -singularity.runOptions = "--nv" diff --git a/tests/modules/nf-core/parabricks/fq2bam/test_GPU_yml.txt b/tests/modules/nf-core/parabricks/fq2bam/test_GPU_yml.txt deleted file mode 100644 index 335f229bd9c..00000000000 --- a/tests/modules/nf-core/parabricks/fq2bam/test_GPU_yml.txt +++ /dev/null @@ -1,201 +0,0 @@ -- name: parabricks fq2bam test_parabricks_fq2bam_pe_default - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_default -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_se_default - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_se_default -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_mkdup_noqc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_mkdup_noqc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/duplicate-metrics.txt - md5sum: e3bd79a85934aaf66d76ea02958a0364 - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_nomkdup_noqc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_nomkdup_noqc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_mkdup_qc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_mkdup_qc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/qc_metrics/alignment.txt - md5sum: 7460720019995fdf8958694e5e2dfbd4 - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.pdf - should_exist: true - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.png - should_exist: true - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.txt - md5sum: 409ca5a736a1c86d56f151c3524b8474 - - path: output/parabricks/qc_metrics/gcbias.pdf - should_exist: true - - path: output/parabricks/qc_metrics/gcbias_0.png - md5sum: 954e493ba19ae4bc54f1d72b6b894285 - - path: output/parabricks/qc_metrics/gcbias_detail.txt - md5sum: 2163a0e9de9efcf89178449634080d3f - - path: output/parabricks/qc_metrics/gcbias_summary.txt - md5sum: 40cf804e365489f79e09b04332e5a1da - - path: output/parabricks/qc_metrics/insert_size.txt - md5sum: ce5a32ab105d243d6bdea366dfafa351 - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.pdf - should_exist: true - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.png - should_exist: true - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.txt - md5sum: 19589f6c86ddfe06e697a9e84cf2e3df - - path: output/parabricks/qc_metrics/quality_yield.txt - md5sum: 2a717db9042292f75d84d813ac09f4c8 - - path: output/parabricks/qc_metrics/qualityscore.pdf - should_exist: true - - path: output/parabricks/qc_metrics/qualityscore.png - should_exist: true - - path: output/parabricks/qc_metrics/qualityscore.txt - md5sum: 506888848039f7ee1522dcce83e3af10 - - path: output/parabricks/qc_metrics/sequencingArtifact.bait_bias_detail_metrics.txt - md5sum: fcb8b49e23ed4c699df29012c5b67728 - - path: output/parabricks/qc_metrics/sequencingArtifact.bait_bias_summary_metrics.txt - md5sum: 2a0604289493cab71828bf1e674d2b26 - - path: output/parabricks/qc_metrics/sequencingArtifact.error_summary_metrics.txt - md5sum: cbb7fe776495a7ecde26f738d05951ce - - path: output/parabricks/qc_metrics/sequencingArtifact.pre_adapter_detail_metrics.txt - md5sum: 459fe6aae4a74ea7bab63c70c675559e - - path: output/parabricks/qc_metrics/sequencingArtifact.pre_adapter_summary_metrics.txt - md5sum: b133062d9230ae664e71c5a462dc291c - - path: output/parabricks/duplicate-metrics.txt - md5sum: e3bd79a85934aaf66d76ea02958a0364 - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_nomkdup_qc - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_nomkdup_qc -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/qc_metrics/alignment.txt - md5sum: 7460720019995fdf8958694e5e2dfbd4 - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.pdf - should_exist: true - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.png - should_exist: true - - path: output/parabricks/qc_metrics/base_distribution_by_cycle.txt - md5sum: 409ca5a736a1c86d56f151c3524b8474 - - path: output/parabricks/qc_metrics/gcbias.pdf - should_exist: true - - path: output/parabricks/qc_metrics/gcbias_0.png - md5sum: 954e493ba19ae4bc54f1d72b6b894285 - - path: output/parabricks/qc_metrics/gcbias_detail.txt - md5sum: 2163a0e9de9efcf89178449634080d3f - - path: output/parabricks/qc_metrics/gcbias_summary.txt - md5sum: 40cf804e365489f79e09b04332e5a1da - - path: output/parabricks/qc_metrics/insert_size.txt - md5sum: ce5a32ab105d243d6bdea366dfafa351 - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.pdf - should_exist: true - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.png - should_exist: true - - path: output/parabricks/qc_metrics/mean_quality_by_cycle.txt - md5sum: 19589f6c86ddfe06e697a9e84cf2e3df - - path: output/parabricks/qc_metrics/quality_yield.txt - md5sum: 2a717db9042292f75d84d813ac09f4c8 - - path: output/parabricks/qc_metrics/qualityscore.pdf - should_exist: true - - path: output/parabricks/qc_metrics/qualityscore.png - should_exist: true - - path: output/parabricks/qc_metrics/qualityscore.txt - md5sum: 506888848039f7ee1522dcce83e3af10 - - path: output/parabricks/qc_metrics/sequencingArtifact.bait_bias_detail_metrics.txt - md5sum: fcb8b49e23ed4c699df29012c5b67728 - - path: output/parabricks/qc_metrics/sequencingArtifact.bait_bias_summary_metrics.txt - md5sum: 2a0604289493cab71828bf1e674d2b26 - - path: output/parabricks/qc_metrics/sequencingArtifact.error_summary_metrics.txt - md5sum: cbb7fe776495a7ecde26f738d05951ce - - path: output/parabricks/qc_metrics/sequencingArtifact.pre_adapter_detail_metrics.txt - md5sum: 459fe6aae4a74ea7bab63c70c675559e - - path: output/parabricks/qc_metrics/sequencingArtifact.pre_adapter_summary_metrics.txt - md5sum: b133062d9230ae664e71c5a462dc291c - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - md5sum: a63b35267493ab63ae58c348caaaf28f - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr2 - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr2 -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - md5sum: a63b35267493ab63ae58c348caaaf28f - - path: output/parabricks/versions.yml - -- name: parabricks fq2bam test_parabricks_fq2bam_pe_bqsr_intervals - command: nextflow run ./tests/modules/nf-core/parabricks/fq2bam -entry test_parabricks_fq2bam_pe_bqsr_intervals -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/parabricks/fq2bam/nextflow.config - tags: - - parabricks/fq2bam - - parabricks - files: - - path: output/parabricks/test.bam - should_exist: true - - path: output/parabricks/test.bam.bai - should_exist: true - - path: output/parabricks/test.table - md5sum: f703648007481982782952c040137594 - - path: output/parabricks/versions.yml From adf071fbc2235ee4ef5789aa77410c976d1e94e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Famke=20B=C3=A4uerle?= <45968370+famosab@users.noreply.github.com> Date: Wed, 30 Oct 2024 11:26:14 +0100 Subject: [PATCH 24/87] adjust io of fq2bam to be consistent (#6906) * adjust io to be consistent * adjust meta to be consistent * fix meta --- modules/nf-core/parabricks/fq2bam/main.nf | 4 ++-- modules/nf-core/parabricks/fq2bam/meta.yml | 23 +++++++++++++------ .../parabricks/fq2bam/tests/main.nf.test | 8 +++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/modules/nf-core/parabricks/fq2bam/main.nf b/modules/nf-core/parabricks/fq2bam/main.nf index a68a64bf948..c1877bdf468 100644 --- a/modules/nf-core/parabricks/fq2bam/main.nf +++ b/modules/nf-core/parabricks/fq2bam/main.nf @@ -8,15 +8,15 @@ process PARABRICKS_FQ2BAM { tuple val(meta), path(reads) tuple val(meta2), path(fasta) tuple val(meta3), path(index) - path(interval_file) + tuple val(meta4), path(interval_file) path(known_sites) output: tuple val(meta), path("*.bam") , emit: bam tuple val(meta), path("*.bai") , emit: bai + tuple val(meta), path("*.table"), emit: bqsr_table , optional:true path "versions.yml" , emit: versions path "qc_metrics" , emit: qc_metrics , optional:true - path("*.table") , emit: bqsr_table , optional:true path("duplicate-metrics.txt") , emit: duplicate_metrics , optional:true when: diff --git a/modules/nf-core/parabricks/fq2bam/meta.yml b/modules/nf-core/parabricks/fq2bam/meta.yml index b1cae9c4fa4..b3e2e7e6ee6 100644 --- a/modules/nf-core/parabricks/fq2bam/meta.yml +++ b/modules/nf-core/parabricks/fq2bam/meta.yml @@ -40,7 +40,11 @@ input: type: file description: reference BWA index pattern: "*.{amb,ann,bwt,pac,sa}" - - - interval_file: + - - meta4: + type: map + description: | + Groovy Map containing index information + - interval_file: type: file description: (optional) file(s) containing genomic intervals for use in base quality score recalibration (BQSR) @@ -71,6 +75,17 @@ output: type: file description: index corresponding to sorted BAM file pattern: "*.bai" + - bqsr_table: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test'] + - "*.table": + type: file + description: (optional) table from base quality score recalibration calculation, + to be used with parabricks/applybqsr + pattern: "*.table" - versions: - versions.yml: type: file @@ -81,12 +96,6 @@ output: type: directory description: (optional) optional directory of qc metrics pattern: "qc_metrics" - - bqsr_table: - - "*.table": - type: file - description: (optional) table from base quality score recalibration calculation, - to be used with parabricks/applybqsr - pattern: "*.table" - duplicate_metrics: - duplicate-metrics.txt: type: file diff --git a/modules/nf-core/parabricks/fq2bam/tests/main.nf.test b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test index 46d06322c32..8e4adb2966c 100644 --- a/modules/nf-core/parabricks/fq2bam/tests/main.nf.test +++ b/modules/nf-core/parabricks/fq2bam/tests/main.nf.test @@ -53,7 +53,7 @@ nextflow_process { file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) ]) input[2] = BWA_INDEX.out.index - input[3] = [] + input[3] = [ [], [] ] input[4] = [] """ } @@ -88,7 +88,7 @@ nextflow_process { file('https://github.com/nf-core/test-datasets/raw/methylseq/reference/genome.fa', checkIfExists: true) ]) input[2] = BWA_INDEX.out.index - input[3] = [] + input[3] = [ [], [] ] input[4] = [] """ } @@ -119,7 +119,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]) input[2] = BWA_INDEX_PE.out.index - input[3] = [] + input[3] = [ [], [] ] input[4] = [] """ } @@ -156,7 +156,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]) input[2] = BWA_INDEX_PE.out.index - input[3] = [] + input[3] = [ [], [] ] input[4] = [] """ } From bcf36bc95e3e5605e9859b8e9a49648841e04fe8 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:01:15 +0100 Subject: [PATCH 25/87] Add regions bed and nf-test to glnexus (#6888) Add regions and nf-test to glnexus Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/glnexus/main.nf | 5 +- modules/nf-core/glnexus/meta.yml | 9 ++ modules/nf-core/glnexus/tests/main.nf.test | 97 +++++++++++++++++ .../nf-core/glnexus/tests/main.nf.test.snap | 101 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/glnexus/main.nf | 17 --- tests/modules/nf-core/glnexus/nextflow.config | 5 - tests/modules/nf-core/glnexus/test.yml | 7 -- 8 files changed, 211 insertions(+), 33 deletions(-) create mode 100644 modules/nf-core/glnexus/tests/main.nf.test create mode 100644 modules/nf-core/glnexus/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/glnexus/main.nf delete mode 100644 tests/modules/nf-core/glnexus/nextflow.config delete mode 100644 tests/modules/nf-core/glnexus/test.yml diff --git a/modules/nf-core/glnexus/main.nf b/modules/nf-core/glnexus/main.nf index eb86b9b8d9c..191f04995df 100644 --- a/modules/nf-core/glnexus/main.nf +++ b/modules/nf-core/glnexus/main.nf @@ -1,6 +1,6 @@ process GLNEXUS { tag "$meta.id" - label 'process_medium' + label 'process_high' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? @@ -9,6 +9,7 @@ process GLNEXUS { input: tuple val(meta), path(gvcfs) + tuple val(meta2), path(bed) output: tuple val(meta), path("*.bcf"), emit: bcf @@ -20,6 +21,7 @@ process GLNEXUS { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def regions = bed ? "--bed ${bed}" : "" // Make list of GVCFs to merge def input = gvcfs.collect { it.toString() } @@ -33,6 +35,7 @@ process GLNEXUS { glnexus_cli \\ --threads $task.cpus \\ --mem-gbytes $avail_mem \\ + $regions \\ $args \\ ${input.join(' ')} \\ > ${prefix}.bcf diff --git a/modules/nf-core/glnexus/meta.yml b/modules/nf-core/glnexus/meta.yml index a79fc63cff3..8f18bf3f871 100644 --- a/modules/nf-core/glnexus/meta.yml +++ b/modules/nf-core/glnexus/meta.yml @@ -23,6 +23,15 @@ input: type: list description: Input genomic vcf files pattern: "*.{gvcf,gvcf.gz,g.vcf,g.vcf.gz}" + - - meta2: + type: map + description: | + Groovy Map containing regions information + e.g. [ id:'test' ] + - bed: + type: list + description: Input BED file + pattern: "*.bed" output: - bcf: - meta: diff --git a/modules/nf-core/glnexus/tests/main.nf.test b/modules/nf-core/glnexus/tests/main.nf.test new file mode 100644 index 00000000000..79f7adc868d --- /dev/null +++ b/modules/nf-core/glnexus/tests/main.nf.test @@ -0,0 +1,97 @@ +nextflow_process { + + name "Test Process GLNEXUS" + script "../main.nf" + process "GLNEXUS" + + tag "modules" + tag "modules_nfcore" + tag "glnexus" + + test("vcfs, []") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [[],[]] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("vcfs, bed") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [ + [ id:'region' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("vcfs, bed - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test.genome.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/gvcf/test2.genome.vcf.gz', checkIfExists: true), + ] + ]) + input[1] = [ + [ id:'region' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.bed', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/glnexus/tests/main.nf.test.snap b/modules/nf-core/glnexus/tests/main.nf.test.snap new file mode 100644 index 00000000000..3d2e13f09d9 --- /dev/null +++ b/modules/nf-core/glnexus/tests/main.nf.test.snap @@ -0,0 +1,101 @@ +{ + "vcfs, bed - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:17:01.253378301" + }, + "vcfs, bed": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:16:53.859544065" + }, + "vcfs, []": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "1": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ], + "bcf": [ + [ + { + "id": "test" + }, + "test.bcf:md5,62b2cea9c1b92ac63645cb031eea46fc" + ] + ], + "versions": [ + "versions.yml:md5,dfeeb7f12f37cbef54a798614b83ffb0" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T12:13:03.068397129" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 0bf3c88fbc6..832f747e594 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -263,9 +263,6 @@ gfastats: gget/gget: - modules/nf-core/gget/gget/** - tests/modules/nf-core/gget/gget/** -glnexus: - - modules/nf-core/glnexus/** - - tests/modules/nf-core/glnexus/** gprofiler2/gost: - modules/nf-core/gprofiler2/gost/** - tests/modules/nf-core/gprofiler2/gost/** diff --git a/tests/modules/nf-core/glnexus/main.nf b/tests/modules/nf-core/glnexus/main.nf deleted file mode 100644 index 86debecc4ab..00000000000 --- a/tests/modules/nf-core/glnexus/main.nf +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GLNEXUS } from '../../../../modules/nf-core/glnexus/main.nf' - -workflow test_glnexus { - input = [ - [ id:'test' ], // meta map - [ - file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test2_genome_vcf_gz'], checkIfExists: true) - ] - ] - - GLNEXUS ( input ) -} diff --git a/tests/modules/nf-core/glnexus/nextflow.config b/tests/modules/nf-core/glnexus/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/glnexus/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/glnexus/test.yml b/tests/modules/nf-core/glnexus/test.yml deleted file mode 100644 index b8ed6751541..00000000000 --- a/tests/modules/nf-core/glnexus/test.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: glnexus test_glnexus - command: nextflow run ./tests/modules/nf-core/glnexus -entry test_glnexus -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glnexus/nextflow.config - tags: - - glnexus - files: - - path: output/glnexus/test.bcf - md5sum: 62b2cea9c1b92ac63645cb031eea46fc From cab0b8fdc4f785810f49423d8141a0773c21eb3b Mon Sep 17 00:00:00 2001 From: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:42:22 +0100 Subject: [PATCH 26/87] Add FASTQE module (#6914) * Add FASTQE module * fix linting * Fix FASTQE * FASTQE: static version in test * Update modules/nf-core/fastqe/meta.yml Co-authored-by: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> --------- Co-authored-by: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> --- modules/nf-core/fastqe/environment.yml | 7 + modules/nf-core/fastqe/main.nf | 48 ++++++ modules/nf-core/fastqe/meta.yml | 50 ++++++ modules/nf-core/fastqe/tests/main.nf.test | 100 ++++++++++++ .../nf-core/fastqe/tests/main.nf.test.snap | 142 ++++++++++++++++++ 5 files changed, 347 insertions(+) create mode 100644 modules/nf-core/fastqe/environment.yml create mode 100644 modules/nf-core/fastqe/main.nf create mode 100644 modules/nf-core/fastqe/meta.yml create mode 100644 modules/nf-core/fastqe/tests/main.nf.test create mode 100644 modules/nf-core/fastqe/tests/main.nf.test.snap diff --git a/modules/nf-core/fastqe/environment.yml b/modules/nf-core/fastqe/environment.yml new file mode 100644 index 00000000000..0b98f6fc33b --- /dev/null +++ b/modules/nf-core/fastqe/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::fastqe=0.3.3" diff --git a/modules/nf-core/fastqe/main.nf b/modules/nf-core/fastqe/main.nf new file mode 100644 index 00000000000..05f40ccf40b --- /dev/null +++ b/modules/nf-core/fastqe/main.nf @@ -0,0 +1,48 @@ +process FASTQE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/fastqe:0.3.3--pyhdfd78af_0': + 'biocontainers/fastqe:0.3.3--pyhdfd78af_0' }" + + input: + tuple val(meta), path(fastq) + + output: + tuple val(meta), path("*.tsv"), emit: tsv + 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}" + def VERSION = '0.3.3' + """ + fastqe \\ + $args \\ + $fastq \\ + --output ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastqe: $VERSION + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = '0.3.3' + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastqe: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/fastqe/meta.yml b/modules/nf-core/fastqe/meta.yml new file mode 100644 index 00000000000..e34c109e93f --- /dev/null +++ b/modules/nf-core/fastqe/meta.yml @@ -0,0 +1,50 @@ +name: "fastqe" +description: fastqe is a bioinformatics command line tool that uses emojis to represent and analyze genomic data. +keywords: + - quality control + - fastq + - emoji + - visualization +tools: + - fastqe: + description: "A tool for visualizing FASTQ file quality using emoji" + homepage: "https://github.com/fastqe/fastqe" + documentation: "https://github.com/fastqe/fastqe#readme" + tool_dev_url: "https://github.com/fastqe/fastqe" + doi: "10.21105/joss.02400" + licence: ["MIT"] + identifier: "biotools:fastqe" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fastq: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + +output: + - tsv: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.tsv": + type: file + description: Text file containing emoji + pattern: "*.tsv" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@adamrtalbot" +maintainers: + - "@adamrtalbot" diff --git a/modules/nf-core/fastqe/tests/main.nf.test b/modules/nf-core/fastqe/tests/main.nf.test new file mode 100644 index 00000000000..1fee9ed23bd --- /dev/null +++ b/modules/nf-core/fastqe/tests/main.nf.test @@ -0,0 +1,100 @@ +// nf-core modules test fastqe +nextflow_process { + + name "Test Process FASTQE" + script "../main.nf" + process "FASTQE" + + tag "modules" + tag "modules_nfcore" + tag "fastqe" + + test("sarscov2 single-end [fastq]") { + + when { + process { + """ + input[0] = Channel.of([ + [ id: 'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 paired-end [fastq]") { + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 single-end [fastq] - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [ id: 'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 paired-end [fastq] - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/fastqe/tests/main.nf.test.snap b/modules/nf-core/fastqe/tests/main.nf.test.snap new file mode 100644 index 00000000000..195bafb0c49 --- /dev/null +++ b/modules/nf-core/fastqe/tests/main.nf.test.snap @@ -0,0 +1,142 @@ +{ + "sarscov2 single-end [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": true + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T10:18:03.83777" + }, + "sarscov2 paired-end [fastq]": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,aceceddba6e4b5a968d54a6db46238da" + ] + ], + "1": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,aceceddba6e4b5a968d54a6db46238da" + ] + ], + "versions": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T10:16:30.591658" + }, + "sarscov2 paired-end [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T10:18:09.501789" + }, + "sarscov2 single-end [fastq]": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.tsv:md5,16d66ef19b5f2694aaeae9c3727c3a61" + ] + ], + "1": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ], + "tsv": [ + [ + { + "id": "test", + "single_end": true + }, + "test.tsv:md5,16d66ef19b5f2694aaeae9c3727c3a61" + ] + ], + "versions": [ + "versions.yml:md5,dbbf45cfa1fab97d81e8de840958233b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T10:16:23.822551" + } +} \ No newline at end of file From 7f3ea5df279fa051bec9bade1798a58ba35b1196 Mon Sep 17 00:00:00 2001 From: tanyasarkjain <67300971+tanyasarkjain@users.noreply.github.com> Date: Thu, 31 Oct 2024 04:48:56 -0700 Subject: [PATCH 27/87] pbmm2/align (#6903) * pbsv * [automated] Fix linting with Prettier * version of pbsv module where all the tests pass * getting rid of un-need comments * updated: * changed website: * update * deleting accidental file * small tweak * updating the meta description * pretty * removing trailing space * space * newline * should pass version test * changed pbsv to pbsv/discover - seperating functionality * module pbmm2 * removing pbsv because this specific PR is for pbmm2 only * updating to allow for threading * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * resolving comments * fixing the meta to match update --------- Co-authored-by: nf-core-bot Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/pbmm2/align/environment.yml | 7 ++ modules/nf-core/pbmm2/align/main.nf | 51 ++++++++++++++ modules/nf-core/pbmm2/align/meta.yml | 61 +++++++++++++++++ .../nf-core/pbmm2/align/tests/main.nf.test | 67 ++++++++++++++++++ .../pbmm2/align/tests/main.nf.test.snap | 68 +++++++++++++++++++ 5 files changed, 254 insertions(+) create mode 100644 modules/nf-core/pbmm2/align/environment.yml create mode 100644 modules/nf-core/pbmm2/align/main.nf create mode 100644 modules/nf-core/pbmm2/align/meta.yml create mode 100644 modules/nf-core/pbmm2/align/tests/main.nf.test create mode 100644 modules/nf-core/pbmm2/align/tests/main.nf.test.snap diff --git a/modules/nf-core/pbmm2/align/environment.yml b/modules/nf-core/pbmm2/align/environment.yml new file mode 100644 index 00000000000..241a59c7501 --- /dev/null +++ b/modules/nf-core/pbmm2/align/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::pbmm2=1.14.99" diff --git a/modules/nf-core/pbmm2/align/main.nf b/modules/nf-core/pbmm2/align/main.nf new file mode 100644 index 00000000000..2e75306bd66 --- /dev/null +++ b/modules/nf-core/pbmm2/align/main.nf @@ -0,0 +1,51 @@ +process PBMM2_ALIGN { + tag "$meta.id" + label 'process_large' + + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pbmm2:1.14.99--h9ee0642_0': + 'biocontainers/pbmm2:1.14.99--h9ee0642_0' }" + + input: + tuple val(meta), path(bam) + tuple val(meta2), path(fasta) + + output: + tuple val(meta), path("*.bam"), emit: bam + 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}" + """ + pbmm2 \\ + align \\ + $args \\ + $fasta \\ + $bam \\ + ${prefix}.bam \\ + --num-threads ${task.cpus} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbmm2: \$(pbmm2 --version |& sed '1!d ; s/pbmm2 //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbmm2: \$(pbmm2 --version |& sed '1!d ; s/pbmm2 //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/pbmm2/align/meta.yml b/modules/nf-core/pbmm2/align/meta.yml new file mode 100644 index 00000000000..d63a83bacb3 --- /dev/null +++ b/modules/nf-core/pbmm2/align/meta.yml @@ -0,0 +1,61 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pbmm2_align" +description: Alignment with PacBio's minimap2 frontend +keywords: + - align + - pacbio + - genomics +tools: + - "pbmm2": + description: "A minimap2 frontend for PacBio native data formats" + homepage: "https://github.com/PacificBiosciences/pbmm2" + documentation: "https://github.com/PacificBiosciences/pbmm2" + tool_dev_url: "https://github.com/PacificBiosciences/pbmm2" + licence: ["BSD-3-clause-Clear"] + identifier: biotools:pbmm2 + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fasta: + type: file + description: fasta file to align bam to + pattern: "*.{fasta}" +output: + - bam: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.bam": + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: + - edam: "http://edamontology.org/format_2572" + - edam: "http://edamontology.org/format_2573" + - edam: "http://edamontology.org/format_3462" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@tanyasarkjain" +maintainers: + - "@tanyasarkjain" diff --git a/modules/nf-core/pbmm2/align/tests/main.nf.test b/modules/nf-core/pbmm2/align/tests/main.nf.test new file mode 100644 index 00000000000..8b15d60265d --- /dev/null +++ b/modules/nf-core/pbmm2/align/tests/main.nf.test @@ -0,0 +1,67 @@ +nextflow_process { + + name "Test Process PBMM2_ALIGN" + script "../main.nf" + process "PBMM2_ALIGN" + + tag "modules" + tag "modules_nfcore" + tag "pbmm2" + tag "pbmm2/align" + + test("pbmm2 - bam") { + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("pbmm2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/pbmm2/align/tests/main.nf.test.snap b/modules/nf-core/pbmm2/align/tests/main.nf.test.snap new file mode 100644 index 00000000000..430851ebb2c --- /dev/null +++ b/modules/nf-core/pbmm2/align/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "pbmm2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bam:md5,b1d6b50f20ba0389435c6a51de26d836" + ] + ], + "1": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ], + "bam": [ + [ + { + "id": "test" + }, + "test.bam:md5,b1d6b50f20ba0389435c6a51de26d836" + ] + ], + "versions": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T10:53:18.838135" + }, + "pbmm2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ], + "bam": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T10:53:31.992125" + } +} \ No newline at end of file From 8a948266a8cfdd42e9c6257a06d26fe221dadd54 Mon Sep 17 00:00:00 2001 From: DarkoCucin <137320136+DarkoCucin@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:25:36 +0100 Subject: [PATCH 28/87] Adding sequali module to nf-core modules (#6896) * Adding sequali module * Update modules/nf-core/sequali/environment.yml typo fixed Co-authored-by: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> * Getting a snapsot for JSON file (without meta field) * modifying main.nf.test * Adding naming check for JSON file --------- Co-authored-by: Eirini (Irene) Liampa Co-authored-by: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> --- modules/nf-core/sequali/environment.yml | 7 + modules/nf-core/sequali/main.nf | 58 +++++ modules/nf-core/sequali/meta.yml | 60 +++++ modules/nf-core/sequali/tests/main.nf.test | 171 ++++++++++++ .../nf-core/sequali/tests/main.nf.test.snap | 245 ++++++++++++++++++ 5 files changed, 541 insertions(+) create mode 100644 modules/nf-core/sequali/environment.yml create mode 100644 modules/nf-core/sequali/main.nf create mode 100644 modules/nf-core/sequali/meta.yml create mode 100644 modules/nf-core/sequali/tests/main.nf.test create mode 100644 modules/nf-core/sequali/tests/main.nf.test.snap diff --git a/modules/nf-core/sequali/environment.yml b/modules/nf-core/sequali/environment.yml new file mode 100644 index 00000000000..b712a24fdd5 --- /dev/null +++ b/modules/nf-core/sequali/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::sequali=0.12.0 diff --git a/modules/nf-core/sequali/main.nf b/modules/nf-core/sequali/main.nf new file mode 100644 index 00000000000..718c07171c9 --- /dev/null +++ b/modules/nf-core/sequali/main.nf @@ -0,0 +1,58 @@ +process SEQUALI { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/sequali:0.12.0--c288fa2befb47d0f': + 'community.wave.seqera.io/library/sequali:0.12.0--07485bec824d914a' }" + + input: + + tuple val(meta), path(reads) + + output: + + tuple val(meta), path("*.html"), emit: html + tuple val(meta), path("*.json"), emit: json + 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}" + def read_1_bam = reads.size() == 1 ? reads : reads[0] + def read_2 = reads.size() == 2 ? reads[1]: "" + + """ + sequali \\ + $args \\ + -t $task.cpus \\ + --html ${prefix}.html \\ + --json ${prefix}.json \\ + $read_1_bam \\ + $read_2 + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sequali: \$(sequali --version |& sed '1!d ; s/sequali //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.html + touch ${prefix}.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + sequali: \$(sequali --version |& sed '1!d ; s/sequali //') + END_VERSIONS + """ +} + diff --git a/modules/nf-core/sequali/meta.yml b/modules/nf-core/sequali/meta.yml new file mode 100644 index 00000000000..62dc6e85e00 --- /dev/null +++ b/modules/nf-core/sequali/meta.yml @@ -0,0 +1,60 @@ +--- +name: sequali +description: Sequence quality metrics for FASTQ and uBAM files. +keywords: + - quality_control + - qc + - preprocessing +tools: + - sequali: + description: Fast sequencing quality metrics + homepage: "https://github.com/rhpvorderman/sequali" + documentation: "https://sequali.readthedocs.io/en/latest/" + tool_dev_url: "https://github.com/rhpvorderman/sequali" + doi: "10.5281/zenodo.10854010" + licence: ["AGPL v3-or-later"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - reads: + type: file + description: Input FASTQ(s) or uBAM file. The format is autodetected and compressed formats are supported. + pattern: "*.{fastq,fq,fastq.gz,fq.gz,bam}" +output: + - json: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.json": + type: file + description: JSON output file. + pattern: "*.{json}" + - html: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.html": + type: file + description: HTML output file. + pattern: "*.{html}" + + - versions: + - "versions.yml": + type: file + description: File containing software versions. + pattern: "versions.yml" +authors: + - "@irliampa" + - "@DarkoCucin" +maintainers: + - "@irliampa" + - "@DarkoCucin" diff --git a/modules/nf-core/sequali/tests/main.nf.test b/modules/nf-core/sequali/tests/main.nf.test new file mode 100644 index 00000000000..9876153caf6 --- /dev/null +++ b/modules/nf-core/sequali/tests/main.nf.test @@ -0,0 +1,171 @@ +nextflow_process { + + name "Test Process SEQUALI" + script "../main.nf" + process "SEQUALI" + + tag "modules" + tag "modules_nfcore" + tag "sequali" + + test("sarscov2 - fastq single-end [sequali]") { + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]) + """ + } + } + then { + assertAll( + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions + ).match() } + ) + } + + } + test("sarscov2 - fastq paired-end [sequali]") { + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - unaligned bam [sequali]") { + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: true], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true)]) + """ + } + } + + then { + def json_file = path(process.out.json[0][1]).json.get('summary') + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + path(process.out.json[0][1]).json.remove('summary'), + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastq single-end - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } + ) + } + + } + test("sarscov2 - fastq paired-end - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } + ) + } + + } + + test("sarscov2 - unaligned bam - stub[sequali]") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: true], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.unaligned.bam', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.html[0][1]).getFileName().toString(), + path(process.out.json[0][1]).getFileName().toString(), + process.out + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/sequali/tests/main.nf.test.snap b/modules/nf-core/sequali/tests/main.nf.test.snap new file mode 100644 index 00000000000..441c352bea4 --- /dev/null +++ b/modules/nf-core/sequali/tests/main.nf.test.snap @@ -0,0 +1,245 @@ +{ + "sarscov2 - unaligned bam - stub[sequali]": { + "content": [ + "test.html", + "test.json", + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:30:30.653577" + }, + "sarscov2 - fastq paired-end [sequali]": { + "content": [ + "test.html", + "test.json", + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": "Read 1" + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:29:34.748364" + }, + "sarscov2 - fastq single-end - stub[sequali]": { + "content": [ + "test.html", + "test.json", + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:30:06.387152" + }, + "sarscov2 - fastq single-end [sequali]": { + "content": [ + "test.html", + "test.json", + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": null + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:28:42.093895" + }, + "sarscov2 - unaligned bam [sequali]": { + "content": [ + "test.html", + "test.json", + { + "mean_length": 138.97, + "minimum_length": 72, + "maximum_length": 151, + "total_reads": 100, + "q20_reads": 91, + "total_bases": 13897, + "q20_bases": 12922, + "total_gc_bases": 5430, + "total_n_bases": 0, + "read_pair_info": null + }, + [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:29:54.657233" + }, + "sarscov2 - fastq paired-end - stub[sequali]": { + "content": [ + "test.html", + "test.json", + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,afd9522ef20d5fe27e0b6aab541c7c30" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-10-31T14:30:18.654267" + } +} \ No newline at end of file From 6c32d3749967fb03fc83ae5e7ea72ecf26b90f56 Mon Sep 17 00:00:00 2001 From: tanyasarkjain <67300971+tanyasarkjain@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:42:22 -0700 Subject: [PATCH 29/87] pbsv (#6818) * pbsv * [automated] Fix linting with Prettier * version of pbsv module where all the tests pass * getting rid of un-need comments * updated: * changed website: * update * deleting accidental file * small tweak * updating the meta description * pretty * removing trailing space * space * newline * should pass version test * changed pbsv to pbsv/discover - seperating functionality * Update modules/nf-core/pbsv/discover/tests/main.nf.test Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbsv/discover/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbsv/discover/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbsv/discover/meta.yml Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * resolving comments * resolving comments * comments --------- Co-authored-by: nf-core-bot Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/pbsv/discover/environment.yml | 7 ++ modules/nf-core/pbsv/discover/main.nf | 46 ++++++++++++ modules/nf-core/pbsv/discover/meta.yml | 54 ++++++++++++++ .../nf-core/pbsv/discover/tests/main.nf.test | 65 +++++++++++++++++ .../pbsv/discover/tests/main.nf.test.snap | 72 +++++++++++++++++++ 5 files changed, 244 insertions(+) create mode 100644 modules/nf-core/pbsv/discover/environment.yml create mode 100644 modules/nf-core/pbsv/discover/main.nf create mode 100644 modules/nf-core/pbsv/discover/meta.yml create mode 100644 modules/nf-core/pbsv/discover/tests/main.nf.test create mode 100644 modules/nf-core/pbsv/discover/tests/main.nf.test.snap diff --git a/modules/nf-core/pbsv/discover/environment.yml b/modules/nf-core/pbsv/discover/environment.yml new file mode 100644 index 00000000000..a48d2440108 --- /dev/null +++ b/modules/nf-core/pbsv/discover/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::pbsv=2.9.0" diff --git a/modules/nf-core/pbsv/discover/main.nf b/modules/nf-core/pbsv/discover/main.nf new file mode 100644 index 00000000000..48651a3a460 --- /dev/null +++ b/modules/nf-core/pbsv/discover/main.nf @@ -0,0 +1,46 @@ +process PBSV_DISCOVER { + tag "$meta.id" + label 'process_single' + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pbsv:2.9.0--h9ee0642_0': + 'biocontainers/pbsv:2.9.0--h9ee0642_0' }" + + input: + tuple val(meta), path(bam) + tuple val(meta2), path(fasta) + + output: + tuple val(meta), path("*.svsig.gz"), emit: svsig + 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}" + """ + pbsv \\ + discover \\ + $args \\ + ${bam} \\ + ${prefix}.svsig.gz + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbsv: \$(pbsv --version |& sed '1!d ; s/pbsv //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo | gzip > ${prefix}.svsig.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbsv: \$(pbsv --version |& sed '1!d ; s/pbsv //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/pbsv/discover/meta.yml b/modules/nf-core/pbsv/discover/meta.yml new file mode 100644 index 00000000000..70daffa078b --- /dev/null +++ b/modules/nf-core/pbsv/discover/meta.yml @@ -0,0 +1,54 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pbsv_discover" +description: "pbsv - PacBio structural variant (SV) signature discovery tool" +keywords: + - variant + - pacbio + - structural +tools: + - "pbsv": + description: "pbsv - PacBio structural variant (SV) calling and analysis tools" + homepage: "https://github.com/PacificBiosciences/pbsv" + documentation: "https://github.com/PacificBiosciences/pbsv" + tool_dev_url: "https://github.com/PacificBiosciences/pbsv" + licence: ["BSD-3-clause-Clear"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'reference' ]` + - fasta: + type: file + description: fasta file + pattern: "*.fasta" +output: + - svsig: + - meta: + type: file + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.svsig.gz": + type: file + description: structural variant signatures files + pattern: "*.svsig.gz" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@tanyasarkjain" +maintainers: + - "@tanyasarkjain" diff --git a/modules/nf-core/pbsv/discover/tests/main.nf.test b/modules/nf-core/pbsv/discover/tests/main.nf.test new file mode 100644 index 00000000000..4aad70fa61e --- /dev/null +++ b/modules/nf-core/pbsv/discover/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process PBSV_DISCOVER" + script "../main.nf" + process "PBSV_DISCOVER" + + tag "modules" + tag "modules_nfcore" + tag "pbsv" + tag "pbsv/discover" + + test("pbsv_bam") { + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true) + ] + + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + + } + + test("pbsv_bam_stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true) + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/pbsv/discover/tests/main.nf.test.snap b/modules/nf-core/pbsv/discover/tests/main.nf.test.snap new file mode 100644 index 00000000000..ec7972984ae --- /dev/null +++ b/modules/nf-core/pbsv/discover/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "pbsv_bam_stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.svsig.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,0cccc59cd231b14091d7a798e2aacc9a" + ], + "svsig": [ + [ + { + "id": "test", + "single_end": false + }, + "test.svsig.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,0cccc59cd231b14091d7a798e2aacc9a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T11:24:59.172558" + }, + "pbsv_bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.svsig.gz:md5,7c4859b65e51d8d2c9ab1e5338da17c1" + ] + ], + "1": [ + "versions.yml:md5,0cccc59cd231b14091d7a798e2aacc9a" + ], + "svsig": [ + [ + { + "id": "test", + "single_end": false + }, + "test.svsig.gz:md5,7c4859b65e51d8d2c9ab1e5338da17c1" + ] + ], + "versions": [ + "versions.yml:md5,0cccc59cd231b14091d7a798e2aacc9a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T11:24:46.288774" + } +} \ No newline at end of file From 22737835af2db3dd0d5b6b332e75e160d0199fae Mon Sep 17 00:00:00 2001 From: Adam Rosenbaum Date: Fri, 1 Nov 2024 07:31:25 +0100 Subject: [PATCH 30/87] Update chopper module to take optional fasta file (#6913) * Update chopper module to take optional fasta file * linting issues * Upgrade chopper biocontainer, add stub, and use only data in test-data for testing * bump chopper version in conda --- modules/nf-core/chopper/environment.yml | 2 +- modules/nf-core/chopper/main.nf | 18 ++++- modules/nf-core/chopper/meta.yml | 4 + modules/nf-core/chopper/tests/main.nf.test | 74 +++++++++++++++++-- .../nf-core/chopper/tests/main.nf.test.snap | 60 +++++++++++++-- 5 files changed, 143 insertions(+), 15 deletions(-) diff --git a/modules/nf-core/chopper/environment.yml b/modules/nf-core/chopper/environment.yml index e80840e1514..2195b5eda84 100644 --- a/modules/nf-core/chopper/environment.yml +++ b/modules/nf-core/chopper/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::chopper=0.3.0 + - bioconda::chopper=0.9.0 diff --git a/modules/nf-core/chopper/main.nf b/modules/nf-core/chopper/main.nf index 06f798490df..6fc0b2d26ce 100644 --- a/modules/nf-core/chopper/main.nf +++ b/modules/nf-core/chopper/main.nf @@ -4,11 +4,12 @@ process CHOPPER { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/chopper:0.3.0--hd03093a_0': - 'biocontainers/chopper:0.3.0--hd03093a_0' }" + 'https://depot.galaxyproject.org/singularity/chopper:0.9.0--hdcf5f25_0': + 'biocontainers/chopper:0.9.0--hdcf5f25_0' }" input: tuple val(meta), path(fastq) + path fasta output: tuple val(meta), path("*.fastq.gz") , emit: fastq @@ -22,6 +23,7 @@ process CHOPPER { def args2 = task.ext.args2 ?: '' def args3 = task.ext.args3 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def fasta_filtering = fasta ? "--contam ${fasta}" : "" if ("$fastq" == "${prefix}.fastq.gz") error "Input and output names are the same, set prefix in module configuration to disambiguate!" """ @@ -30,6 +32,7 @@ process CHOPPER { $fastq | \\ chopper \\ --threads $task.cpus \\ + $fasta_filtering \\ $args2 | \\ gzip \\ $args3 > ${prefix}.fastq.gz @@ -39,4 +42,15 @@ process CHOPPER { chopper: \$(chopper --version 2>&1 | cut -d ' ' -f 2) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo | gzip > ${prefix}.fastq.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + chopper: \$(chopper --version 2>&1 | cut -d ' ' -f 2) + END_VERSIONS + """ } diff --git a/modules/nf-core/chopper/meta.yml b/modules/nf-core/chopper/meta.yml index 916c865e839..049cf62d098 100644 --- a/modules/nf-core/chopper/meta.yml +++ b/modules/nf-core/chopper/meta.yml @@ -38,6 +38,10 @@ input: type: file description: FastQ with reads from long read sequencing e.g. PacBio or ONT pattern: "*.{fastq.gz}" + - - fasta: + type: file + description: An optional reference fasta file against which to remove reads that align to it. + pattern: "*.fasta" output: - fastq: - meta: diff --git a/modules/nf-core/chopper/tests/main.nf.test b/modules/nf-core/chopper/tests/main.nf.test index ee195b5f720..e611fa9f708 100644 --- a/modules/nf-core/chopper/tests/main.nf.test +++ b/modules/nf-core/chopper/tests/main.nf.test @@ -7,7 +7,43 @@ nextflow_process { tag "modules" tag "modules_nfcore" - test("Should run without failures") { + test("test with lambda reference") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ + [id:'test_out' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test_2.fastq.gz', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) + """ + } + } + + then { + + def fastq_content = path(process.out.fastq.get(0).get(1)).linesGzip + + assertAll( + { assert process.success }, + // original pytest checks + { assert process.out.fastq.get(0).get(1) ==~ ".*/test_out.fastq.gz" }, + { assert !fastq_content.contains("@a52a642e-88d0-4584-babd-414ea84db484 runid=71c83ae0021f873e29b130c6562a4c27185f93b8 read=2768 ch=489 start_time=2021-08-11T12:07:39Z flow_cell_id=FAQ57606 protocol_group_id=210811_47CoV_SA sample_id=CS5 barcode=barcode04 barcode_alias=barcode04")}, + // additional nf-test checks + // Order of reads is not deterministic, so only assess whether the number of reads is correct + { assert snapshot( + fastq_content.size(), + process.out.versions + ).match() } + ) + } + } + + test("test without lambda reference") { when { params { @@ -19,6 +55,7 @@ nextflow_process { [id:'test_out' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true) ] + input[1] = [] """ } } @@ -34,12 +71,37 @@ nextflow_process { { assert fastq_content.contains("@2109d790-67ec-4fd1-8931-6c7e61908ff3 runid=97ca62ca093ff43533aa34c38a10b1d6325e7e7b read=52274 ch=243 start_time=2021-02-05T23:27:30Z flow_cell_id=FAP51364 protocol_group_id=data sample_id=RN20097 barcode=barcode01 barcode_alias=barcode01")}, // additional nf-test checks // Order of reads is not deterministic, so only assess whether the number of reads is correct - { assert snapshot(fastq_content.size()).match("number_of_lines") }, - { assert snapshot(process.out.versions).match("versions") } - + { assert snapshot( + fastq_content.size(), + process.out.versions + ).match() } ) } - } -} + test("test-chopper-stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [id:'test_out' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out, + process.out.versions + ).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/chopper/tests/main.nf.test.snap b/modules/nf-core/chopper/tests/main.nf.test.snap index d2587e66311..605222560a6 100644 --- a/modules/nf-core/chopper/tests/main.nf.test.snap +++ b/modules/nf-core/chopper/tests/main.nf.test.snap @@ -1,16 +1,64 @@ { - "versions": { + "test without lambda reference": { "content": [ + 400, [ - "versions.yml:md5,5fe28ea455482c9fe88603ddcc461881" + "versions.yml:md5,74a27493c09d0c481f6e52b517e12023" ] ], - "timestamp": "2023-10-20T08:27:24.592662298" + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-31T15:14:36.37897815" }, - "number_of_lines": { + "test with lambda reference": { "content": [ - 400 + 15984, + [ + "versions.yml:md5,74a27493c09d0c481f6e52b517e12023" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-31T15:14:31.324993049" + }, + "test-chopper-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_out" + }, + "test_out.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,74a27493c09d0c481f6e52b517e12023" + ], + "fastq": [ + [ + { + "id": "test_out" + }, + "test_out.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,74a27493c09d0c481f6e52b517e12023" + ] + }, + [ + "versions.yml:md5,74a27493c09d0c481f6e52b517e12023" + ] ], - "timestamp": "2023-10-20T08:27:24.581289647" + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-31T15:29:08.715579423" } } \ No newline at end of file From baa54ee3b9bf2c1ba008a9540bb76138353db647 Mon Sep 17 00:00:00 2001 From: tanyasarkjain <67300971+tanyasarkjain@users.noreply.github.com> Date: Fri, 1 Nov 2024 03:33:14 -0700 Subject: [PATCH 31/87] Pbsv/call (#6915) * pbsv * [automated] Fix linting with Prettier * version of pbsv module where all the tests pass * getting rid of un-need comments * updated: * changed website: * update * deleting accidental file * small tweak * updating the meta description * pretty * removing trailing space * space * newline * should pass version test * changed pbsv to pbsv/discover - seperating functionality * pbsv/call * update * fixed spacing * adding end line * small change * space * please work * spacing * slight changes * args * Update modules/nf-core/pbsv/call/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * trailing space * medium * change * medium --------- Co-authored-by: nf-core-bot Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/pbsv/call/environment.yml | 7 ++ modules/nf-core/pbsv/call/main.nf | 50 ++++++++++++++ modules/nf-core/pbsv/call/meta.yml | 50 ++++++++++++++ modules/nf-core/pbsv/call/tests/main.nf.test | 68 +++++++++++++++++++ .../nf-core/pbsv/call/tests/main.nf.test.snap | 52 ++++++++++++++ 5 files changed, 227 insertions(+) create mode 100644 modules/nf-core/pbsv/call/environment.yml create mode 100644 modules/nf-core/pbsv/call/main.nf create mode 100644 modules/nf-core/pbsv/call/meta.yml create mode 100644 modules/nf-core/pbsv/call/tests/main.nf.test create mode 100644 modules/nf-core/pbsv/call/tests/main.nf.test.snap diff --git a/modules/nf-core/pbsv/call/environment.yml b/modules/nf-core/pbsv/call/environment.yml new file mode 100644 index 00000000000..a48d2440108 --- /dev/null +++ b/modules/nf-core/pbsv/call/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::pbsv=2.9.0" diff --git a/modules/nf-core/pbsv/call/main.nf b/modules/nf-core/pbsv/call/main.nf new file mode 100644 index 00000000000..50be300fd20 --- /dev/null +++ b/modules/nf-core/pbsv/call/main.nf @@ -0,0 +1,50 @@ +process PBSV_CALL { + 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/pbsv:2.9.0--h9ee0642_0': + 'biocontainers/pbsv:2.9.0--h9ee0642_0' }" + + input: + tuple val(meta), path(svsig) + tuple val(meta2), path(fasta) + + output: + tuple val(meta), path("*.vcf"), emit: vcf + 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}" + """ + pbsv \\ + call \\ + $args \\ + -j ${task.cpus} \\ + ${fasta} \\ + ${svsig} \\ + ${prefix}.vcf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbsv: \$(pbsv --version |& sed '1!d ; s/pbsv //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.vcf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbsv: \$(pbsv --version |& sed '1!d ; s/pbsv //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/pbsv/call/meta.yml b/modules/nf-core/pbsv/call/meta.yml new file mode 100644 index 00000000000..939c3d7dd58 --- /dev/null +++ b/modules/nf-core/pbsv/call/meta.yml @@ -0,0 +1,50 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pbsv_call" +description: "pbsv/call - PacBio structural variant (SV) calling and analysis tools" +keywords: + - variant + - pacbio + - genomics +tools: + - "pbsv": + description: "pbsv - PacBio structural variant (SV) calling and analysis tools" + homepage: "https://github.com/PacificBiosciences/" + documentation: "https://github.com/PacificBiosciences/" + tool_dev_url: "https://github.com/PacificBiosciences/" + licence: ["BSD-3-clause-Clear"] +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - svsig: + type: file + description: structural variant file + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'reference']` + - fasta: + type: file + description: fasta file used as reference +output: + - vcf: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.vcf": + type: file + description: structural variant file + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@tanyasarkjain" +maintainers: + - "@tanyasarkjain" diff --git a/modules/nf-core/pbsv/call/tests/main.nf.test b/modules/nf-core/pbsv/call/tests/main.nf.test new file mode 100644 index 00000000000..bc2c48f91c6 --- /dev/null +++ b/modules/nf-core/pbsv/call/tests/main.nf.test @@ -0,0 +1,68 @@ +nextflow_process { + name "Test Process PBSV_CALL" + script "../main.nf" + process "PBSV_CALL" + + tag "modules" + tag "modules_nfcore" + tag "pbsv" + tag "pbsv/call" + + test("pbsv-call - [svsig] [fasta]") { + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/svsig/NA03697B2_new.pbmm2.repeats.svsig.gz', checkIfExists: true) + ] + + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ] + """ + } + } + + then { + def vcfFile = path(process.out.vcf[0][1]).vcf + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.vcf[0][1]).name, + process.out.versions, + vcfFile.variantsMD5).match() }, + { assert vcfFile.chromosomes == ['chr19:45760000-45770300'] as Set} + ) + } + } + + test("pbsv-call - [svsig] [fasta] - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/svsig/NA03697B2_new.pbmm2.repeats.svsig.gz', checkIfExists: true) + ] + + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/pbsv/call/tests/main.nf.test.snap b/modules/nf-core/pbsv/call/tests/main.nf.test.snap new file mode 100644 index 00000000000..39055cca7c2 --- /dev/null +++ b/modules/nf-core/pbsv/call/tests/main.nf.test.snap @@ -0,0 +1,52 @@ +{ + "pbsv-call - [svsig] [fasta]": { + "content": [ + + "test.vcf", + [ + "versions.yml:md5,a8d62b1557c995607b315babfe0bd28b" + ], + "39821c95936a6f9539d3ad53e6562f99" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T16:50:00.253251" + }, + "pbsv-call - [svsig] [fasta] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,a8d62b1557c995607b315babfe0bd28b" + ], + "vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,a8d62b1557c995607b315babfe0bd28b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T21:38:47.484071" + } +} \ No newline at end of file From afb9c1dc83cfcd0a4e65f2e18e976297668badef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 20:13:35 +0100 Subject: [PATCH 32/87] Update pre-commit hook astral-sh/ruff-pre-commit to v0.7.2 (#6842) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 351a51a9b3a..430e48ac3dd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: - id: renovate-config-validator # use ruff for python files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.0 + rev: v0.7.2 hooks: - id: ruff files: \.py$ From 4895bcc89a7a13b2b892d43d0de1304c9025f543 Mon Sep 17 00:00:00 2001 From: Ramiro Date: Mon, 4 Nov 2024 10:27:14 +0100 Subject: [PATCH 33/87] Add coptr/index tool (#6908) * Initial addition * [automated] Fix linting with Prettier * Fixed minor spacing and format details from review * Fixed minor spacing and format details from review * Removed typo * [automated] Fix linting with Prettier * Removed tab and extra white spaces * Initial addition * Adjusted bowtie channel * Adjusted bowtie channel * Initial addition. Works * Updated * [automated] Fix linting with Prettier * Fixed meta to be consistent with main * [automated] Fix linting with Prettier * Reran tests * Updated snapshot * Updated setup block to be run only once * Updated setup block to be run only once * Removed files from second module to be included in a secondPR * Fixed PR comments * Fixed PR comments * Fixed PR comments * Put more descriptive description * Fixed missing spaces * Fixed output attribute name --------- Co-authored-by: nf-core-bot --- modules/nf-core/coptr/index/environment.yml | 7 + modules/nf-core/coptr/index/main.nf | 52 ++++++ modules/nf-core/coptr/index/meta.yml | 52 ++++++ .../nf-core/coptr/index/tests/main.nf.test | 82 ++++++++++ .../coptr/index/tests/main.nf.test.snap | 149 ++++++++++++++++++ 5 files changed, 342 insertions(+) create mode 100644 modules/nf-core/coptr/index/environment.yml create mode 100644 modules/nf-core/coptr/index/main.nf create mode 100644 modules/nf-core/coptr/index/meta.yml create mode 100644 modules/nf-core/coptr/index/tests/main.nf.test create mode 100644 modules/nf-core/coptr/index/tests/main.nf.test.snap diff --git a/modules/nf-core/coptr/index/environment.yml b/modules/nf-core/coptr/index/environment.yml new file mode 100644 index 00000000000..c5a150067f6 --- /dev/null +++ b/modules/nf-core/coptr/index/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::coptr=1.1.4" diff --git a/modules/nf-core/coptr/index/main.nf b/modules/nf-core/coptr/index/main.nf new file mode 100644 index 00000000000..9fce3eb21ab --- /dev/null +++ b/modules/nf-core/coptr/index/main.nf @@ -0,0 +1,52 @@ +process COPTR_INDEX { + tag '$indexfasta' + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/coptr:1.1.4--pyhdfd78af_1': + 'biocontainers/coptr:1.1.4--pyhdfd78af_1' }" + + input: + tuple val(meta), path(indexfasta, stageAs: "fastafolder/*") + + output: + tuple val(meta), path("bowtie2"), emit: index_dir + 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}" + + """ + mkdir bowtie2 + coptr \ + index \ + $args \ + --bt2-threads $task.cpus \ + fastafolder \ + bowtie2/${prefix} + cat <<-END_VERSIONS > versions.yml + "${task.process}": + coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir bowtie2 + touch bowtie2/${prefix}.{1..4}.bt2 + touch bowtie2/${prefix}.rev.{1,2}.bt2 + touch bowtie2/${prefix}.genomes + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + coptr: \$(coptr |& sed -E '11!d ; s/CoPTR.*?\\(v(.*?)\\).*/\\1/') + END_VERSIONS + """ +} diff --git a/modules/nf-core/coptr/index/meta.yml b/modules/nf-core/coptr/index/meta.yml new file mode 100644 index 00000000000..a263d8b6995 --- /dev/null +++ b/modules/nf-core/coptr/index/meta.yml @@ -0,0 +1,52 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "coptr_index" +description: Indexes a directory of fasta files for use with CoPTR +keywords: + - coptr + - index + - ptr +tools: + - "coptr": + description: "Accurate and robust inference of microbial growth dynamics from + metagenomic sequencing reads." + homepage: "https://github.com/tyjo/coptr" + documentation: "https://coptr.readthedocs.io/" + tool_dev_url: "https://github.com/tyjo/coptr" + doi: "10.1101/gr.275533.121" + licence: ["GPL v3"] + identifier: biotools:coptr + +input: + - - meta: + type: map + description: | + Groovy Map containing genome information + - indexfasta: + type: file + description: Fasta file(s) ending in [.fasta, .fna, .fa] to be used to create the index. + pattern: "*.{.fasta,.fna,.fa}" + ontologies: + - edam: "http://edamontology.org/format_1929" + +output: + - index_dir: + - meta: + type: map + description: | + Groovy Map containing genome information + - "bowtie2": + type: map + description: index genome directory + ontologies: + - edam: "http://edamontology.org/data_3210" + pattern: "*.{genome}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@ramirobarrantes" +maintainers: + - "@ramirobarrantes" diff --git a/modules/nf-core/coptr/index/tests/main.nf.test b/modules/nf-core/coptr/index/tests/main.nf.test new file mode 100644 index 00000000000..8066d370988 --- /dev/null +++ b/modules/nf-core/coptr/index/tests/main.nf.test @@ -0,0 +1,82 @@ +// nf-core modules test coptr/index +nextflow_process { + + name "Test Process COPTR_INDEX" + script "../main.nf" + process "COPTR_INDEX" + + tag "modules" + tag "modules_nfcore" + tag "coptr" + tag "coptr/index" + + test("coptr index with single fastq") { + + when { + process { + """ + input[0] = [ + [id:'indexNameExample'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("coptr index with multiple fastqs") { + + when { + process { + """ + input[0] = [ + [id:'indexNameExample'], + [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome2.fasta', checkIfExists: true),file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true)] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("coptr index with multiple fastqs - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id:'indexNameExample'], + [file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome2.fasta', checkIfExists: true),file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true)] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + +} diff --git a/modules/nf-core/coptr/index/tests/main.nf.test.snap b/modules/nf-core/coptr/index/tests/main.nf.test.snap new file mode 100644 index 00000000000..fb0aded4c13 --- /dev/null +++ b/modules/nf-core/coptr/index/tests/main.nf.test.snap @@ -0,0 +1,149 @@ +{ + "coptr index with single fastq": { + "content": [ + { + "0": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,4cc1f5a22294e650af704b10b884d400", + "indexNameExample.2.bt2:md5,47b153cd1319abc88dda532462651fcf", + "indexNameExample.3.bt2:md5,4ed93abba181d8dfab2e303e33114777", + "indexNameExample.4.bt2:md5,c25be5f8b0378abf7a58c8a880b87626", + "indexNameExample.genomes:md5,6fdee2503bb01babbfa3c151bee3ef66", + "indexNameExample.rev.1.bt2:md5,39c0228fdfb406b889274f38b89cf9aa", + "indexNameExample.rev.2.bt2:md5,e3b4ef343dea4dd571642010a7d09597" + ] + ] + ], + "1": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ], + "index_dir": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,4cc1f5a22294e650af704b10b884d400", + "indexNameExample.2.bt2:md5,47b153cd1319abc88dda532462651fcf", + "indexNameExample.3.bt2:md5,4ed93abba181d8dfab2e303e33114777", + "indexNameExample.4.bt2:md5,c25be5f8b0378abf7a58c8a880b87626", + "indexNameExample.genomes:md5,6fdee2503bb01babbfa3c151bee3ef66", + "indexNameExample.rev.1.bt2:md5,39c0228fdfb406b889274f38b89cf9aa", + "indexNameExample.rev.2.bt2:md5,e3b4ef343dea4dd571642010a7d09597" + ] + ] + ], + "versions": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-01T15:20:08.028567181" + }, + "coptr index with multiple fastqs - stub": { + "content": [ + { + "0": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.3.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.4.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.genomes:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.rev.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.rev.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ], + "index_dir": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.3.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.4.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.genomes:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.rev.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "indexNameExample.rev.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "versions": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-01T15:28:00.318435045" + }, + "coptr index with multiple fastqs": { + "content": [ + { + "0": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,e88e383183a9dec8dd453b04dc89a903", + "indexNameExample.2.bt2:md5,ae84a18d674ecc823c82188f5ca1ffc9", + "indexNameExample.3.bt2:md5,702fe6c79ef7bc9b54b3661f2f4aaa0b", + "indexNameExample.4.bt2:md5,a2234db869afc50b40f7e7d1289f5f0b", + "indexNameExample.genomes:md5,d4ed161da3cf2ced8e7c66c0c90e8d3e", + "indexNameExample.rev.1.bt2:md5,75d78b73949d636ec9750269a5ea1c8b", + "indexNameExample.rev.2.bt2:md5,39a1186f6aad701a71d773074408b51e" + ] + ] + ], + "1": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ], + "index_dir": [ + [ + { + "id": "indexNameExample" + }, + [ + "indexNameExample.1.bt2:md5,e88e383183a9dec8dd453b04dc89a903", + "indexNameExample.2.bt2:md5,ae84a18d674ecc823c82188f5ca1ffc9", + "indexNameExample.3.bt2:md5,702fe6c79ef7bc9b54b3661f2f4aaa0b", + "indexNameExample.4.bt2:md5,a2234db869afc50b40f7e7d1289f5f0b", + "indexNameExample.genomes:md5,d4ed161da3cf2ced8e7c66c0c90e8d3e", + "indexNameExample.rev.1.bt2:md5,75d78b73949d636ec9750269a5ea1c8b", + "indexNameExample.rev.2.bt2:md5,39a1186f6aad701a71d773074408b51e" + ] + ] + ], + "versions": [ + "versions.yml:md5,6013eeb9d8ac97351260150f44091986" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-01T15:24:04.847842182" + } +} \ No newline at end of file From a9521c89a6595b06b735dcf068083e88bff751a7 Mon Sep 17 00:00:00 2001 From: Nico Trummer <52698566+nictru@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:37:20 +0100 Subject: [PATCH 34/87] Add scAR module (#6157) * Add scar * Add parameters for input and output layers * Add some missing scAR module properties * Update test snapshot * Fix problematic snapshot structure * Simplify batch size handling * Find cleaner solution for batch_size problem * Update scvi-tools version * Update docker container link * Fix linting * Prettier * Ruff * Fix Ruff problem * Another Ruff attempt * Fix python version * fix issues * fix pre-commit * try to fix CI * make ruff happy * singularity and docker CI fix * conda CI, works locally... * make nf lint happy --------- Co-authored-by: Batuhan Cakir Co-authored-by: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Co-authored-by: Leon Hafner --- .../nf-core/scvitools/scar/environment.yml | 6 ++ modules/nf-core/scvitools/scar/main.nf | 38 +++++++++++ modules/nf-core/scvitools/scar/meta.yml | 51 ++++++++++++++ .../nf-core/scvitools/scar/templates/scar.py | 64 +++++++++++++++++ .../nf-core/scvitools/scar/tests/main.nf.test | 53 +++++++++++++++ .../scvitools/scar/tests/main.nf.test.snap | 68 +++++++++++++++++++ .../scvitools/scar/tests/nextflow.config | 5 ++ modules/nf-core/scvitools/scar/tests/tags.yml | 2 + 8 files changed, 287 insertions(+) create mode 100644 modules/nf-core/scvitools/scar/environment.yml create mode 100644 modules/nf-core/scvitools/scar/main.nf create mode 100644 modules/nf-core/scvitools/scar/meta.yml create mode 100644 modules/nf-core/scvitools/scar/templates/scar.py create mode 100644 modules/nf-core/scvitools/scar/tests/main.nf.test create mode 100644 modules/nf-core/scvitools/scar/tests/main.nf.test.snap create mode 100644 modules/nf-core/scvitools/scar/tests/nextflow.config create mode 100644 modules/nf-core/scvitools/scar/tests/tags.yml diff --git a/modules/nf-core/scvitools/scar/environment.yml b/modules/nf-core/scvitools/scar/environment.yml new file mode 100644 index 00000000000..42881dd7b8f --- /dev/null +++ b/modules/nf-core/scvitools/scar/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::scvi-tools=1.2.0 + - conda-forge::jaxlib=0.4.31 diff --git a/modules/nf-core/scvitools/scar/main.nf b/modules/nf-core/scvitools/scar/main.nf new file mode 100644 index 00000000000..db9dcfc4215 --- /dev/null +++ b/modules/nf-core/scvitools/scar/main.nf @@ -0,0 +1,38 @@ +process SCVITOOLS_SCAR { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/scvi-tools:1.2.0--adbeb4160de8b08e': + 'community.wave.seqera.io/library/scvi-tools:1.2.0--680d378b86801b8a' }" + + input: + tuple val(meta), path(filtered), path(unfiltered) + + output: + tuple val(meta), path("*.h5ad"), emit: h5ad + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + prefix = task.ext.prefix ?: "${meta.id}" + input_layer = task.ext.input_layer ?: "X" + output_layer = task.ext.output_layer ?: "scar" + max_epochs = task.ext.max_epochs ?: "" + template 'scar.py' + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch "${prefix}.h5ad" + + cat <<-END_VERSIONS > versions.yml + ${task.process}: + python: \$(python --version) + scvi: \$(python -c "import scvi; print(scvi.__version__)") + END_VERSIONS + """ +} diff --git a/modules/nf-core/scvitools/scar/meta.yml b/modules/nf-core/scvitools/scar/meta.yml new file mode 100644 index 00000000000..1a85ff30ecd --- /dev/null +++ b/modules/nf-core/scvitools/scar/meta.yml @@ -0,0 +1,51 @@ +name: scvitools_scar +description: Module to use scAR to remove ambient RNA from single-cell RNA-seq data +keywords: + - single-cell + - scRNA-seq + - ambient RNA removal +tools: + - scvitools: + description: scvi-tools (single-cell variational inference tools) is a package for end-to-end analysis of single-cell omics data + documentation: https://docs.scvi-tools.org/en/stable/ + tool_dev_url: https://github.com/scverse/scvi-tools + licence: ["BSD-3-clause"] + - scar: + description: scAR (single-cell Ambient Remover) is a deep learning model for removal of the ambient signals in droplet-based single cell omics. + documentation: https://docs.scvi-tools.org/en/stable/user_guide/models/scar.html + tool_dev_url: https://github.com/Novartis/scar + licence: ["Novartis Terms of License"] +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - filtered: + type: file + description: AnnData file containing filtered data (without empty droplets) + pattern: "*.h5ad" + - unfiltered: + type: file + description: AnnData file containing unfiltered data (with empty droplets) + pattern: "*.h5ad" +output: + - h5ad: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - "*.h5ad": + type: file + description: AnnData file containing decontaminated counts as `adata.X` + pattern: "*.h5ad" + - versions: + - versions.yml: + type: file + description: File containing software version + pattern: "versions.yml" +authors: + - "@nictru" +maintainers: + - "@nictru" diff --git a/modules/nf-core/scvitools/scar/templates/scar.py b/modules/nf-core/scvitools/scar/templates/scar.py new file mode 100644 index 00000000000..bc7e5176337 --- /dev/null +++ b/modules/nf-core/scvitools/scar/templates/scar.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 + +import platform + +import anndata as ad +import scvi +from scipy.sparse import csr_matrix +from scvi.external import SCAR +from threadpoolctl import threadpool_limits + +threadpool_limits(int("${task.cpus}")) + +scvi.settings.seed = 0 + + +def format_yaml_like(data: dict, indent: int = 0) -> str: + """Formats a dictionary to a YAML-like string. + + Args: + data (dict): The dictionary to format. + indent (int): The current indentation level. + + Returns: + str: A string formatted as YAML. + """ + yaml_str = "" + for key, value in data.items(): + spaces = " " * indent + if isinstance(value, dict): + yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" + else: + yaml_str += f"{spaces}{key}: {value}\\n" + return yaml_str + + +adata = ad.read_h5ad("${filtered}") +adata_unfiltered = ad.read_h5ad("${unfiltered}") + +SCAR.setup_anndata(adata, layer=None if "${input_layer}" == "X" else "${input_layer}") +SCAR.get_ambient_profile(adata, adata_unfiltered) + +vae = SCAR(adata) + +# Prevent errors like https://discourse.scverse.org/t/scvi-21618-problem/2294 +vae.train( + max_epochs=int("${max_epochs}") if "${max_epochs}" else None, + early_stopping=True, + datasplitter_kwargs={"drop_last": True}, +) + +if "${output_layer}" == "X": + adata.X = csr_matrix(vae.get_denoised_counts()) +else: + adata.layers["${output_layer}"] = csr_matrix(vae.get_denoised_counts()) + +del adata.uns["_scvi_uuid"], adata.uns["_scvi_manager_uuid"] + +adata.write_h5ad("${prefix}.h5ad") + +# Versions +versions = {"${task.process}": {"python": platform.python_version(), "scvi": scvi.__version__}} + +with open("versions.yml", "w") as f: + f.write(format_yaml_like(versions)) diff --git a/modules/nf-core/scvitools/scar/tests/main.nf.test b/modules/nf-core/scvitools/scar/tests/main.nf.test new file mode 100644 index 00000000000..260d1fd2ce7 --- /dev/null +++ b/modules/nf-core/scvitools/scar/tests/main.nf.test @@ -0,0 +1,53 @@ +nextflow_process { + name 'Test Process SCVITOOLS_SCAR' + script '../main.nf' + process 'SCVITOOLS_SCAR' + config './nextflow.config' + + tag "modules" + tag "modules_nfcore" + tag "scvitools/scar" + tag "scvitools" + + test("test_scar") { + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix_5k.h5ad", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_raw_matrix_5k.h5ad", checkIfExists: true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_scar - stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix_5k.h5ad", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_raw_matrix_5k.h5ad", checkIfExists: true) + ] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/scvitools/scar/tests/main.nf.test.snap b/modules/nf-core/scvitools/scar/tests/main.nf.test.snap new file mode 100644 index 00000000000..8706115105d --- /dev/null +++ b/modules/nf-core/scvitools/scar/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "test_scar - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,ee55dcf6be5d3b14c78b5f6e90bca80f" + ], + "h5ad": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ee55dcf6be5d3b14c78b5f6e90bca80f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-01T22:13:47.031925127" + }, + "test_scar": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,6dfb08913479d02e350e3226974a5458" + ] + ], + "1": [ + "versions.yml:md5,5a7a7b2094bb4abc3384d85d463e7e1f" + ], + "h5ad": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,6dfb08913479d02e350e3226974a5458" + ] + ], + "versions": [ + "versions.yml:md5,5a7a7b2094bb4abc3384d85d463e7e1f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-01T22:13:22.986373532" + } +} \ No newline at end of file diff --git a/modules/nf-core/scvitools/scar/tests/nextflow.config b/modules/nf-core/scvitools/scar/tests/nextflow.config new file mode 100644 index 00000000000..34eea4e9bcb --- /dev/null +++ b/modules/nf-core/scvitools/scar/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: SCVITOOLS_SCAR { + ext.max_epochs = 1 + } + } \ No newline at end of file diff --git a/modules/nf-core/scvitools/scar/tests/tags.yml b/modules/nf-core/scvitools/scar/tests/tags.yml new file mode 100644 index 00000000000..c97d6da7b89 --- /dev/null +++ b/modules/nf-core/scvitools/scar/tests/tags.yml @@ -0,0 +1,2 @@ +scvitools/scar: + - modules/nf-core/scvitools/scar/** From d6dd4ddea1663edbf15f40e089cc16db96e75f1d Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:46:37 +0100 Subject: [PATCH 35/87] Update DetermineContigPloidy and GermlineCNVCaller recipes to limit CPU resource usage (#6926) add env variables --- modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf | 2 ++ modules/nf-core/gatk4/germlinecnvcaller/main.nf | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf b/modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf index 71a67f70320..fc98e80e4aa 100644 --- a/modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf +++ b/modules/nf-core/gatk4/determinegermlinecontigploidy/main.nf @@ -40,6 +40,8 @@ process GATK4_DETERMINEGERMLINECONTIGPLOIDY { } """ export THEANO_FLAGS="base_compiledir=\$PWD" + export OMP_NUM_THREADS=${task.cpus} + export MKL_NUM_THREADS=${task.cpus} gatk --java-options "-Xmx${avail_mem}M -XX:-UsePerfData" \\ DetermineGermlineContigPloidy \\ diff --git a/modules/nf-core/gatk4/germlinecnvcaller/main.nf b/modules/nf-core/gatk4/germlinecnvcaller/main.nf index cd1916ec439..90aa7e47113 100644 --- a/modules/nf-core/gatk4/germlinecnvcaller/main.nf +++ b/modules/nf-core/gatk4/germlinecnvcaller/main.nf @@ -38,6 +38,8 @@ process GATK4_GERMLINECNVCALLER { } """ export THEANO_FLAGS="base_compiledir=\$PWD" + export OMP_NUM_THREADS=${task.cpus} + export MKL_NUM_THREADS=${task.cpus} gatk --java-options "-Xmx${avail_mem}M -XX:-UsePerfData" \\ GermlineCNVCaller \\ From 3dc1bb89a7cad67983650c2c39fc3428ae5df758 Mon Sep 17 00:00:00 2001 From: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:31:32 +0100 Subject: [PATCH 36/87] New module: doubletdetection (#6897) * Added doubletdetection module * added doubletdetection via bioconda * add containeroptions and disable conda * make eclint happy * remove environment.yml * disable conda for stub * remove from conda CI tests * add test.snap * adding numba cache dir to singularity options * removing numba cache dir from py script * new hashes * remove unnecessary braces * change tests * add environment variables --- .github/workflows/test.yml | 2 + modules/nf-core/doubletdetection/main.nf | 48 +++++++++++++ modules/nf-core/doubletdetection/meta.yml | 58 ++++++++++++++++ .../templates/doubletdetection.py | 58 ++++++++++++++++ .../doubletdetection/tests/main.nf.test | 67 +++++++++++++++++++ .../doubletdetection/tests/main.nf.test.snap | 63 +++++++++++++++++ 6 files changed, 296 insertions(+) create mode 100644 modules/nf-core/doubletdetection/main.nf create mode 100644 modules/nf-core/doubletdetection/meta.yml create mode 100644 modules/nf-core/doubletdetection/templates/doubletdetection.py create mode 100644 modules/nf-core/doubletdetection/tests/main.nf.test create mode 100644 modules/nf-core/doubletdetection/tests/main.nf.test.snap diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 12d201a5d51..4985d6b8189 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -550,6 +550,8 @@ jobs: path: modules/nf-core/deepvariant/rundeepvariant - profile: conda path: modules/nf-core/deepvariant/vcfstatsreport + - profile: conda + path: modules/nf-core/doubletdetection - profile: conda path: modules/nf-core/ensemblvep/vep - profile: conda diff --git a/modules/nf-core/doubletdetection/main.nf b/modules/nf-core/doubletdetection/main.nf new file mode 100644 index 00000000000..e3cbadfdcef --- /dev/null +++ b/modules/nf-core/doubletdetection/main.nf @@ -0,0 +1,48 @@ +process DOUBLETDETECTION { + tag "$meta.id" + label 'process_medium' + + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/anndata_louvain_pip_doubletdetection:42d2326cc250350b': + 'community.wave.seqera.io/library/anndata_louvain_pip_doubletdetection:cbe92394c10372fa' }" + + input: + tuple val(meta), path(h5ad) + + output: + tuple val(meta), path("*.h5ad"), emit: h5ad + tuple val(meta), path("*.pkl") , emit: predictions + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DOUBLETDETECTION module does not support Conda. Please use Docker / Singularity / Podman instead." + } + prefix = task.ext.prefix ?: "${meta.id}" + template 'doubletdetection.py' + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DOUBLETDETECTION module does not support Conda. Please use Docker / Singularity / Podman instead." + } + prefix = task.ext.prefix ?: "${meta.id}" + """ + export MPLCONFIGDIR=./tmp + export NUMBA_CACHE_DIR=./tmp + + touch ${prefix}.h5ad + touch ${prefix}.pkl + + cat <<-END_VERSIONS > versions.yml + ${task.process}: + python: \$(python3 -c 'import platform as pf; print(pf.python_version())') + anndata: \$(python3 -c 'import anndata as ad; print(ad.__version__)') + doubletdetection: \$(python3 -c 'import doubletdetection as dt; print(dt.__version__)') + END_VERSIONS + """ +} diff --git a/modules/nf-core/doubletdetection/meta.yml b/modules/nf-core/doubletdetection/meta.yml new file mode 100644 index 00000000000..a6465c06c2f --- /dev/null +++ b/modules/nf-core/doubletdetection/meta.yml @@ -0,0 +1,58 @@ +name: "doubletdetection" +description: Doublet detection in single-cell RNA-seq data +keywords: + - single-cell + - doublets + - doublet_detection +tools: + - "doubletdetection": + description: "Doublet detection in single-cell RNA-seq data" + tool_dev_url: "https://github.com/JonathanShor/DoubletDetection" + doi: "10.5281/zenodo.6349517" + licence: ["MIT"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - h5ad: + type: file + description: H5AD anndata object + pattern: "*.h5ad" + +output: + - h5ad: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.h5ad": + type: file + description: H5AD anndata object + pattern: "*.h5ad" + + - predictions: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.pkl": + type: file + description: pandas dataframe containing the doublet classification + pattern: "*.pkl" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@LeonHafner" +maintainers: + - "@LeonHafner" diff --git a/modules/nf-core/doubletdetection/templates/doubletdetection.py b/modules/nf-core/doubletdetection/templates/doubletdetection.py new file mode 100644 index 00000000000..21538d44449 --- /dev/null +++ b/modules/nf-core/doubletdetection/templates/doubletdetection.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 + +import os +import platform + +os.environ["MPLCONFIGDIR"] = "./tmp" +os.environ["NUMBA_CACHE_DIR"] = "./tmp" + +import anndata as ad +import doubletdetection + + +def format_yaml_like(data: dict, indent: int = 0) -> str: + """Formats a dictionary to a YAML-like string. + + Args: + data (dict): The dictionary to format. + indent (int): The current indentation level. + + Returns: + str: A string formatted as YAML. + """ + yaml_str = "" + for key, value in data.items(): + spaces = " " * indent + if isinstance(value, dict): + yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" + else: + yaml_str += f"{spaces}{key}: {value}\\n" + return yaml_str + + +adata = ad.read_h5ad("${h5ad}") + +clf = doubletdetection.BoostClassifier() +doublets = clf.fit(adata.X).predict() +scores = clf.doublet_score() + +adata.obs["doublet"] = [label == 1 for label in doublets] +adata.obs["doublet_score"] = scores + +adata.write_h5ad("${prefix}.h5ad") + +df = adata.obs[["doublet"]] +df.columns = ["${prefix}"] +df.to_pickle("${prefix}.pkl") + +# Versions +versions = { + "${task.process}": { + "python": platform.python_version(), + "anndata": ad.__version__, + "doubletdetection": doubletdetection.__version__, + } +} + +with open("versions.yml", "w") as f: + f.write(format_yaml_like(versions)) diff --git a/modules/nf-core/doubletdetection/tests/main.nf.test b/modules/nf-core/doubletdetection/tests/main.nf.test new file mode 100644 index 00000000000..8afce5a7be0 --- /dev/null +++ b/modules/nf-core/doubletdetection/tests/main.nf.test @@ -0,0 +1,67 @@ +nextflow_process { + + name "Test Process DOUBLETDETECTION" + script "../main.nf" + process "DOUBLETDETECTION" + + tag "modules" + tag "modules_nfcore" + tag "doubletdetection" + + test("scdownsteam - h5ad") { + when { + process { + """ + input[0] = [ + [id: 'test'], + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix.h5ad", checkIfExists: true) + ] + """ + } + } + + then { + def mb = 1024 * 1024 + def kb = 1024 + assertAll( + { assert process.success }, + + // Only check if output exists, as phenotype supports no random seeding: + // https://github.com/jacoblevine/PhenoGraph/issues/16 + { assert path(process.out.h5ad.get(0).get(1)).exists() }, + { assert path(process.out.predictions.get(0).get(1)).exists() }, + + { assert path(process.out.h5ad.get(0).get(1)).size() > 30 * mb }, + { assert path(process.out.predictions.get(0).get(1)).size() > 50 * kb }, + + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("scdownstream - h5ad - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id: 'test'], + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix.h5ad", checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/doubletdetection/tests/main.nf.test.snap b/modules/nf-core/doubletdetection/tests/main.nf.test.snap new file mode 100644 index 00000000000..c0922386e51 --- /dev/null +++ b/modules/nf-core/doubletdetection/tests/main.nf.test.snap @@ -0,0 +1,63 @@ +{ + "scdownstream - h5ad - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.pkl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,b339d31cdc0422b203a26440591e1f12" + ], + "h5ad": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "predictions": [ + [ + { + "id": "test" + }, + "test.pkl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,b339d31cdc0422b203a26440591e1f12" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-01T09:38:38.099329542" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,b339d31cdc0422b203a26440591e1f12" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-01T09:38:20.985491914" + } +} \ No newline at end of file From f7d2d43086b48d3cedd9e2df52bf098ee5a50542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20M=C3=B6bbs?= <64787947+alanmmobbs93@users.noreply.github.com> Date: Mon, 4 Nov 2024 12:45:12 -0300 Subject: [PATCH 37/87] Set mkfastq reports and stats outputs to optional (#6932) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit set reports and stats outputs to optional Co-authored-by: Nicolás Schcolnicov <90359308+nschcolnicov@users.noreply.github.com> --- modules/nf-core/cellranger/mkfastq/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/cellranger/mkfastq/main.nf b/modules/nf-core/cellranger/mkfastq/main.nf index 09480345aac..89a1a824292 100644 --- a/modules/nf-core/cellranger/mkfastq/main.nf +++ b/modules/nf-core/cellranger/mkfastq/main.nf @@ -10,8 +10,8 @@ process CELLRANGER_MKFASTQ { output: tuple val(meta), path("*_outs/outs/fastq_path/**/*.fastq.gz") , emit: fastq tuple val(meta), path("*_outs/outs/fastq_path/Undetermined*.fastq.gz") , optional:true, emit: undetermined_fastq - tuple val(meta), path("*_outs/outs/fastq_path/Reports") , emit: reports - tuple val(meta), path("*_outs/outs/fastq_path/Stats") , emit: stats + tuple val(meta), path("*_outs/outs/fastq_path/Reports") , optional:true, emit: reports + tuple val(meta), path("*_outs/outs/fastq_path/Stats") , optional:true, emit: stats tuple val(meta), path("*_outs/outs/interop_path/*.bin") , emit: interop path "versions.yml" , emit: versions From 9deee8f0a2f91fa0a09246c23efdb921054e59d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:53:19 +1300 Subject: [PATCH 38/87] Update pre-commit hook renovatebot/pre-commit-hooks to v39 (#6933) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 430e48ac3dd..a2770405ef1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: args: ["--schemafile", "subworkflows/yaml-schema.json"] - id: check-github-workflows - repo: https://github.com/renovatebot/pre-commit-hooks - rev: 38.46.0 + rev: 39.0.0 hooks: - id: renovate-config-validator # use ruff for python files From e022a63cf476b17facaa6ac2be5e77cc460964f5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:39:29 +0100 Subject: [PATCH 39/87] Update conda-incubator/setup-miniconda digest to d2e6a04 (#6936) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4985d6b8189..3f830774ec8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -436,7 +436,7 @@ jobs: mkdir -p $NXF_SINGULARITY_LIBRARYDIR - name: Set up miniconda - uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3 + uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3 with: miniconda-version: "latest" channels: conda-forge,bioconda @@ -713,7 +713,7 @@ jobs: - name: Set up miniconda if: matrix.profile == 'conda' - uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3 + uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3 with: miniconda-version: "latest" auto-update-conda: true From 1d8a57b69fa4159556ad929c6786ba265050ece7 Mon Sep 17 00:00:00 2001 From: Simon Pearce <24893913+SPPearce@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:24:24 +0000 Subject: [PATCH 40/87] Convert ultraplex to nf-test (#5706) * Convert ultraplex to nf-test * Add mv command to rename the matching files to be able to filter out the nonmatching * Update modules/nf-core/ultraplex/main.nf Co-authored-by: Mahesh Binzer-Panchal * Add prefix and update stub * Remove optional value input, refactor, bump versions * Fix linting --------- Co-authored-by: Mahesh Binzer-Panchal --- modules/nf-core/ultraplex/environment.yml | 2 +- modules/nf-core/ultraplex/main.nf | 64 +++--- modules/nf-core/ultraplex/meta.yml | 21 +- .../nf-core/ultraplex/tests/adapter.config | 6 + modules/nf-core/ultraplex/tests/main.nf.test | 143 ++++++++++++++ .../nf-core/ultraplex/tests/main.nf.test.snap | 187 ++++++++++++++++++ modules/nf-core/ultraplex/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/ultraplex/main.nf | 41 ---- .../modules/nf-core/ultraplex/nextflow.config | 5 - tests/modules/nf-core/ultraplex/test.yml | 44 ----- 11 files changed, 390 insertions(+), 128 deletions(-) create mode 100644 modules/nf-core/ultraplex/tests/adapter.config create mode 100644 modules/nf-core/ultraplex/tests/main.nf.test create mode 100644 modules/nf-core/ultraplex/tests/main.nf.test.snap create mode 100644 modules/nf-core/ultraplex/tests/tags.yml delete mode 100644 tests/modules/nf-core/ultraplex/main.nf delete mode 100644 tests/modules/nf-core/ultraplex/nextflow.config delete mode 100644 tests/modules/nf-core/ultraplex/test.yml diff --git a/modules/nf-core/ultraplex/environment.yml b/modules/nf-core/ultraplex/environment.yml index df623d5cabd..2c5b12669cf 100644 --- a/modules/nf-core/ultraplex/environment.yml +++ b/modules/nf-core/ultraplex/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::ultraplex=1.2.5 + - bioconda::ultraplex=1.2.9 diff --git a/modules/nf-core/ultraplex/main.nf b/modules/nf-core/ultraplex/main.nf index 2cadbe703fb..dd37d5a9ef5 100644 --- a/modules/nf-core/ultraplex/main.nf +++ b/modules/nf-core/ultraplex/main.nf @@ -4,19 +4,18 @@ process ULTRAPLEX { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/ultraplex:1.2.5--py38h4a8c8d9_0' : - 'biocontainers/ultraplex:1.2.5--py38h4a8c8d9_0' }" + 'https://depot.galaxyproject.org/singularity/ultraplex:1.2.9--py39hf95cd2a_1' : + 'biocontainers/ultraplex:1.2.9--py39hf95cd2a_1' }" input: tuple val(meta), path(reads) path(barcode_file) - val(adapter_seq) output: - tuple val(meta), path("*[!no_match].fastq.gz"), emit: fastq - tuple val(meta), path("*no_match.fastq.gz"), optional: true, emit: no_match_fastq - path "*.log", emit: report - path "versions.yml", emit: versions + tuple val(meta), path("*_matched.fastq.gz") , emit: fastq + tuple val(meta), path("*_no_match_*.fastq.gz") , emit: no_match_fastq, optional: true + path "*.log" , emit: report + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -25,28 +24,43 @@ process ULTRAPLEX { def VERSION = "1.2.5" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" + def input2 = reads.toList().size() > 1 ? "--input_2 ${reads[1]}": "" - def adapter_seq_command = '' - if(adapter_seq) { - adapter_seq_command = "--adapter ${adapter_seq}" - } - - read_list = reads.collect{it.toString()} - if (read_list.size > 1){ - ultraplex_command = """ultraplex \\ - --inputfastq ${read_list[0]} \\ - --input_2 ${read_list[1]} \\ - --barcodes $barcode_file \\ - --threads $task.cpus $args $adapter_seq_command""" - } else { - ultraplex_command = """ultraplex \\ - --inputfastq ${read_list[0]} \\ + """ + ultraplex \\ + --inputfastq ${reads[0]} \\ + $input2 \\ --barcodes $barcode_file \\ - --threads $task.cpus $args $adapter_seq_command""" - } + --threads $task.cpus \\ + --outputprefix ${prefix} \\ + $args + + ## rename the matched files to be able to emit only the matched files + MATCHES=\$( find . -type f -name '*.fastq.gz' ! -name '*_no_match_*.fastq.gz' ) + for MATCH in \$MATCHES; do + mv \$MATCH \${MATCH/.fastq.gz/_matched.fastq.gz} + done + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ultraplex: $VERSION + END_VERSIONS """ - ${ultraplex_command} + + stub: + def VERSION = "1.2.5" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + echo "" | gzip > ultraplex_${prefix}_Sample1_Fwd_matched.fastq.gz + echo "" | gzip > ultraplex_${prefix}_Sample1_Rev_matched.fastq.gz + echo "" | gzip > ultraplex_${prefix}_Sample2_Fwd_matched.fastq.gz + echo "" | gzip > ultraplex_${prefix}_Sample2_Rev_matched.fastq.gz + echo "" | gzip > ultraplex_${prefix}_no_match_Fwd.fastq.gz + echo "" | gzip > ultraplex_${prefix}_no_match_Rev.fastq.gz + + touch ultraplex.log + cat <<-END_VERSIONS > versions.yml "${task.process}": ultraplex: $VERSION diff --git a/modules/nf-core/ultraplex/meta.yml b/modules/nf-core/ultraplex/meta.yml index 581c64c12d8..6da6703b89f 100644 --- a/modules/nf-core/ultraplex/meta.yml +++ b/modules/nf-core/ultraplex/meta.yml @@ -26,9 +26,6 @@ input: - - barcode_file: type: file description: FASTQ file containing barcode sequences - - - adapter_seq: - type: string - description: adapter sequence output: - fastq: - meta: @@ -36,9 +33,12 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - "*[!no_match].fastq.gz": - type: file - description: Demultiplexed sample FASTQ files + pattern: "*[!no_match].fastq.gz" + - "*_matched.fastq.gz": + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] pattern: "*[!no_match].fastq.gz" - no_match_fastq: - meta: @@ -46,9 +46,12 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - "*no_match.fastq.gz": - type: file - description: FASTQ file containing reads that could not be demultiplexed + pattern: "*no_match.fastq.gz" + - "*_no_match_*.fastq.gz": + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] pattern: "*no_match.fastq.gz" - report: - "*.log": diff --git a/modules/nf-core/ultraplex/tests/adapter.config b/modules/nf-core/ultraplex/tests/adapter.config new file mode 100644 index 00000000000..646cde3b2e5 --- /dev/null +++ b/modules/nf-core/ultraplex/tests/adapter.config @@ -0,0 +1,6 @@ +process { + withName: ULTRAPLEX { + ext.args = '--adapter "AGATCGGAAGAGCGGTTCAG"' + } +} + diff --git a/modules/nf-core/ultraplex/tests/main.nf.test b/modules/nf-core/ultraplex/tests/main.nf.test new file mode 100644 index 00000000000..f63234430a1 --- /dev/null +++ b/modules/nf-core/ultraplex/tests/main.nf.test @@ -0,0 +1,143 @@ +nextflow_process { + + name "Test Process ULTRAPLEX" + script "../main.nf" + process "ULTRAPLEX" + + tag "modules" + tag "modules_nfcore" + tag "ultraplex" + + test("ultraplex") { + + when { + process { + """ + input[0] = [[id: "test"], + file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true) + ] + input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fastq, + process.out.no_match_fastq, + process.out.versions).match()}, + { assert process.out.report.get(0) ==~ ".*ultraplex_.*.log" } + ) + + } + + } + + test("ultraplex - adaptor") { + config "./adapter.config" + when { + process { + """ + input[0] = [[id: "test"], + file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true) + ] + input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fastq, + process.out.no_match_fastq, + process.out.versions).match()}, + { assert process.out.report.get(0) ==~ ".*ultraplex_.*.log" } + ) + } + + } + + test("ultraplex - pairedend") { + + when { + process { + """ + input[0] = [[id: "test"], + [file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed2.fastq.gz", checkIfExists: true)] + ] + input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fastq, + process.out.no_match_fastq, + process.out.versions).match()}, + { assert process.out.report.get(0) ==~ ".*ultraplex_.*.log" } + ) + } + + } + + test("ultraplex - incorrect barcodes") { + + when { + process { + """ + input[0] = [[id: "test"], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) ] + ] + input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.fastq, + process.out.no_match_fastq, + process.out.versions).match()}, + { assert process.out.report.get(0) ==~ ".*ultraplex_.*.log" } + ) + } + + } + + + test("ultraplex - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [[id: "test"], + file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true) + ] + input[1] = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ultraplex/tests/main.nf.test.snap b/modules/nf-core/ultraplex/tests/main.nf.test.snap new file mode 100644 index 00000000000..8a3faa10902 --- /dev/null +++ b/modules/nf-core/ultraplex/tests/main.nf.test.snap @@ -0,0 +1,187 @@ +{ + "ultraplex - incorrect barcodes": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample2_Fwd_matched.fastq.gz:md5,90f3fbd22231be183183e28d654187b4", + "ultraplex_test_Sample2_Rev_matched.fastq.gz:md5,51f012b2cf351c90f02c12ed9145bd13" + ] + ] + ], + [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_5bc_no_match_Fwd.fastq.gz:md5,bcc37d4eb1f4f0dd99d2b04edc796372", + "ultraplex_test_5bc_no_match_Rev.fastq.gz:md5,4b130aa8958473bc8431f8f10eaa3d0e" + ] + ] + ], + [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-05T15:32:19.415912323" + }, + "ultraplex - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample1_Fwd_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample1_Rev_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample2_Fwd_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample2_Rev_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_no_match_Fwd.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_no_match_Rev.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "2": [ + "ultraplex.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "3": [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ], + "fastq": [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample1_Fwd_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample1_Rev_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample2_Fwd_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_Sample2_Rev_matched.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "no_match_fastq": [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_no_match_Fwd.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "ultraplex_test_no_match_Rev.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "report": [ + "ultraplex.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-05T09:50:04.652996086" + }, + "ultraplex - adaptor": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample1_matched.fastq.gz:md5,77870ddf54ed3e474d4bb63fea65fc08", + "ultraplex_test_Sample2_matched.fastq.gz:md5,f3960ec2757672915538923ecb3539f8" + ] + ] + ], + [ + + ], + [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-05T15:26:35.915305416" + }, + "ultraplex": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample1_matched.fastq.gz:md5,e124c75ec37ca749d2e3b1c4d2df8bee", + "ultraplex_test_Sample2_matched.fastq.gz:md5,d6511d01612d6cc9d3a5adf51463acd4" + ] + ] + ], + [ + + ], + [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-05T15:31:43.618908348" + }, + "ultraplex - pairedend": { + "content": [ + [ + [ + { + "id": "test" + }, + [ + "ultraplex_test_Sample1_Fwd_matched.fastq.gz:md5,3bb209e3beb8947bbdd0fee188af847a", + "ultraplex_test_Sample1_Rev_matched.fastq.gz:md5,85de24c24e656b60ed9dbcaee094b1a6", + "ultraplex_test_Sample2_Fwd_matched.fastq.gz:md5,9ec442ca4692d53511ac6691cdc93226", + "ultraplex_test_Sample2_Rev_matched.fastq.gz:md5,3efaf68cd2f752c9142537e94018ce55" + ] + ] + ], + [ + + ], + [ + "versions.yml:md5,916995657ca9c5fd70171d69c3aba409" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.2" + }, + "timestamp": "2024-06-05T15:32:08.522317182" + } +} \ No newline at end of file diff --git a/modules/nf-core/ultraplex/tests/tags.yml b/modules/nf-core/ultraplex/tests/tags.yml new file mode 100644 index 00000000000..c495725a61b --- /dev/null +++ b/modules/nf-core/ultraplex/tests/tags.yml @@ -0,0 +1,2 @@ +ultraplex: + - "modules/nf-core/ultraplex/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 832f747e594..9725d866a2d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -753,9 +753,6 @@ ultra/index: ultra/pipeline: - modules/nf-core/ultra/pipeline/** - tests/modules/nf-core/ultra/pipeline/** -ultraplex: - - modules/nf-core/ultraplex/** - - tests/modules/nf-core/ultraplex/** umitools/group: - modules/nf-core/umitools/group/** - tests/modules/nf-core/umitools/group/** diff --git a/tests/modules/nf-core/ultraplex/main.nf b/tests/modules/nf-core/ultraplex/main.nf deleted file mode 100644 index 7b664722e54..00000000000 --- a/tests/modules/nf-core/ultraplex/main.nf +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { ULTRAPLEX } from '../../../../modules/nf-core/ultraplex/main.nf' - -workflow test_ultraplex { - - barcodes = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) - input = [[id: "test"], file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true)] - - ULTRAPLEX ( - input, - barcodes, - "" - ) -} - -workflow test_ultraplex_adaptor { - - barcodes = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) - input = [[id: "test"], file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true)] - - ULTRAPLEX ( - input, - barcodes, - "AGATCGGAAGAGCGGTTCAG" - ) -} - -workflow test_ultraplex_pairedend { - - barcodes = file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/barcodes.csv", checkIfExists: true) - input = [[id: "test"], [file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed.fastq.gz", checkIfExists: true), file("https://raw.githubusercontent.com/nf-core/test-datasets/clipseq/reads/multiplexed2.fastq.gz", checkIfExists: true)]] - - ULTRAPLEX ( - input, - barcodes, - "" - ) -} diff --git a/tests/modules/nf-core/ultraplex/nextflow.config b/tests/modules/nf-core/ultraplex/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/ultraplex/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/ultraplex/test.yml b/tests/modules/nf-core/ultraplex/test.yml deleted file mode 100644 index dceaafc8ba1..00000000000 --- a/tests/modules/nf-core/ultraplex/test.yml +++ /dev/null @@ -1,44 +0,0 @@ -- name: ultraplex test_ultraplex - command: nextflow run ./tests/modules/nf-core/ultraplex -entry test_ultraplex -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ultraplex/nextflow.config - tags: - - ultraplex - files: - - path: output/ultraplex/ultraplex_demux_Sample1.fastq.gz - contains: - - "@SN1078:141:7:1101:2587:1991_30rbc:NTGAA" - - path: output/ultraplex/ultraplex_demux_Sample2.fastq.gz - contains: - - "@SN1078:141:7:1101:2427:1974_18rbc:NGCTG" - - path: output/ultraplex/versions.yml - -- name: ultraplex test_ultraplex_adaptor - command: nextflow run ./tests/modules/nf-core/ultraplex -entry test_ultraplex_adaptor -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ultraplex/nextflow.config - tags: - - ultraplex - files: - - path: output/ultraplex/ultraplex_demux_Sample1.fastq.gz - contains: - - "@SN1078:141:7:1101:2587:1991_30rbc:NTGAA" - - path: output/ultraplex/ultraplex_demux_Sample2.fastq.gz - contains: - - "@SN1078:141:7:1101:2427:1974_18rbc:NGCTG" - - path: output/ultraplex/versions.yml - -- name: ultraplex test_ultraplex_pairedend - command: nextflow run ./tests/modules/nf-core/ultraplex -entry test_ultraplex_pairedend -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ultraplex/nextflow.config - tags: - - ultraplex - files: - - path: output/ultraplex/ultraplex_demux_Sample1_Fwd.fastq.gz - contains: - - "@SN1078:141:7:1101:2587:1991_30rbc:NTGAA" - - path: output/ultraplex/ultraplex_demux_Sample1_Rev.fastq.gz - contains: - - "@SN1078:141:7:1101:2587:1991_30rbc:NTGAA" - - path: output/ultraplex/ultraplex_demux_Sample2_Fwd.fastq.gz - contains: - - "@SN1078:141:7:1101:2427:1974_18rbc:NGCTG" - - path: output/ultraplex/ultraplex_demux_Sample2_Rev.fastq.gz - contains: - - "@SN1078:141:7:1101:2427:1974_18rbc:NGCTG" - - path: output/ultraplex/versions.yml From f888300c726e1f817a9f93a680866ff7e6c669f6 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:30:32 +0100 Subject: [PATCH 41/87] Change inputs for genmod (#6928) --- modules/nf-core/genmod/models/main.nf | 3 +-- modules/nf-core/genmod/models/meta.yml | 4 ++-- modules/nf-core/genmod/models/tests/main.nf.test | 12 ++++++------ modules/nf-core/genmod/score/main.nf | 3 +-- modules/nf-core/genmod/score/meta.yml | 4 ++-- modules/nf-core/genmod/score/tests/main.nf.test | 12 ++++++------ 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/modules/nf-core/genmod/models/main.nf b/modules/nf-core/genmod/models/main.nf index ff71b660fb5..a869221e9be 100644 --- a/modules/nf-core/genmod/models/main.nf +++ b/modules/nf-core/genmod/models/main.nf @@ -8,8 +8,7 @@ process GENMOD_MODELS { 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: - tuple val(meta), path(input_vcf) - path (fam) + tuple val(meta), path(input_vcf), path (fam) path (reduced_penetrance) output: diff --git a/modules/nf-core/genmod/models/meta.yml b/modules/nf-core/genmod/models/meta.yml index dca74095080..a6249114a52 100644 --- a/modules/nf-core/genmod/models/meta.yml +++ b/modules/nf-core/genmod/models/meta.yml @@ -22,9 +22,9 @@ input: type: file description: vcf file pattern: "*.{vcf}" - - - fam: + - fam: type: file - description: file with family information + description: PED file with family information - - reduced_penetrance: type: file description: file with gene ids that have reduced penetrance diff --git a/modules/nf-core/genmod/models/tests/main.nf.test b/modules/nf-core/genmod/models/tests/main.nf.test index afa85dfc626..0b9a3ebd011 100644 --- a/modules/nf-core/genmod/models/tests/main.nf.test +++ b/modules/nf-core/genmod/models/tests/main.nf.test @@ -15,10 +15,10 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) - input[2] = [] + input[1] = [] """ } } @@ -44,10 +44,10 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) - input[2] = [] + input[1] = [] """ } } diff --git a/modules/nf-core/genmod/score/main.nf b/modules/nf-core/genmod/score/main.nf index 41d57bdc194..756fc73132a 100644 --- a/modules/nf-core/genmod/score/main.nf +++ b/modules/nf-core/genmod/score/main.nf @@ -8,8 +8,7 @@ process GENMOD_SCORE { 'biocontainers/genmod:3.9--pyhdfd78af_0' }" input: - tuple val(meta), path(input_vcf) - path (fam) + tuple val(meta), path(input_vcf), path (fam) path (score_config) output: diff --git a/modules/nf-core/genmod/score/meta.yml b/modules/nf-core/genmod/score/meta.yml index 32da6468d2c..c5fe2e2ac2b 100644 --- a/modules/nf-core/genmod/score/meta.yml +++ b/modules/nf-core/genmod/score/meta.yml @@ -22,9 +22,9 @@ input: type: file description: vcf file pattern: "*.{vcf}" - - - fam: + - fam: type: file - description: file with family information + description: PED file with family information - - score_config: type: file description: rank model config file diff --git a/modules/nf-core/genmod/score/tests/main.nf.test b/modules/nf-core/genmod/score/tests/main.nf.test index 98c8f35ae2d..6181f63aeac 100644 --- a/modules/nf-core/genmod/score/tests/main.nf.test +++ b/modules/nf-core/genmod/score/tests/main.nf.test @@ -15,10 +15,10 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) - input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/genmod/svrank_model_-v1.8-.ini', checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/genmod/svrank_model_-v1.8-.ini', checkIfExists: true) """ } } @@ -44,10 +44,10 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz', checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) ] - input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/vcf/ped/justhusky.ped', checkIfExists: true) - input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/genmod/svrank_model_-v1.8-.ini', checkIfExists: true) + input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/genmod/svrank_model_-v1.8-.ini', checkIfExists: true) """ } } From 26cdbf29e76695c7fd85e42e0015c7e96f979fe9 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:02:10 +0100 Subject: [PATCH 42/87] Bump stranger (#6922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump stranger * use docker snapshots --------- Co-authored-by: Matthias Hörtenhuber --- modules/nf-core/stranger/environment.yml | 2 +- modules/nf-core/stranger/main.nf | 4 ++-- modules/nf-core/stranger/tests/main.nf.test | 2 +- .../nf-core/stranger/tests/main.nf.test.snap | 20 +++++++++---------- .../nf-core/stranger/tests/nextflow.config | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/nf-core/stranger/environment.yml b/modules/nf-core/stranger/environment.yml index 910bcae7d2d..c476e2b3674 100644 --- a/modules/nf-core/stranger/environment.yml +++ b/modules/nf-core/stranger/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::stranger=0.9.1 + - bioconda::stranger=0.9.2 diff --git a/modules/nf-core/stranger/main.nf b/modules/nf-core/stranger/main.nf index 923483f4fe4..bc31e703a26 100644 --- a/modules/nf-core/stranger/main.nf +++ b/modules/nf-core/stranger/main.nf @@ -4,8 +4,8 @@ process STRANGER { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/stranger:0.9.1--pyh7e72e81_0': - 'biocontainers/stranger:0.9.1--pyh7e72e81_0' }" + 'https://depot.galaxyproject.org/singularity/stranger:0.9.2--pyh7e72e81_0': + 'biocontainers/stranger:0.9.2--pyh7e72e81_0' }" input: tuple val(meta), path(vcf) diff --git a/modules/nf-core/stranger/tests/main.nf.test b/modules/nf-core/stranger/tests/main.nf.test index 13c61f43fb2..3c12a2c53f8 100644 --- a/modules/nf-core/stranger/tests/main.nf.test +++ b/modules/nf-core/stranger/tests/main.nf.test @@ -15,7 +15,7 @@ nextflow_process { script "../../expansionhunter/main.nf" process { """ - input[0] = [ + input[0] = [ [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) diff --git a/modules/nf-core/stranger/tests/main.nf.test.snap b/modules/nf-core/stranger/tests/main.nf.test.snap index 3faa4e581d4..b0ce7380152 100644 --- a/modules/nf-core/stranger/tests/main.nf.test.snap +++ b/modules/nf-core/stranger/tests/main.nf.test.snap @@ -11,7 +11,7 @@ ] ], "1": [ - "versions.yml:md5,68446c9e91e20825f7430db64e85aa7c" + "versions.yml:md5,a3f4f3b2391e96e77caa158199436fcb" ], "vcf": [ [ @@ -22,15 +22,15 @@ ] ], "versions": [ - "versions.yml:md5,68446c9e91e20825f7430db64e85aa7c" + "versions.yml:md5,a3f4f3b2391e96e77caa158199436fcb" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-07-03T08:09:27.725425094" + "timestamp": "2024-11-04T10:27:41.164430492" }, "homo_sapiens - vcf, repeat_catalogue": { "content": [ @@ -44,7 +44,7 @@ ] ], "1": [ - "versions.yml:md5,68446c9e91e20825f7430db64e85aa7c" + "versions.yml:md5,a3f4f3b2391e96e77caa158199436fcb" ], "vcf": [ [ @@ -55,14 +55,14 @@ ] ], "versions": [ - "versions.yml:md5,68446c9e91e20825f7430db64e85aa7c" + "versions.yml:md5,a3f4f3b2391e96e77caa158199436fcb" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-07-03T08:09:14.472394433" + "timestamp": "2024-11-04T10:27:31.05008915" } } \ No newline at end of file diff --git a/modules/nf-core/stranger/tests/nextflow.config b/modules/nf-core/stranger/tests/nextflow.config index 98459330fdc..0ddc8bbda8f 100644 --- a/modules/nf-core/stranger/tests/nextflow.config +++ b/modules/nf-core/stranger/tests/nextflow.config @@ -1,5 +1,5 @@ process { - withName: 'STRANGER' { - ext.prefix = "stranger" - } - } + withName: 'STRANGER' { + ext.prefix = "stranger" + } +} From a8ad84b7ee0cda0b001490e95d9ed277e687e368 Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:25:07 +0100 Subject: [PATCH 43/87] Update SVDB merge label (#6916) --- modules/nf-core/svdb/merge/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/svdb/merge/main.nf b/modules/nf-core/svdb/merge/main.nf index 96d21eba910..24c5effd4e5 100644 --- a/modules/nf-core/svdb/merge/main.nf +++ b/modules/nf-core/svdb/merge/main.nf @@ -1,6 +1,6 @@ process SVDB_MERGE { tag "$meta.id" - label 'process_medium' + label 'process_single' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/mulled-v2-375a758a4ca8c128fb9d38047a68a9f4322d2acd:b3615e06ef17566f2988a215ce9e10808c1d08bf-0': From 78991a2306e7631c006498a372e87f135a4212db Mon Sep 17 00:00:00 2001 From: Matthias Zepper <6963520+MatthiasZepper@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:20:50 +0100 Subject: [PATCH 44/87] Update Version of UMICollapse to 1.1.0 (#6805) * Bump Version of UMICollapse to 1.1.0 * Update test snapshots for umicollapse. --------- Co-authored-by: Matthias Zepper Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/umicollapse/environment.yml | 2 +- modules/nf-core/umicollapse/main.nf | 6 ++--- modules/nf-core/umicollapse/meta.yml | 3 ++- .../umicollapse/tests/main.nf.test.snap | 24 +++++++++---------- .../tests/main.nf.test.snap | 4 ++-- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/modules/nf-core/umicollapse/environment.yml b/modules/nf-core/umicollapse/environment.yml index 3847980dde4..066f55eef72 100644 --- a/modules/nf-core/umicollapse/environment.yml +++ b/modules/nf-core/umicollapse/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::umicollapse=1.0.0 + - bioconda::umicollapse=1.1.0 diff --git a/modules/nf-core/umicollapse/main.nf b/modules/nf-core/umicollapse/main.nf index dae290e6e7a..aec10e85194 100644 --- a/modules/nf-core/umicollapse/main.nf +++ b/modules/nf-core/umicollapse/main.nf @@ -5,8 +5,8 @@ process UMICOLLAPSE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/umicollapse:1.0.0--hdfd78af_1' : - 'biocontainers/umicollapse:1.0.0--hdfd78af_1' }" + 'https://depot.galaxyproject.org/singularity/umicollapse:1.1.0--hdfd78af_0' : + 'biocontainers/umicollapse:1.1.0--hdfd78af_0' }" input: tuple val(meta), path(input), path(bai) @@ -24,7 +24,7 @@ process UMICOLLAPSE { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = '1.0.0-1' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def VERSION = '1.1.0-0' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. // Memory allocation: We need to make sure that both heap and stack size is sufficiently large for // umicollapse. We set the stack size to 5% of the available memory, the heap size to 90% // which leaves 5% for stuff happening outside of java without the scheduler killing the process. diff --git a/modules/nf-core/umicollapse/meta.yml b/modules/nf-core/umicollapse/meta.yml index 8b366c24438..7c4ebc5ec27 100644 --- a/modules/nf-core/umicollapse/meta.yml +++ b/modules/nf-core/umicollapse/meta.yml @@ -11,7 +11,7 @@ tools: (UMIs)/Random Molecular Tags (RMTs)." homepage: "https://github.com/Daniel-Liu-c0deb0t/UMICollapse" documentation: "https://github.com/Daniel-Liu-c0deb0t/UMICollapse" - tool_dev_url: "https://github.com/Daniel-Liu-c0deb0t/UMICollapse" + tool_dev_url: "https://github.com/siddharthab/UMICollapse" doi: "10.7717/peerj.8275" licence: ["MIT"] identifier: "" @@ -78,4 +78,5 @@ maintainers: - "@CharlotteAnne" - "@chris-cheshire" - "@apeltzer" + - "@siddharthab" - "@MatthiasZepper" diff --git a/modules/nf-core/umicollapse/tests/main.nf.test.snap b/modules/nf-core/umicollapse/tests/main.nf.test.snap index 3f393eac1ad..bf6d5f30cb4 100644 --- a/modules/nf-core/umicollapse/tests/main.nf.test.snap +++ b/modules/nf-core/umicollapse/tests/main.nf.test.snap @@ -11,14 +11,14 @@ ] ], [ - "versions.yml:md5,c1e0275d81b1c97a9344d216f9154996" + "versions.yml:md5,03fdbcb1ba9bd40325ca42859d39deb1" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-20T08:47:11.402203361" + "timestamp": "2024-10-22T10:43:04.890267074" }, "umicollapse fastq tests": { "content": [ @@ -32,14 +32,14 @@ ] ], [ - "versions.yml:md5,c1e0275d81b1c97a9344d216f9154996" + "versions.yml:md5,03fdbcb1ba9bd40325ca42859d39deb1" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-01-30T10:45:56.053352008" + "timestamp": "2024-10-22T10:43:45.691571914" }, "umicollapse stub tests": { "content": [ @@ -112,13 +112,13 @@ ] ], [ - "versions.yml:md5,c1e0275d81b1c97a9344d216f9154996" + "versions.yml:md5,03fdbcb1ba9bd40325ca42859d39deb1" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-20T08:47:30.028323337" + "timestamp": "2024-10-22T10:43:33.250587075" } } \ No newline at end of file diff --git a/subworkflows/nf-core/bam_dedup_stats_samtools_umicollapse/tests/main.nf.test.snap b/subworkflows/nf-core/bam_dedup_stats_samtools_umicollapse/tests/main.nf.test.snap index ccb96576367..f2b1fb20d9a 100644 --- a/subworkflows/nf-core/bam_dedup_stats_samtools_umicollapse/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_dedup_stats_samtools_umicollapse/tests/main.nf.test.snap @@ -49,7 +49,7 @@ [ "versions.yml:md5,20605eb79c410c0ed179ba660d82f75b", "versions.yml:md5,23617661d2c899996bee2b05db027e25", - "versions.yml:md5,268e43f34038d4c6146ed050630f95b4", + "versions.yml:md5,657bce03545b4c57f9c5fc4314bf85f7", "versions.yml:md5,e02a62a393a833778e16542eeed0d148", "versions.yml:md5,ef00762e264b99ac45713dc0dedf4060" ] @@ -58,7 +58,7 @@ "nf-test": "0.9.0", "nextflow": "24.04.4" }, - "timestamp": "2024-09-16T08:04:02.126366857" + "timestamp": "2024-10-22T10:44:38.266860983" }, "test_bam_dedup_stats_samtools_umicollapse_idxstats": { "content": [ From 3ea318161b8788623cec477bde0f089180b2245b Mon Sep 17 00:00:00 2001 From: "Diego Alvarez S." Date: Tue, 5 Nov 2024 09:37:36 -0300 Subject: [PATCH 45/87] Bump checkm/qa version (#6919) * Bump checkm/qa version, add test * Remove checkm/qa from pytest * Address review comments * Update snapshot * Add stub test * Update * add missing prefix definition * add correct file hashes from local testing --------- Co-authored-by: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> --- modules/nf-core/checkm/lineagewf/main.nf | 34 ++++--- .../checkm/lineagewf/tests/main.nf.test | 27 +++++- .../checkm/lineagewf/tests/main.nf.test.snap | 83 +++++++++++++++- modules/nf-core/checkm/qa/environment.yml | 2 +- modules/nf-core/checkm/qa/main.nf | 31 ++++-- modules/nf-core/checkm/qa/tests/main.nf.test | 88 +++++++++++++++++ .../nf-core/checkm/qa/tests/main.nf.test.snap | 96 +++++++++++++++++++ modules/nf-core/checkm/qa/tests/tags.yml | 3 + tests/config/pytest_modules.yml | 3 - 9 files changed, 336 insertions(+), 31 deletions(-) create mode 100644 modules/nf-core/checkm/qa/tests/main.nf.test create mode 100644 modules/nf-core/checkm/qa/tests/main.nf.test.snap create mode 100644 modules/nf-core/checkm/qa/tests/tags.yml diff --git a/modules/nf-core/checkm/lineagewf/main.nf b/modules/nf-core/checkm/lineagewf/main.nf index c2183461b10..67fd8f35958 100644 --- a/modules/nf-core/checkm/lineagewf/main.nf +++ b/modules/nf-core/checkm/lineagewf/main.nf @@ -4,8 +4,8 @@ process CHECKM_LINEAGEWF { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/checkm-genome:1.2.3--pyhdfd78af_0' : - 'biocontainers/checkm-genome:1.2.3--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/checkm-genome:1.2.3--pyhdfd78af_1' : + 'biocontainers/checkm-genome:1.2.3--pyhdfd78af_1' }" input: tuple val(meta), path(fasta, stageAs: "input_bins/*") @@ -22,22 +22,34 @@ process CHECKM_LINEAGEWF { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" - checkm_db = db ? "export CHECKM_DATA_PATH=${db}" : "" + def args = task.ext.args ?: '' + def checkm_db = db ? "export CHECKM_DATA_PATH=${db}" : "" + prefix = task.ext.prefix ?: "${meta.id}" """ - $checkm_db + ${checkm_db} checkm \\ lineage_wf \\ - -t $task.cpus \\ + -t ${task.cpus} \\ -f ${prefix}.tsv \\ --tab_table \\ - --pplacer_threads $task.cpus \\ - -x $fasta_ext \\ - $args \\ + --pplacer_threads ${task.cpus} \\ + -x ${fasta_ext} \\ + ${args} \\ input_bins/ \\ - $prefix + ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + checkm: \$( checkm 2>&1 | grep '...:::' | sed 's/.*CheckM v//;s/ .*//' ) + END_VERSIONS + """ + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir ${prefix}/ + touch ${prefix}/lineage.ms ${prefix}.tsv cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/checkm/lineagewf/tests/main.nf.test b/modules/nf-core/checkm/lineagewf/tests/main.nf.test index 28dfb46f363..8d60100e04f 100644 --- a/modules/nf-core/checkm/lineagewf/tests/main.nf.test +++ b/modules/nf-core/checkm/lineagewf/tests/main.nf.test @@ -1,14 +1,14 @@ nextflow_process { - name "Test Process CHECKM_LINEAGEWF" script "../main.nf" process "CHECKM_LINEAGEWF" + tag "modules" tag "modules_nfcore" tag "checkm" tag "checkm/lineagewf" - test("Should run without failures") { + test("checkm - lineage_wf") { when { process { @@ -35,4 +35,27 @@ nextflow_process { } + test("stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true) + ] + input[1] = 'fasta' + input[2] = [] // Download CheckM database + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + } + + } } diff --git a/modules/nf-core/checkm/lineagewf/tests/main.nf.test.snap b/modules/nf-core/checkm/lineagewf/tests/main.nf.test.snap index 524d40d5479..6d6d7f7563f 100644 --- a/modules/nf-core/checkm/lineagewf/tests/main.nf.test.snap +++ b/modules/nf-core/checkm/lineagewf/tests/main.nf.test.snap @@ -1,5 +1,80 @@ { - "Should run without failures": { + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "lineage.ms:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "lineage.ms:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,08f99a3a9677aba1509cda63dcf5ce71" + ], + "checkm_output": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "lineage.ms:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "checkm_tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "marker_file": [ + [ + { + "id": "test", + "single_end": false + }, + "lineage.ms:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,08f99a3a9677aba1509cda63dcf5ce71" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T04:36:45.930077242" + }, + "checkm - lineage_wf": { "content": [ true, [ @@ -16,9 +91,9 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-14T12:39:55.748324" + "timestamp": "2024-11-05T04:27:36.491322471" } } \ No newline at end of file diff --git a/modules/nf-core/checkm/qa/environment.yml b/modules/nf-core/checkm/qa/environment.yml index 06c5639e07d..1b87050296b 100644 --- a/modules/nf-core/checkm/qa/environment.yml +++ b/modules/nf-core/checkm/qa/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::checkm-genome=1.2.2 + - bioconda::checkm-genome=1.2.3 diff --git a/modules/nf-core/checkm/qa/main.nf b/modules/nf-core/checkm/qa/main.nf index a4c475cc632..0255d95cb56 100644 --- a/modules/nf-core/checkm/qa/main.nf +++ b/modules/nf-core/checkm/qa/main.nf @@ -1,11 +1,11 @@ process CHECKM_QA { - tag "$meta.id" + 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/checkm-genome:1.2.1--pyhdfd78af_0' : - 'biocontainers/checkm-genome:1.2.2--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/checkm-genome:1.2.3--pyhdfd78af_1' : + 'biocontainers/checkm-genome:1.2.3--pyhdfd78af_1' }" input: tuple val(meta), path(analysis_dir), path(marker_file), path(coverage_file) @@ -23,18 +23,29 @@ process CHECKM_QA { def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" suffix = task.ext.args?.matches(".*-o 9.*|.*--out_file 9.*") ? "fasta" : "txt" - def coverage = coverage_file ? "--coverage_file ${coverage_file}" : "" - def exclude = exclude_marker_file ? "--exclude_markers ${marker_filer}" : "" + def coverage = coverage_file.isFile() ? "--coverage_file ${coverage_file}" : "" + def exclude = exclude_marker_file && exclude_marker_file.isFile() ? "--exclude_markers ${exclude_marker_file}" : "" """ checkm \\ qa \\ --threads ${task.cpus} \\ --file ${prefix}.${suffix} \\ - $marker_file \\ - $analysis_dir \\ - $coverage \\ - $exclude \\ - $args + ${marker_file} \\ + ${analysis_dir} \\ + ${coverage} \\ + ${exclude} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + checkm: \$( checkm 2>&1 | grep '...:::' | sed 's/.*CheckM v//;s/ .*//' ) + END_VERSIONS + """ + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.txt ${prefix}.fasta cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/checkm/qa/tests/main.nf.test b/modules/nf-core/checkm/qa/tests/main.nf.test new file mode 100644 index 00000000000..8037bbc2a36 --- /dev/null +++ b/modules/nf-core/checkm/qa/tests/main.nf.test @@ -0,0 +1,88 @@ +nextflow_process { + name "Test Process CHECKM_QA" + script "../main.nf" + process "CHECKM_QA" + + tag "modules" + tag "modules_nfcore" + tag "checkm" + tag "checkm/qa" + tag "checkm/lineagewf" + + test("checkm - qa") { + + setup { + run("CHECKM_LINEAGEWF") { + script "../../lineagewf/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true) + ] + input[1] = 'fasta' + input[2] = [] // Download CheckM database + """ + } + } + } + + when { + process { + """ + input[0] = CHECKM_LINEAGEWF.out.checkm_output.join(CHECKM_LINEAGEWF.out.marker_file) + .map { v -> v + [file('NO_FILE')] } + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("stub") { + + options "-stub" + + setup { + run("CHECKM_LINEAGEWF") { + script "../../lineagewf/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true) + ] + input[1] = 'fasta' + input[2] = [] // Download CheckM database + """ + } + } + } + + when { + process { + """ + input[0] = CHECKM_LINEAGEWF.out.checkm_output.join(CHECKM_LINEAGEWF.out.marker_file) + .map { v -> v + [file('NO_FILE')] } + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/checkm/qa/tests/main.nf.test.snap b/modules/nf-core/checkm/qa/tests/main.nf.test.snap new file mode 100644 index 00000000000..77eca77bffd --- /dev/null +++ b/modules/nf-core/checkm/qa/tests/main.nf.test.snap @@ -0,0 +1,96 @@ +{ + "checkm - qa": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,645f4282569afb4b171396732b2d2582" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,7a0683a78cbf54a6a69ee64055c584a6" + ], + "fasta": [ + + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,645f4282569afb4b171396732b2d2582" + ] + ], + "versions": [ + "versions.yml:md5,7a0683a78cbf54a6a69ee64055c584a6" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T04:44:09.849072843" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,7a0683a78cbf54a6a69ee64055c584a6" + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "output": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,7a0683a78cbf54a6a69ee64055c584a6" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T04:14:12.680834625" + } +} \ No newline at end of file diff --git a/modules/nf-core/checkm/qa/tests/tags.yml b/modules/nf-core/checkm/qa/tests/tags.yml new file mode 100644 index 00000000000..08b4747b810 --- /dev/null +++ b/modules/nf-core/checkm/qa/tests/tags.yml @@ -0,0 +1,3 @@ +checkm/qa: + - modules/nf-core/checkm/lineagewf/** + - modules/nf-core/checkm/qa/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 9725d866a2d..bf73e33f475 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -82,9 +82,6 @@ cellrangeratac/mkfastq: cellrangeratac/mkref: - modules/nf-core/cellrangeratac/mkref/** - tests/modules/nf-core/cellrangeratac/mkref/** -checkm/qa: - - modules/nf-core/checkm/qa/** - - tests/modules/nf-core/checkm/qa/** clippy: - modules/nf-core/clippy/** - tests/modules/nf-core/clippy/** From 6951806a2d57193513b22f9640d48c69db102b3b Mon Sep 17 00:00:00 2001 From: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:03:49 +0100 Subject: [PATCH 46/87] New module: scvitools/solo single-cell doublet detection (#6891) * added scvitools/solo module * add no-mount tmp for singularity * [automated] Fix linting with Prettier * fix linting * Attempt controlling randomness * Update tests * Make Ruff happy * Remove uuids from output h5ad * fix empty max_epochs * update scvi * change back to save batch size method * add more versions to stub versions.yml * change testing assertions * remove batch generation overhead by passing dataloader arguments * add environment variables * fix conda CI * fix conda CI again --------- Co-authored-by: Nico Trummer <52698566+nictru@users.noreply.github.com> Co-authored-by: nf-core-bot Co-authored-by: Nico Trummer --- .../nf-core/scvitools/solo/environment.yml | 6 ++ modules/nf-core/scvitools/solo/main.nf | 44 ++++++++ modules/nf-core/scvitools/solo/meta.yml | 59 +++++++++++ .../nf-core/scvitools/solo/templates/solo.py | 96 +++++++++++++++++ .../nf-core/scvitools/solo/tests/main.nf.test | 58 ++++++++++ .../scvitools/solo/tests/main.nf.test.snap | 100 ++++++++++++++++++ .../scvitools/solo/tests/nextflow.config | 5 + 7 files changed, 368 insertions(+) create mode 100644 modules/nf-core/scvitools/solo/environment.yml create mode 100644 modules/nf-core/scvitools/solo/main.nf create mode 100644 modules/nf-core/scvitools/solo/meta.yml create mode 100644 modules/nf-core/scvitools/solo/templates/solo.py create mode 100644 modules/nf-core/scvitools/solo/tests/main.nf.test create mode 100644 modules/nf-core/scvitools/solo/tests/main.nf.test.snap create mode 100644 modules/nf-core/scvitools/solo/tests/nextflow.config diff --git a/modules/nf-core/scvitools/solo/environment.yml b/modules/nf-core/scvitools/solo/environment.yml new file mode 100644 index 00000000000..42881dd7b8f --- /dev/null +++ b/modules/nf-core/scvitools/solo/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::scvi-tools=1.2.0 + - conda-forge::jaxlib=0.4.31 diff --git a/modules/nf-core/scvitools/solo/main.nf b/modules/nf-core/scvitools/solo/main.nf new file mode 100644 index 00000000000..f4d7403087b --- /dev/null +++ b/modules/nf-core/scvitools/solo/main.nf @@ -0,0 +1,44 @@ +process SCVITOOLS_SOLO { + tag "$meta.id" + label 'process_medium' + label 'process_gpu' + + conda "${moduleDir}/environment.yml" + container "${ task.ext.use_gpu ? 'docker.io/nicotru/scvitools-gpu:cuda-12' : + workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/scvi-tools:1.2.0--adbeb4160de8b08e': + 'community.wave.seqera.io/library/scvi-tools:1.2.0--680d378b86801b8a' }" + + input: + tuple val(meta), path(h5ad) + + output: + tuple val(meta), path("*.h5ad"), emit: h5ad + tuple val(meta), path("*.pkl") , emit: predictions + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + prefix = task.ext.prefix ?: "${meta.id}" + batch_key = task.ext.batch_key ?: "" + max_epochs = task.ext.max_epochs ?: "" + template 'solo.py' + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + export MPLCONFIGDIR=./tmp + + touch ${prefix}.h5ad + touch ${prefix}.pkl + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(python3 -c 'import platform; print(platform.python_version())') + anndata: \$(python3 -c 'import anndata; print(anndata.__version__)') + scvi: \$(python3 -c 'import scvi; print(scvi.__version__)') + END_VERSIONS + """ +} diff --git a/modules/nf-core/scvitools/solo/meta.yml b/modules/nf-core/scvitools/solo/meta.yml new file mode 100644 index 00000000000..4bb83ae0235 --- /dev/null +++ b/modules/nf-core/scvitools/solo/meta.yml @@ -0,0 +1,59 @@ +name: scvitools_solo +description: Detect doublets in single-cell RNA-Seq data +keywords: + - scvi + - solo + - doublets +tools: + - scvitools: + description: "A scalable toolkit for probabilistic modeling applied to single-cell omics data" + homepage: "https://scvi-tools.org" + documentation: "https://docs.scvi-tools.org/en/stable/" + tool_dev_url: "https://github.com/scverse/scvi-tools" + licence: ["MIT"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - h5ad: + type: file + description: H5AD anndata object + pattern: "*.h5ad" + +output: + - h5ad: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.h5ad": + type: file + description: H5AD anndata object without doublets + pattern: "*.h5ad" + + - predictions: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.pkl": + type: file + description: pandas dataframe containing the doublet classification + pattern: "*.pkl" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@LeonHafner" +maintainers: + - "@LeonHafner" diff --git a/modules/nf-core/scvitools/solo/templates/solo.py b/modules/nf-core/scvitools/solo/templates/solo.py new file mode 100644 index 00000000000..eb3b19792a1 --- /dev/null +++ b/modules/nf-core/scvitools/solo/templates/solo.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 + +import os +import platform + +os.environ["MPLCONFIGDIR"] = "./tmp" + +import anndata as ad +import scvi +import torch +from scvi.external import SOLO +from scvi.model import SCVI +from threadpoolctl import threadpool_limits + +torch.set_float32_matmul_precision("medium") +scvi.settings.seed = 0 + +threadpool_limits(int("${task.cpus}")) +scvi.settings.num_threads = int("${task.cpus}") + + +def format_yaml_like(data: dict, indent: int = 0) -> str: + """Formats a dictionary to a YAML-like string. + + Args: + data (dict): The dictionary to format. + indent (int): The current indentation level. + + Returns: + str: A string formatted as YAML. + """ + yaml_str = "" + for key, value in data.items(): + spaces = " " * indent + if isinstance(value, dict): + yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" + else: + yaml_str += f"{spaces}{key}: {value}\\n" + return yaml_str + + +def train_model(model): + if "${task.ext.use_gpu}" == "true": + model.to_device(0) + + model.train(max_epochs=int("${max_epochs}") if "${max_epochs}" else None, datasplitter_kwargs={"drop_last": True}) + + +adata = ad.read_h5ad("${h5ad}") + +if "${batch_key}": + SCVI.setup_anndata(adata, batch_key="${batch_key}") +else: + SCVI.setup_anndata(adata) + +model = SCVI(adata) + +train_model(model) + +adata.obs["doublet"] = False + +batches = adata.obs["batch"].unique() if "${batch_key}" else [0] +for batch in batches: + model = SOLO.from_scvi_model(model, restrict_to_batch=batch if len(batches) > 1 else None) + + train_model(model) + result = model.predict(False) + + doublets = result[result == "doublet"].index.tolist() + adata.obs.loc[doublets, "doublet"] = True + + +df = adata.obs[["doublet"]] +df.columns = ["${prefix}"] +df.to_pickle("${prefix}.pkl") + +adata = adata[~adata.obs["doublet"]].copy() +adata.obs.drop("doublet", axis=1, inplace=True) + +del adata.uns["_scvi_manager_uuid"] +del adata.uns["_scvi_uuid"] + +adata.write_h5ad("${prefix}.h5ad") + +# Versions + +versions = { + "${task.process}": { + "python": platform.python_version(), + "anndata": ad.__version__, + "scvi": scvi.__version__, + } +} + +with open("versions.yml", "w") as f: + f.write(format_yaml_like(versions)) diff --git a/modules/nf-core/scvitools/solo/tests/main.nf.test b/modules/nf-core/scvitools/solo/tests/main.nf.test new file mode 100644 index 00000000000..20aff4388db --- /dev/null +++ b/modules/nf-core/scvitools/solo/tests/main.nf.test @@ -0,0 +1,58 @@ +nextflow_process { + + name "Test Process SCVITOOLS_SOLO" + script "../main.nf" + process "SCVITOOLS_SOLO" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "scvitools" + tag "scvitools/solo" + + test("solo") { + when { + process { + """ + input[0] = [ + [id: 'test'], + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix.h5ad", checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("solo - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id: 'test'], + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_custom_emptydrops_filter_matrix.h5ad", checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/scvitools/solo/tests/main.nf.test.snap b/modules/nf-core/scvitools/solo/tests/main.nf.test.snap new file mode 100644 index 00000000000..1dfb968bc7a --- /dev/null +++ b/modules/nf-core/scvitools/solo/tests/main.nf.test.snap @@ -0,0 +1,100 @@ +{ + "solo - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.pkl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,6c7408ce1b174774a6b19aa314ea27de" + ], + "h5ad": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "predictions": [ + [ + { + "id": "test" + }, + "test.pkl:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6c7408ce1b174774a6b19aa314ea27de" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-02T15:39:12.932815031" + }, + "solo": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,4e859eaa40faeca36d39de742076f4b1" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.pkl:md5,678bf6b22a5008e1255a62a5e3596958" + ] + ], + "2": [ + "versions.yml:md5,5795405657a070e22e00f994f2a0ed97" + ], + "h5ad": [ + [ + { + "id": "test" + }, + "test.h5ad:md5,4e859eaa40faeca36d39de742076f4b1" + ] + ], + "predictions": [ + [ + { + "id": "test" + }, + "test.pkl:md5,678bf6b22a5008e1255a62a5e3596958" + ] + ], + "versions": [ + "versions.yml:md5,5795405657a070e22e00f994f2a0ed97" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-02T15:38:47.693995721" + } +} \ No newline at end of file diff --git a/modules/nf-core/scvitools/solo/tests/nextflow.config b/modules/nf-core/scvitools/solo/tests/nextflow.config new file mode 100644 index 00000000000..71b56d7a950 --- /dev/null +++ b/modules/nf-core/scvitools/solo/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: SCVITOOLS_SOLO { + ext.max_epochs = 1 + } +} \ No newline at end of file From 136f443c0a6d5c526410c7c9b73ce51ef457c341 Mon Sep 17 00:00:00 2001 From: KamilMaliszArdigen <32459801+KamilMaliszArdigen@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:55:15 +0100 Subject: [PATCH 47/87] 325 mixed model in limma (#6910) * Limma mixed models feature * Test fix * Limma voom moved to new module * Limma voom nf-tests * Limma voom nf-tests * Extension of limma module with voom and IHW correction * After review changes * Removal of IHS correction * Contrasts definition logic update * Removal of old draft * Test's and env update * Update modules/nf-core/limma/differential/templates/limma_de.R Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/environment.yml Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/main.nf Co-authored-by: Jonathan Manning * Removal of not used library's * Limma tests migration to nf-tests * Limma tests update * smap update * smap update * smap update * smap update * smap update * smap update * Nf-tests update to restore old tests logic * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Update modules/nf-core/limma/differential/tests/main.nf.test Co-authored-by: Jonathan Manning * Test data path correction * Meta yml update * Limma module extenstion to suport mixed model data * Limma tests update to test mixed models * Tests update to cover new option * Updates after reviev * Removal of redundand if * 325 mixed model in limma jon (#6930) * Simplify a bit * Prevent collision between fixed effect and random effects --------- Co-authored-by: KamilMaliszArdigen --------- Co-authored-by: Jonathan Manning --- .../limma/differential/templates/limma_de.R | 39 +++++++++++---- .../limma/differential/tests/main.nf.test | 29 ++++++++++++ .../differential/tests/main.nf.test.snap | 47 ++++++++++++++----- .../tests/nextflow.voom_mixed.config | 14 ++++++ 4 files changed, 109 insertions(+), 20 deletions(-) mode change 100755 => 100644 modules/nf-core/limma/differential/templates/limma_de.R create mode 100644 modules/nf-core/limma/differential/tests/nextflow.voom_mixed.config diff --git a/modules/nf-core/limma/differential/templates/limma_de.R b/modules/nf-core/limma/differential/templates/limma_de.R old mode 100755 new mode 100644 index 1cea8aa9a7f..38a4112b20a --- a/modules/nf-core/limma/differential/templates/limma_de.R +++ b/modules/nf-core/limma/differential/templates/limma_de.R @@ -231,6 +231,20 @@ if (!contrast_variable %in% colnames(sample.sheet)) { ) } } + +# Handle conflicts between blocking variables and block +if (!is.null(opt\$block) && !is.null(opt\$blocking_variables)) { + if (opt\$block %in% blocking.vars) { + warning(paste("Variable", opt\$block, "is specified both as a fixed effect and a random effect. It will be treated as a random effect only.")) + blocking.vars <- setdiff(blocking.vars, opt\$block) + if (length(blocking.vars) == 0) { + opt\$blocking_variables <- NULL + } else { + opt\$blocking_variables <- paste(blocking.vars, collapse = ';') + } + } +} + # Optionally, subset to only the samples involved in the contrast if (opt\$subset_to_contrast_samples){ @@ -316,11 +330,22 @@ if (!is.null(opt\$use_voom) && opt\$use_voom) { dge <- calcNormFactors(dge, method = "TMM") # Run voom to transform the data - voom_result <- voom(dge, design) - data_for_fit <- voom_result + data_for_fit <- voom(dge, design) +} else { + # Use as.matrix for regular microarray analysis + data_for_fit <- as.matrix(intensities.table) +} - # Write the normalized counts matrix to a TSV file - normalized_counts <- voom_result\$E +if (!is.null(opt\$block)) { + corfit = duplicateCorrelation(data_for_fit, design = design, block = sample.sheet[[opt\$block]]) + if (!is.null(opt\$use_voom) && opt\$use_voom) { + data_for_fit <- voom(counts = dge, design = design, plot = FALSE, correlation = corfit\$consensus.correlation) + } +} + +# For Voom, write the normalized counts matrix to a TSV file +if (!is.null(opt\$use_voom) && opt\$use_voom) { + normalized_counts <- data_for_fit\$E normalized_counts_with_genes <- data.frame(Gene = rownames(normalized_counts), normalized_counts, row.names = NULL) colnames(normalized_counts_with_genes)[1] <- opt\$probe_id_col write.table(normalized_counts_with_genes, @@ -328,10 +353,6 @@ if (!is.null(opt\$use_voom) && opt\$use_voom) { sep = "\t", quote = FALSE, row.names = FALSE) - -} else { - # Use as.matrix for regular microarray analysis - data_for_fit <- as.matrix(intensities.table) } # Prepare for and run lmFit() @@ -353,6 +374,8 @@ if (! is.null(opt\$block)){ } if (! is.null(opt\$correlation)){ lmfit_args[['correlation']] <- as.numeric(opt\$correlation) +} else if (! is.null(opt\$block)){ + lmfit_args[['correlation']] <- corfit\$consensus.correlation } if (! is.null(opt\$method)){ lmfit_args[['method']] <- opt\$method diff --git a/modules/nf-core/limma/differential/tests/main.nf.test b/modules/nf-core/limma/differential/tests/main.nf.test index 00f33240ede..4cdd0014e71 100644 --- a/modules/nf-core/limma/differential/tests/main.nf.test +++ b/modules/nf-core/limma/differential/tests/main.nf.test @@ -257,6 +257,35 @@ nextflow_process { } + test("test_limma_differential - voom_mixed") { + + config "./nextflow.voom_mixed.config" + + when { + process { + """ + input[0] = Channel.of(['id': 'test', 'variable': 'treatment', 'reference': 'hND6', 'target': 'mCherry']) + .map{tuple(it, it.variable, it.reference, it.target)} + input[1] = Channel.of([[id:'test'], + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.samplesheet.csv', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.gene_counts.top1000cov.tsv', checkIfExists: true)]) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.model, process.out.versions).match() }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000023978\t-2.8363444336503") }, + { assert path(process.out.results[0][1]).getText().contains("ENSMUSG00000059991\t0.736009837885068") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000023978\t6.11247620232167") }, + { assert path(process.out.normalised_counts[0][1]).getText().contains("ENSMUSG00000059991\t4.52751370160052") } + ) + } + + } + test("test_limma_differential - stub") { options "-stub" diff --git a/modules/nf-core/limma/differential/tests/main.nf.test.snap b/modules/nf-core/limma/differential/tests/main.nf.test.snap index daa1489920b..8678f660a9f 100644 --- a/modules/nf-core/limma/differential/tests/main.nf.test.snap +++ b/modules/nf-core/limma/differential/tests/main.nf.test.snap @@ -17,10 +17,10 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:25:38.991424" + "timestamp": "2024-10-31T12:35:52.20676" }, "test_limma_differential - voom": { "content": [ @@ -40,10 +40,10 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:26:07.303675" + "timestamp": "2024-10-31T12:36:19.251559" }, "test_limma_differential - subset_to_contrast": { "content": [ @@ -63,10 +63,10 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:25:09.535356" + "timestamp": "2024-10-31T12:35:25.110644" }, "test_limma_differential - exclude_samples": { "content": [ @@ -86,10 +86,10 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:24:15.276012" + "timestamp": "2024-10-31T12:34:25.24499" }, "test_limma_differential - stub": { "content": [ @@ -133,10 +133,33 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:26:17.624889" + "timestamp": "2024-10-31T12:36:56.462834" + }, + "test_limma_differential - voom_mixed": { + "content": [ + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.model.txt:md5,d2113d82b76046c319e6602da2ad74d6" + ] + ], + [ + "versions.yml:md5,88a6e42d753077edab8daf829cd4d943" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-31T12:36:46.38894" }, "test_limma_differential": { "content": [ @@ -156,9 +179,9 @@ ] ], "meta": { - "nf-test": "0.9.0", + "nf-test": "0.9.1", "nextflow": "24.04.4" }, - "timestamp": "2024-10-23T18:23:19.185283" + "timestamp": "2024-10-31T12:33:25.759977" } } \ No newline at end of file diff --git a/modules/nf-core/limma/differential/tests/nextflow.voom_mixed.config b/modules/nf-core/limma/differential/tests/nextflow.voom_mixed.config new file mode 100644 index 00000000000..0adc069884f --- /dev/null +++ b/modules/nf-core/limma/differential/tests/nextflow.voom_mixed.config @@ -0,0 +1,14 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col sample", + "--probe_id_col gene_id", + "--use_voom TRUE", + "--block sample_number" + ].join(' ').trim() } + } + +} From 833a65446ea117d092d4940f098236b6766e7aac Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Tue, 5 Nov 2024 13:58:55 +0000 Subject: [PATCH 48/87] Add new module for filtering tables of differential statistics (#6938) * Add new module for filtering tables of differential statistics * Fix meta.yml * prettier * Fix meta.yml structure * prettier * Add final newline * Simplify python code * Apply module fixes * Apply module fixes * Add oskar to authors --- .../filterdifferentialtable/environment.yml | 7 ++ .../custom/filterdifferentialtable/main.nf | 70 +++++++++++++++++++ .../custom/filterdifferentialtable/meta.yml | 62 ++++++++++++++++ .../tests/main.nf.test | 38 ++++++++++ .../tests/main.nf.test.snap | 35 ++++++++++ 5 files changed, 212 insertions(+) create mode 100644 modules/nf-core/custom/filterdifferentialtable/environment.yml create mode 100644 modules/nf-core/custom/filterdifferentialtable/main.nf create mode 100644 modules/nf-core/custom/filterdifferentialtable/meta.yml create mode 100644 modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test create mode 100644 modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test.snap diff --git a/modules/nf-core/custom/filterdifferentialtable/environment.yml b/modules/nf-core/custom/filterdifferentialtable/environment.yml new file mode 100644 index 00000000000..b305d6741f5 --- /dev/null +++ b/modules/nf-core/custom/filterdifferentialtable/environment.yml @@ -0,0 +1,7 @@ +channels: + - conda-forge + - bioconda + +dependencies: + - pandas=1.5.2 + - python=3.9 diff --git a/modules/nf-core/custom/filterdifferentialtable/main.nf b/modules/nf-core/custom/filterdifferentialtable/main.nf new file mode 100644 index 00000000000..6ee226f0982 --- /dev/null +++ b/modules/nf-core/custom/filterdifferentialtable/main.nf @@ -0,0 +1,70 @@ +process CUSTOM_FILTERDIFFERENTIALTABLE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pandas:1.5.2' : + 'biocontainers/pandas:1.5.2' }" + + input: + tuple val(meta), path(input_file) + val(logFC_column) + val(FC_threshold) + val(padj_column) + val(padj_threshold) + + output: + tuple val(meta), path("*_filtered.tsv"), emit: filtered + 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}" + """ + #!/usr/bin/env python + + import pandas as pd + import sys + from math import log2 + + if not "${input_file}".lower().endswith(('.csv', '.tsv', '.txt')): + sys.exit("Please provide a .csv, .tsv or .txt file!") + + # Determine the separator based on file extension + sep = ',' if "${input_file}".lower().endswith('.csv') else '\t' + + # Read the input file + table = pd.read_csv("${input_file}", sep=sep) + + # Calculate log2 fold change threshold + logFC_threshold = log2(float("${FC_threshold}")) + + # Apply filters + mask = ( + table["${logFC_column}"].notna() & + table["${padj_column}"].notna() & + (table["${logFC_column}"].abs() >= logFC_threshold) & + (table["${padj_column}"] <= float("${padj_threshold}")) + ) + filtered_table = table[mask] + + # Write the filtered table + filtered_table.to_csv("${prefix}_filtered.tsv", sep='\t', index=False) + + # Write versions + with open('versions.yml', 'w') as version_file: + version_file.write('"${task.process}":\\n') + version_file.write(f" pandas: {pd.__version__}\\n") + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_filtered.tsv + echo '"${task.process}":\\n pandas: 1.5.2' > versions.yml + """ +} diff --git a/modules/nf-core/custom/filterdifferentialtable/meta.yml b/modules/nf-core/custom/filterdifferentialtable/meta.yml new file mode 100644 index 00000000000..236eae1f30e --- /dev/null +++ b/modules/nf-core/custom/filterdifferentialtable/meta.yml @@ -0,0 +1,62 @@ +name: "custom_filterdifferentialtable" +description: Filters a differential expression table based on logFC and adjusted p-value thresholds +keywords: + - filter + - differential expression + - logFC + - p-value +tools: + - "pandas": + description: "Python library for data manipulation and analysis" + homepage: "https://pandas.pydata.org/" + documentation: "https://pandas.pydata.org/docs/" + tool_dev_url: "https://github.com/pandas-dev/pandas" + doi: "10.5281/zenodo.3509134" + licence: ["BSD-3-Clause"] + identifiers: + - "biotools:pandas" + - "conda:pandas" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - input_file: + type: file + description: Input differential expression table (CSV, TSV, or TXT format) + pattern: "*.{csv,tsv,txt}" + - - logFC_column: + type: string + description: Name of the column containing log fold change values + - - FC_threshold: + type: float + description: Fold change threshold for filtering + - - padj_column: + type: string + description: Name of the column containing adjusted p-values + - - padj_threshold: + type: float + description: Adjusted p-value threshold for filtering +output: + - filtered: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_filtered.tsv": + type: file + description: Filtered differential expression table + pattern: "*_filtered.tsv" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@pinin4fjords" + - "@WackerO" +maintainers: + - "@pinin4fjords" + - "@WackerO" diff --git a/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test b/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test new file mode 100644 index 00000000000..42ef28e6f86 --- /dev/null +++ b/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test @@ -0,0 +1,38 @@ +nextflow_process { + + name "Test Process CUSTOM_FILTERDIFFERENTIALTABLE" + script "../main.nf" + process "CUSTOM_FILTERDIFFERENTIALTABLE" + + tag "modules" + tag "modules_nfcore" + tag "custom" + tag "custom/filterdifferentialtable" + + test("Should filter differential expression table") { + + when { + process { + """ + input[0] = [ [ id:'test' ], file(params.modules_testdata_base_path + "genomics/mus_musculus/rnaseq_expression/SRP254919.salmon.merged.deseq2.results.tsv", checkIfExists: true) ] + input[1] = 'log2FoldChange' + input[2] = 2 + input[3] = 'padj' + input[4] = 0.05 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.filtered[0][1]).text.contains("log2FoldChange") }, + { assert path(process.out.filtered[0][1]).text.contains("padj") }, + { assert path(process.out.versions[0]).text.contains("pandas") } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test.snap b/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test.snap new file mode 100644 index 00000000000..68603e319a5 --- /dev/null +++ b/modules/nf-core/custom/filterdifferentialtable/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "Should filter differential expression table": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_filtered.tsv:md5,f004047e216080aca0a4fc3ccde71179" + ] + ], + "1": [ + "versions.yml:md5,190ea382b022538d24cf4567dc8975e6" + ], + "filtered": [ + [ + { + "id": "test" + }, + "test_filtered.tsv:md5,f004047e216080aca0a4fc3ccde71179" + ] + ], + "versions": [ + "versions.yml:md5,190ea382b022538d24cf4567dc8975e6" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-05T10:49:05.469478" + } +} \ No newline at end of file From 167a20a2e267261af397e9ea5bf58426e6345ce7 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:31:01 +0100 Subject: [PATCH 49/87] nf-test rtgtools format (#6939) * nf-test rtgtools/format * fix tests * fix lint --- modules/nf-core/rtgtools/format/main.nf | 1 - .../rtgtools/format/tests/fastq.config | 3 + .../rtgtools/format/tests/main.nf.test | 138 ++++++++++++++++ .../rtgtools/format/tests/main.nf.test.snap | 118 ++++++++++++++ .../nf-core/rtgtools/format/tests/sam.config | 3 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/rtgtools/format/main.nf | 55 ------- .../nf-core/rtgtools/format/nextflow.config | 12 -- .../modules/nf-core/rtgtools/format/test.yml | 148 ------------------ 9 files changed, 262 insertions(+), 219 deletions(-) create mode 100644 modules/nf-core/rtgtools/format/tests/fastq.config create mode 100644 modules/nf-core/rtgtools/format/tests/main.nf.test create mode 100644 modules/nf-core/rtgtools/format/tests/main.nf.test.snap create mode 100644 modules/nf-core/rtgtools/format/tests/sam.config delete mode 100644 tests/modules/nf-core/rtgtools/format/main.nf delete mode 100644 tests/modules/nf-core/rtgtools/format/nextflow.config delete mode 100644 tests/modules/nf-core/rtgtools/format/test.yml diff --git a/modules/nf-core/rtgtools/format/main.nf b/modules/nf-core/rtgtools/format/main.nf index 802d3b20a33..9cae7f99c9c 100644 --- a/modules/nf-core/rtgtools/format/main.nf +++ b/modules/nf-core/rtgtools/format/main.nf @@ -46,7 +46,6 @@ process RTGTOOLS_FORMAT { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def avail_mem = "3G" diff --git a/modules/nf-core/rtgtools/format/tests/fastq.config b/modules/nf-core/rtgtools/format/tests/fastq.config new file mode 100644 index 00000000000..24540986ec6 --- /dev/null +++ b/modules/nf-core/rtgtools/format/tests/fastq.config @@ -0,0 +1,3 @@ +process { + ext.args = "--format fastq" +} diff --git a/modules/nf-core/rtgtools/format/tests/main.nf.test b/modules/nf-core/rtgtools/format/tests/main.nf.test new file mode 100644 index 00000000000..d3b39800cfe --- /dev/null +++ b/modules/nf-core/rtgtools/format/tests/main.nf.test @@ -0,0 +1,138 @@ +nextflow_process { + + name "Test Process RTGTOOLS_FORMAT" + script "../main.nf" + process "RTGTOOLS_FORMAT" + + tag "modules" + tag "modules_nfcore" + tag "rtgtools" + tag "rtgtools/format" + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + [], + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.sdf[0][1]).list().collect { file(it.toString()).name }, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fastqs") { + + config "./fastq.config" + + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true), + [] + ] + """ + } + } + + when { + process { + """ + input[0] = [ + [id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.sdf[0][1]).list().collect { file(it.toString()).name }, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - bam, rg") { + + config "./sam.config" + + when { + process { + """ + def rg = Channel.of("@RG\tID:READGROUP1\tSM:SAMPLE\tPL:ILLUMINA") + .collectFile(name:'sam_rg.txt') + + input[0] = Channel.of([ + [id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.single_end.bam', checkIfExists: true), + [] + ]).combine(rg) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + path(process.out.sdf[0][1]).list().collect { file(it.toString()).name }, + process.out.versions + ).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [id:'test'], + 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/rtgtools/format/tests/main.nf.test.snap b/modules/nf-core/rtgtools/format/tests/main.nf.test.snap new file mode 100644 index 00000000000..1494221bf0c --- /dev/null +++ b/modules/nf-core/rtgtools/format/tests/main.nf.test.snap @@ -0,0 +1,118 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.sdf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,2ed5b05daa28126a8c34ab9e30f0f3b5" + ], + "sdf": [ + [ + { + "id": "test" + }, + "test.sdf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,2ed5b05daa28126a8c34ab9e30f0f3b5" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-04T16:20:31.290508593" + }, + "sarscov2 - fasta": { + "content": [ + [ + "done", + "format.log", + "mainIndex", + "nameIndex0", + "namedata0", + "namepointer0", + "progress", + "seqdata0", + "seqpointer0", + "sequenceIndex0", + "suffixIndex0", + "suffixdata0", + "suffixpointer0", + "summary.txt" + ], + [ + "versions.yml:md5,2ed5b05daa28126a8c34ab9e30f0f3b5" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T12:26:34.333493927" + }, + "sarscov2 - fastqs": { + "content": [ + [ + "done", + "format.log", + "mainIndex", + "nameIndex0", + "namedata0", + "namepointer0", + "progress", + "qualitydata0", + "seqdata0", + "seqpointer0", + "sequenceIndex0", + "suffixIndex0", + "suffixdata0", + "suffixpointer0", + "summary.txt" + ], + [ + "versions.yml:md5,2ed5b05daa28126a8c34ab9e30f0f3b5" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T12:26:56.018604071" + }, + "sarscov2 - bam, rg": { + "content": [ + [ + "done", + "format.log", + "mainIndex", + "nameIndex0", + "namedata0", + "namepointer0", + "progress", + "qualitydata0", + "seqdata0", + "seqpointer0", + "sequenceIndex0", + "summary.txt" + ], + [ + "versions.yml:md5,2ed5b05daa28126a8c34ab9e30f0f3b5" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T12:27:10.103855977" + } +} \ No newline at end of file diff --git a/modules/nf-core/rtgtools/format/tests/sam.config b/modules/nf-core/rtgtools/format/tests/sam.config new file mode 100644 index 00000000000..cd57e8b61d8 --- /dev/null +++ b/modules/nf-core/rtgtools/format/tests/sam.config @@ -0,0 +1,3 @@ +process { + ext.args = "--format sam-se" +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index bf73e33f475..9a569832bdb 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -554,9 +554,6 @@ rmarkdownnotebook: roary: - modules/nf-core/roary/** - tests/modules/nf-core/roary/** -rtgtools/format: - - modules/nf-core/rtgtools/format/** - - tests/modules/nf-core/rtgtools/format/** scramble/clusteranalysis: - modules/nf-core/scramble/clusteranalysis/** - tests/modules/nf-core/scramble/clusteranalysis/** diff --git a/tests/modules/nf-core/rtgtools/format/main.nf b/tests/modules/nf-core/rtgtools/format/main.nf deleted file mode 100644 index 58035b8c1d7..00000000000 --- a/tests/modules/nf-core/rtgtools/format/main.nf +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { RTGTOOLS_FORMAT } from '../../../../../modules/nf-core/rtgtools/format/main.nf' - -workflow test_rtgtools_format_fasta { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), - [], - [] - ] - - RTGTOOLS_FORMAT ( input ) -} - -workflow test_rtgtools_format_single_end_fastq { - - input = [ - [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - [], - [] - ] - - RTGTOOLS_FORMAT ( input ) -} - -workflow test_rtgtools_format_paired_end_fastq { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true), - [] - ] - - RTGTOOLS_FORMAT ( input ) -} - -workflow test_rtgtools_format_bam { - - input = Channel.of([ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true), - [] - ]) - - sam_rg = Channel.of("@RG\tID:READGROUP1\tSM:SAMPLE\tPL:ILLUMINA") - .collectFile(name:'sam_rg.txt') - - RTGTOOLS_FORMAT ( input.combine(sam_rg) ) -} diff --git a/tests/modules/nf-core/rtgtools/format/nextflow.config b/tests/modules/nf-core/rtgtools/format/nextflow.config deleted file mode 100644 index 13d59200908..00000000000 --- a/tests/modules/nf-core/rtgtools/format/nextflow.config +++ /dev/null @@ -1,12 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: ".*_fastq:RTGTOOLS_FORMAT\$" { - ext.args = "--format fastq" - } - - withName: ".*_bam:RTGTOOLS_FORMAT\$" { - ext.args = "--format sam-se" - } -} diff --git a/tests/modules/nf-core/rtgtools/format/test.yml b/tests/modules/nf-core/rtgtools/format/test.yml deleted file mode 100644 index 614abada6aa..00000000000 --- a/tests/modules/nf-core/rtgtools/format/test.yml +++ /dev/null @@ -1,148 +0,0 @@ -- name: rtgtools format test_rtgtools_format_fasta - command: nextflow run ./tests/modules/nf-core/rtgtools/format -entry test_rtgtools_format_fasta -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/format/nextflow.config - tags: - - rtgtools - - rtgtools/format - files: - - path: output/rtgtools/test.sdf/done - md5sum: 8b5623b26ee9b8722816afbec270bff0 - - path: output/rtgtools/test.sdf/format.log - - path: output/rtgtools/test.sdf/mainIndex - - path: output/rtgtools/test.sdf/nameIndex0 - md5sum: 37152a64b859cb4082fff2f5c2321d5d - - path: output/rtgtools/test.sdf/namedata0 - md5sum: 10f3365e5b6ba0db8181a3a75073525d - - path: output/rtgtools/test.sdf/namepointer0 - md5sum: f1d3ff8443297732862df21dc4e57262 - - path: output/rtgtools/test.sdf/progress - - path: output/rtgtools/test.sdf/seqdata0 - md5sum: 421b7abd69fa2ec658868f8bf971d49c - - path: output/rtgtools/test.sdf/seqpointer0 - md5sum: e4bf5be17382af0f1eb5e0fa044833e2 - - path: output/rtgtools/test.sdf/sequenceIndex0 - md5sum: cf5befc79ea0bb3934831debaa85c05f - - path: output/rtgtools/test.sdf/suffixIndex0 - md5sum: 611280c75898e62c2c08fec3e455d54f - - path: output/rtgtools/test.sdf/suffixdata0 - md5sum: bb3f2a5fea5409904fbdab2ef5693f0e - - path: output/rtgtools/test.sdf/suffixpointer0 - md5sum: f1d3ff8443297732862df21dc4e57262 - - path: output/rtgtools/test.sdf/summary.txt - - path: output/rtgtools/versions.yml - -- name: rtgtools format test_rtgtools_format_single_end_fastq - command: nextflow run ./tests/modules/nf-core/rtgtools/format -entry test_rtgtools_format_single_end_fastq -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/format/nextflow.config - tags: - - rtgtools - - rtgtools/format - files: - - path: output/rtgtools/test.sdf/done - md5sum: 8b5623b26ee9b8722816afbec270bff0 - - path: output/rtgtools/test.sdf/format.log - - path: output/rtgtools/test.sdf/mainIndex - - path: output/rtgtools/test.sdf/nameIndex0 - md5sum: 6e1ae80cb7d39e297fb0a2065d270dea - - path: output/rtgtools/test.sdf/namedata0 - md5sum: f859bdbfae8318dee5268a5dd41aa461 - - path: output/rtgtools/test.sdf/namepointer0 - md5sum: e513a6f5ff482679d920750bcbe3bd33 - - path: output/rtgtools/test.sdf/progress - - path: output/rtgtools/test.sdf/qualitydata0 - md5sum: 0623aeefbb5011b0846798e2af46aefa - - path: output/rtgtools/test.sdf/seqdata0 - md5sum: a31e4609e8e4e788fae218f537ba7ebb - - path: output/rtgtools/test.sdf/seqpointer0 - md5sum: d0de9fae99f57b4c9127e3c7a2d75b0d - - path: output/rtgtools/test.sdf/sequenceIndex0 - md5sum: f1e2e78899b245f6aa9f7008116c6187 - - path: output/rtgtools/test.sdf/suffixIndex0 - md5sum: 19a84aeba8519ec5330ab61e8365ed6c - - path: output/rtgtools/test.sdf/suffixdata0 - md5sum: 0e6f5343c1cfe702b56d3ce6270683b8 - - path: output/rtgtools/test.sdf/suffixpointer0 - md5sum: 21dca7d00f1c47fc9ec994bf508d2dab - - path: output/rtgtools/test.sdf/summary.txt - - path: output/rtgtools/versions.yml - -- name: rtgtools format test_rtgtools_format_paired_end_fastq - command: nextflow run ./tests/modules/nf-core/rtgtools/format -entry test_rtgtools_format_paired_end_fastq -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/format/nextflow.config - tags: - - rtgtools - - rtgtools/format - files: - - path: output/rtgtools/test.sdf/done - md5sum: 8b5623b26ee9b8722816afbec270bff0 - - path: output/rtgtools/test.sdf/format.log - - path: output/rtgtools/test.sdf/left/mainIndex - - path: output/rtgtools/test.sdf/left/nameIndex0 - md5sum: 6e1ae80cb7d39e297fb0a2065d270dea - - path: output/rtgtools/test.sdf/left/namedata0 - md5sum: f859bdbfae8318dee5268a5dd41aa461 - - path: output/rtgtools/test.sdf/left/namepointer0 - md5sum: e513a6f5ff482679d920750bcbe3bd33 - - path: output/rtgtools/test.sdf/left/qualitydata0 - md5sum: 0623aeefbb5011b0846798e2af46aefa - - path: output/rtgtools/test.sdf/left/seqdata0 - md5sum: a31e4609e8e4e788fae218f537ba7ebb - - path: output/rtgtools/test.sdf/left/seqpointer0 - md5sum: d0de9fae99f57b4c9127e3c7a2d75b0d - - path: output/rtgtools/test.sdf/left/sequenceIndex0 - md5sum: f1e2e78899b245f6aa9f7008116c6187 - - path: output/rtgtools/test.sdf/left/suffixIndex0 - md5sum: 19a84aeba8519ec5330ab61e8365ed6c - - path: output/rtgtools/test.sdf/left/suffixdata0 - md5sum: 0e6f5343c1cfe702b56d3ce6270683b8 - - path: output/rtgtools/test.sdf/left/suffixpointer0 - md5sum: 21dca7d00f1c47fc9ec994bf508d2dab - - path: output/rtgtools/test.sdf/progress - - path: output/rtgtools/test.sdf/right/mainIndex - - path: output/rtgtools/test.sdf/right/nameIndex0 - md5sum: 6e1ae80cb7d39e297fb0a2065d270dea - - path: output/rtgtools/test.sdf/right/namedata0 - md5sum: f859bdbfae8318dee5268a5dd41aa461 - - path: output/rtgtools/test.sdf/right/namepointer0 - md5sum: e513a6f5ff482679d920750bcbe3bd33 - - path: output/rtgtools/test.sdf/right/qualitydata0 - md5sum: 8122341acfdd7a6946cf56ac1247aafb - - path: output/rtgtools/test.sdf/right/seqdata0 - md5sum: 437b457db336abffb926a308a56776ee - - path: output/rtgtools/test.sdf/right/seqpointer0 - md5sum: 3c19391e6e188abee4898c7f3d3fb07a - - path: output/rtgtools/test.sdf/right/sequenceIndex0 - md5sum: 912c59e6583a89c5f8f132e16d405b76 - - path: output/rtgtools/test.sdf/right/suffixIndex0 - md5sum: 19a84aeba8519ec5330ab61e8365ed6c - - path: output/rtgtools/test.sdf/right/suffixdata0 - md5sum: 54513c8a7e0bab8afe215adc4bd6f965 - - path: output/rtgtools/test.sdf/right/suffixpointer0 - md5sum: 21dca7d00f1c47fc9ec994bf508d2dab - - path: output/rtgtools/test.sdf/summary.txt - - path: output/rtgtools/versions.yml - -- name: rtgtools format test_rtgtools_format_bam - command: nextflow run ./tests/modules/nf-core/rtgtools/format -entry test_rtgtools_format_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/rtgtools/format/nextflow.config - tags: - - rtgtools - - rtgtools/format - files: - - path: output/rtgtools/test.sdf/done - md5sum: 8b5623b26ee9b8722816afbec270bff0 - - path: output/rtgtools/test.sdf/format.log - - path: output/rtgtools/test.sdf/mainIndex - - path: output/rtgtools/test.sdf/nameIndex0 - md5sum: 6e1ae80cb7d39e297fb0a2065d270dea - - path: output/rtgtools/test.sdf/namedata0 - md5sum: f859bdbfae8318dee5268a5dd41aa461 - - path: output/rtgtools/test.sdf/namepointer0 - md5sum: e513a6f5ff482679d920750bcbe3bd33 - - path: output/rtgtools/test.sdf/progress - - path: output/rtgtools/test.sdf/qualitydata0 - md5sum: 0623aeefbb5011b0846798e2af46aefa - - path: output/rtgtools/test.sdf/seqdata0 - md5sum: a31e4609e8e4e788fae218f537ba7ebb - - path: output/rtgtools/test.sdf/seqpointer0 - md5sum: d0de9fae99f57b4c9127e3c7a2d75b0d - - path: output/rtgtools/test.sdf/sequenceIndex0 - md5sum: f1e2e78899b245f6aa9f7008116c6187 - - path: output/rtgtools/test.sdf/summary.txt - - path: output/rtgtools/versions.yml From 2512434a59d282cba0fbc53ddb81dd8f244dc428 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Tue, 5 Nov 2024 16:59:39 +0100 Subject: [PATCH 50/87] Expect input of prefixes to KrakenUniq (#6912) * refactor!: expect input of prefixes Breaking Change: Require a new input. Place sequences in sub-directory to prevent trying to compress them later. * fix: always use list of files * refactor: change separator from space to tab * docs: add descriptive comments to commands --- .../krakenuniq/preloadedkrakenuniq/main.nf | 117 +++++++-------- .../krakenuniq/preloadedkrakenuniq/meta.yml | 5 + .../preloadedkrakenuniq/tests/main.nf.test | 73 +++++++--- .../tests/main.nf.test.snap | 134 ++++++++++-------- 4 files changed, 198 insertions(+), 131 deletions(-) diff --git a/modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf b/modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf index d24f75d2932..3a31fcb40fe 100644 --- a/modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf +++ b/modules/nf-core/krakenuniq/preloadedkrakenuniq/main.nf @@ -8,7 +8,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { 'biocontainers/krakenuniq:1.0.4--pl5321h6dccd9a_2' }" input: - tuple val(meta), path(sequences) + // We stage sequencing files in a sub-directory so we don't accidentally gzip them later. + tuple val(meta), path(sequences, name: 'sequences/*'), val(prefixes) val sequence_type path db val ram_chunk_size @@ -28,6 +29,7 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { script: assert sequence_type in ['fasta', 'fastq'] + sequences = sequences instanceof List ? sequences : [sequences] def args = task.ext.args ?: '' def args2 = task.ext.args ?: '' @@ -38,9 +40,20 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { unclassified_option = save_output_reads ? "--unclassified-out \"${unclassified}\"" : '' def output_option = save_output ? '--output "\${PREFIX}.krakenuniq.classified.txt"' : '' def report = report_file ? '--report-file "\${PREFIX}.krakenuniq.report.txt"' : '' - compress_reads_command = save_output_reads ? "find . -name '*.${sequence_type}' -print0 | xargs -0 -t -P ${task.cpus} -I % gzip --no-name %" : '' + compress_reads_command = save_output_reads ? "find . -maxdepth 0 -name '*.${sequence_type}' -print0 | xargs -0 -t -P ${task.cpus} -I % gzip --no-name %" : '' + def command_inputs_file = '.inputs.txt' + if (meta.single_end) { + assert sequences.size() == prefixes.size() + command_inputs = [sequences, prefixes].transpose().collect { seq, prefix -> "${seq}\t${prefix}" } + """ + # Store the batch of samples for later command input. + cat <<-END_INPUTS > ${command_inputs_file} + ${command_inputs.join('\n ')} + END_INPUTS + + # Preload the KrakenUniq database into memory. krakenuniq \\ $args \\ --db $db \\ @@ -48,15 +61,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { --preload-size $ram_chunk_size \\ --threads $task.cpus - strip_suffix() { - local result=\$1 - # Strip any file extensions. - echo "\${result%%.*}" - } - - printf "%s\\n" ${sequences} | while read FASTQ; do \\ - PREFIX="\$(strip_suffix "\${FASTQ}")" - + # Run the KrakenUniq classification on each sample in the batch. + while IFS='\t' read -r SEQ PREFIX; do krakenuniq \\ --db $db \\ --threads $task.cpus \\ @@ -65,8 +71,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { $unclassified_option \\ $classified_option \\ $args2 \\ - "\${FASTQ}" - done + "\${SEQ}" + done < ${command_inputs_file} $compress_reads_command @@ -76,7 +82,16 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { END_VERSIONS """ } else { + assert sequences.size() / 2 == prefixes.size() + command_inputs = [sequences.collate(2), prefixes].transpose().collect { pair, prefix -> "${pair[0]}\t${pair[1]}\t${prefix}" } + """ + # Store the batch of samples for later command input. + cat <<-END_INPUTS > ${command_inputs_file} + ${command_inputs.join('\n ')} + END_INPUTS + + # Preload the KrakenUniq database into memory. krakenuniq \\ $args \\ --db $db \\ @@ -84,18 +99,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { --preload-size $ram_chunk_size \\ --threads $task.cpus - strip_suffix() { - local result - read result - # Strip any trailing dot or underscore. - result="\${result%_}" - echo "\${result%.}" - } - - printf "%s %s\\n" ${sequences} | while read FASTQ; do \\ - read -r -a FASTQ <<< "\${FASTQ}" - PREFIX="\$(printf "%s\\n" "\${FASTQ[@]}" | sed -e 'N;s/^\\(.*\\).*\\n\\1.*\$/\\1\\n\\1/;D' | strip_suffix)" - + # Run the KrakenUniq classification on each sample in the batch. + while IFS='\t' read -r FIRST_SEQ SECOND_SEQ PREFIX; do krakenuniq \\ --db $db \\ --threads $task.cpus \\ @@ -105,8 +110,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { $classified_option \\ --paired \\ $args2 \\ - "\${FASTQ[@]}" - done + "\${FIRST_SEQ}" "\${SECOND_SEQ}" + done < ${command_inputs_file} $compress_reads_command @@ -119,6 +124,7 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { stub: assert sequence_type in ['fasta', 'fastq'] + sequences = sequences instanceof List ? sequences : [sequences] def args = task.ext.args ?: '' def args2 = task.ext.args ?: '' @@ -130,8 +136,19 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { def output_option = save_output ? '--output "\${PREFIX}.krakenuniq.classified.txt"' : '' def report = report_file ? '--report-file "\${PREFIX}.krakenuniq.report.txt"' : '' compress_reads_command = save_output_reads ? "find . -name '*.${sequence_type}' -print0 | xargs -0 -t -P ${task.cpus} -I % gzip --no-name %" : '' + def command_inputs_file = '.inputs.txt' + if (meta.single_end) { + assert sequences.size() == prefixes.size() + command_inputs = [sequences, prefixes].transpose().collect { seq, prefix -> "${seq}\t${prefix}" } + """ + # Store the batch of samples for later command input. + cat <<-END_INPUTS > ${command_inputs_file} + ${command_inputs.join('\n ')} + END_INPUTS + + # Preload the KrakenUniq database into memory. echo krakenuniq \\ $args \\ --db $db \\ @@ -139,12 +156,6 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { --preload-size $ram_chunk_size \\ --threads $task.cpus - strip_suffix() { - local result=\$1 - # Strip any file extensions. - echo "\${result%%.*}" - } - create_file() { echo '<3 nf-core' > "\$1" } @@ -153,11 +164,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { echo '<3 nf-core' | gzip -n > "\$1" } - printf "%s\\n" ${sequences} | while read FASTQ; do \\ - echo "\${FASTQ}" - PREFIX="\$(strip_suffix "\${FASTQ}")" - echo "\${PREFIX}" - + # Run the KrakenUniq classification on each sample in the batch. + while IFS='\t' read -r SEQ PREFIX; do echo krakenuniq \\ --db $db \\ --threads $task.cpus \\ @@ -166,13 +174,13 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { $unclassified_option \\ $classified_option \\ $args2 \\ - "\${FASTQ}" + "\${SEQ}" create_file "\${PREFIX}.krakenuniq.classified.txt" create_file "\${PREFIX}.krakenuniq.report.txt" create_gzip_file "\${PREFIX}.classified.${sequence_type}.gz" create_gzip_file "\${PREFIX}.unclassified.${sequence_type}.gz" - done + done < ${command_inputs_file} echo "$compress_reads_command" @@ -182,7 +190,16 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { END_VERSIONS """ } else { + assert sequences.size() / 2 == prefixes.size() + command_inputs = [sequences.collate(2), prefixes].transpose().collect { pair, prefix -> "${pair[0]}\t${pair[1]}\t${prefix}" } + """ + # Store the batch of samples for later command input. + cat <<-END_INPUTS > ${command_inputs_file} + ${command_inputs.join('\n ')} + END_INPUTS + + # Preload the KrakenUniq database into memory. echo krakenuniq \\ $args \\ --db $db \\ @@ -190,14 +207,6 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { --preload-size $ram_chunk_size \\ --threads $task.cpus - strip_suffix() { - local result - read result - # Strip any trailing dot or underscore. - result="\${result%_}" - echo "\${result%.}" - } - create_file() { echo '<3 nf-core' > "\$1" } @@ -206,12 +215,8 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { echo '<3 nf-core' | gzip -n > "\$1" } - printf "%s %s\\n" ${sequences} | while read FASTQ; do \\ - read -r -a FASTQ <<< "\${FASTQ}" - echo "\${FASTQ[@]}" - PREFIX="\$(printf "%s\\n" "\${FASTQ[@]}" | sed -e 'N;s/^\\(.*\\).*\\n\\1.*\$/\\1\\n\\1/;D' | strip_suffix)" - echo "\${PREFIX}" - + # Run the KrakenUniq classification on each sample in the batch. + while IFS='\t' read -r FIRST_SEQ SECOND_SEQ PREFIX; do echo krakenuniq \\ --db $db \\ --threads $task.cpus \\ @@ -221,13 +226,13 @@ process KRAKENUNIQ_PRELOADEDKRAKENUNIQ { $classified_option \\ --paired \\ $args2 \\ - "\${FASTQ[@]}" + "\${FIRST_SEQ}" "\${SECOND_SEQ}" create_file "\${PREFIX}.krakenuniq.classified.txt" create_file "\${PREFIX}.krakenuniq.report.txt" create_gzip_file "\${PREFIX}.merged.classified.${sequence_type}.gz" create_gzip_file "\${PREFIX}.merged.unclassified.${sequence_type}.gz" - done + done < ${command_inputs_file} echo "$compress_reads_command" diff --git a/modules/nf-core/krakenuniq/preloadedkrakenuniq/meta.yml b/modules/nf-core/krakenuniq/preloadedkrakenuniq/meta.yml index 1af2350d69b..8e674504d19 100644 --- a/modules/nf-core/krakenuniq/preloadedkrakenuniq/meta.yml +++ b/modules/nf-core/krakenuniq/preloadedkrakenuniq/meta.yml @@ -25,6 +25,11 @@ input: type: file description: List of input files containing sequences. All of them must be either in FASTA or FASTQ format. + - prefixes: + type: string + description: > + List of sample identifiers or filename prefixes. Must correspond in order and + length to the 'sequences', or to the number of sequencing pairs. - - sequence_type: type: string description: Format of all given sequencing files as literal string, either diff --git a/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test b/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test index 9e1d6700805..16da8e4544a 100644 --- a/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test +++ b/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test @@ -32,7 +32,11 @@ nextflow_process { """ input[0] = [ [id:'test', single_end:true], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fasta' input[2] = UNTAR.out.untar.map { it[1] } @@ -45,13 +49,16 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'genome.krakenuniq.report.txt' }, - { assert file(process.out.unclassified_reads.get(0).get(1)).name == 'genome.unclassified.fasta.gz' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, + process.out.unclassified_reads, process.out.classified_assignment, process.out.versions ).match('fasta') }, @@ -69,7 +76,11 @@ nextflow_process { """ input[0] = [ [id:'test', single_end:true], - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fastq' input[2] = UNTAR.out.untar.map { it[1] } @@ -82,10 +93,13 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'test_interleaved.krakenuniq.report.txt' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, process.out.unclassified_reads, @@ -108,8 +122,11 @@ nextflow_process { [id:'test', single_end:false], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fastq' input[2] = UNTAR.out.untar.map { it[1] } @@ -122,13 +139,16 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'test.krakenuniq.report.txt' }, - { assert file(process.out.unclassified_reads.get(0).get(1)).name == 'test.merged.unclassified.fastq.gz' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, + process.out.unclassified_reads, process.out.classified_assignment, process.out.versions ).match('fastq-paired') }, @@ -148,7 +168,11 @@ nextflow_process { """ input[0] = [ [id:'test', single_end:true], - file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fasta' input[2] = UNTAR.out.untar.map { it[1] } @@ -161,11 +185,13 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'genome.krakenuniq.report.txt' }, - { assert file(process.out.unclassified_reads.get(0).get(1)).name == 'genome.unclassified.fasta.gz' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, process.out.unclassified_reads, @@ -188,7 +214,11 @@ nextflow_process { """ input[0] = [ [id:'test', single_end:true], - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fastq' input[2] = UNTAR.out.untar.map { it[1] } @@ -201,10 +231,13 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'test_interleaved.krakenuniq.report.txt' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, process.out.unclassified_reads, @@ -229,8 +262,11 @@ nextflow_process { [id:'test', single_end:false], [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) - ] + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true), + ], + ['sample_1', 'sample.2'] ] input[1] = 'fastq' input[2] = UNTAR.out.untar.map { it[1] } @@ -243,10 +279,13 @@ nextflow_process { } then { + def reports = process.out.report.get(0).get(1).collect { report -> file(report).name } + def expected = ['sample_1.krakenuniq.report.txt', 'sample.2.krakenuniq.report.txt'] + assertAll ( { assert process.success }, // Report contains a timestamp. - { assert file(process.out.report.get(0).get(1)).name == 'test.krakenuniq.report.txt' }, + { assertContainsInAnyOrder(reports, expected) }, { assert snapshot( process.out.classified_reads, process.out.unclassified_reads, diff --git a/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test.snap b/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test.snap index 2a431be8868..ca29cf7d725 100644 --- a/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test.snap +++ b/modules/nf-core/krakenuniq/preloadedkrakenuniq/tests/main.nf.test.snap @@ -7,7 +7,10 @@ "id": "test", "single_end": true }, - "test_interleaved.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -16,7 +19,10 @@ "id": "test", "single_end": true }, - "test_interleaved.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -25,7 +31,10 @@ "id": "test", "single_end": true }, - "test_interleaved.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -33,30 +42,18 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-06T11:21:36.338887437" + "timestamp": "2024-10-30T14:25:43.618168582" }, "fastq-single": { "content": [ [ - [ - { - "id": "test", - "single_end": true - }, - "test_interleaved.classified.fastq.gz:md5,3bd95021a8fbced1be8039b990b28176" - ] + ], [ - [ - { - "id": "test", - "single_end": true - }, - "test_interleaved.unclassified.fastq.gz:md5,143c7eb70ca93cc2d5ea98767c370424" - ] + ], [ [ @@ -64,7 +61,10 @@ "id": "test", "single_end": true }, - "test_interleaved.krakenuniq.classified.txt:md5,88a734a9a9216cb0770a77f36c9f4e78" + [ + "sample.2.krakenuniq.classified.txt:md5,f885fa1cdbfc5460af0772219991bf6d", + "sample_1.krakenuniq.classified.txt:md5,88a734a9a9216cb0770a77f36c9f4e78" + ] ] ], [ @@ -72,21 +72,18 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-06T11:17:43.586414914" + "timestamp": "2024-10-30T15:21:33.941412985" }, "fastq-paired": { "content": [ [ - [ - { - "id": "test", - "single_end": false - }, - "test.merged.classified.fastq.gz:md5,dd7651837cce63e6108e28f4f019aedb" - ] + + ], + [ + ], [ [ @@ -94,7 +91,10 @@ "id": "test", "single_end": false }, - "test.krakenuniq.classified.txt:md5,ed5e19c7a88312cc04e483ac5f2579cd" + [ + "sample.2.krakenuniq.classified.txt:md5,ed5e19c7a88312cc04e483ac5f2579cd", + "sample_1.krakenuniq.classified.txt:md5,ed5e19c7a88312cc04e483ac5f2579cd" + ] ] ], [ @@ -102,10 +102,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-06T11:37:46.718293365" + "timestamp": "2024-10-30T15:21:43.622100223" }, "fasta-stub": { "content": [ @@ -115,7 +115,10 @@ "id": "test", "single_end": true }, - "genome.classified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.classified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.classified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -124,7 +127,10 @@ "id": "test", "single_end": true }, - "genome.unclassified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.unclassified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.unclassified.fasta.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -133,7 +139,10 @@ "id": "test", "single_end": true }, - "genome.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -141,10 +150,10 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-06T11:28:27.729550991" + "timestamp": "2024-10-30T14:25:33.871634213" }, "fastq-paired-stub": { "content": [ @@ -154,7 +163,10 @@ "id": "test", "single_end": false }, - "test.merged.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.merged.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.merged.classified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -163,7 +175,10 @@ "id": "test", "single_end": false }, - "test.merged.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.merged.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.merged.unclassified.fastq.gz:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -172,7 +187,10 @@ "id": "test", "single_end": false }, - "test.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + [ + "sample.2.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975", + "sample_1.krakenuniq.classified.txt:md5,a5704c35e6b573a45e3a344768fe6975" + ] ] ], [ @@ -180,21 +198,18 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-05T20:06:20.262529457" + "timestamp": "2024-10-30T14:25:54.663232573" }, "fasta": { "content": [ [ - [ - { - "id": "test", - "single_end": true - }, - "genome.classified.fasta.gz:md5,e73599798195a519ba2565c3f0275b93" - ] + + ], + [ + ], [ [ @@ -202,7 +217,10 @@ "id": "test", "single_end": true }, - "genome.krakenuniq.classified.txt:md5,8aafacd89a6aac98aaf512df0a7493d1" + [ + "sample.2.krakenuniq.classified.txt:md5,8aafacd89a6aac98aaf512df0a7493d1", + "sample_1.krakenuniq.classified.txt:md5,2bea6c2195c400a909a2d4cca2e3045e" + ] ] ], [ @@ -210,9 +228,9 @@ ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.1", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-06T11:36:00.24752418" + "timestamp": "2024-10-30T14:45:02.199077563" } } \ No newline at end of file From 05e4d643e8a9cd600fdce51dccdfc68cf9a72489 Mon Sep 17 00:00:00 2001 From: Chao-Jen Wong Date: Tue, 5 Nov 2024 14:24:17 -0800 Subject: [PATCH 51/87] add anndata/barcodes module (#6911) * Update environment.yml * Update main.nf to include image for gpu usage * Update cellbander version from 0.3.0 to 0.3.2 * fixed trailing white space and remove name: cellbender_removebackground from environment.yml * remove main.nf.test.snap * added tests/main.nf.test.snap * remove -defaults from channel * add -defaults back to channels: * remove -defaults from channels again * add adddata/barcodes module * add testing barcode csv in main.nf.test * update main.nf.test * added snapshot check in main.nf.test * added main.nf.test.snap * added a space next to { * Add tests/tags.yml and fixed meta.yml "type" issues * remove and re-created main.nf.test.snap * edit the description of the module * remove // TODO lines * modified main.nf.test.snap generated by docker:wq * edited envioronment.yml to match the version in ducker/sigularity containers * fix errors and clean up --------- Co-authored-by: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Co-authored-by: Leon Hafner --- .../nf-core/anndata/barcodes/environment.yml | 5 ++ modules/nf-core/anndata/barcodes/main.nf | 36 ++++++++++ modules/nf-core/anndata/barcodes/meta.yml | 58 +++++++++++++++ .../anndata/barcodes/templates/barcodes.py | 43 +++++++++++ .../anndata/barcodes/tests/main.nf.test | 62 ++++++++++++++++ .../anndata/barcodes/tests/main.nf.test.snap | 72 +++++++++++++++++++ .../nf-core/anndata/barcodes/tests/tags.yml | 2 + 7 files changed, 278 insertions(+) create mode 100644 modules/nf-core/anndata/barcodes/environment.yml create mode 100644 modules/nf-core/anndata/barcodes/main.nf create mode 100644 modules/nf-core/anndata/barcodes/meta.yml create mode 100644 modules/nf-core/anndata/barcodes/templates/barcodes.py create mode 100644 modules/nf-core/anndata/barcodes/tests/main.nf.test create mode 100644 modules/nf-core/anndata/barcodes/tests/main.nf.test.snap create mode 100644 modules/nf-core/anndata/barcodes/tests/tags.yml diff --git a/modules/nf-core/anndata/barcodes/environment.yml b/modules/nf-core/anndata/barcodes/environment.yml new file mode 100644 index 00000000000..b43edd6c7ae --- /dev/null +++ b/modules/nf-core/anndata/barcodes/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::anndata=0.10.9 diff --git a/modules/nf-core/anndata/barcodes/main.nf b/modules/nf-core/anndata/barcodes/main.nf new file mode 100644 index 00000000000..c6697109243 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/main.nf @@ -0,0 +1,36 @@ +process ANNDATA_BARCODES { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'oras://community.wave.seqera.io/library/anndata:0.10.9--d13580e4b297da7c': + 'community.wave.seqera.io/library/anndata:0.10.9--1eab54e300e1e584' }" + + input: + tuple val(meta), path(h5ad), path(barcodes) + + output: + tuple val(meta), path("*.h5ad"), emit: h5ad + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + prefix = task.ext.prefix ?: "${meta.id}" + template 'barcodes.py' + + stub: + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.h5ad + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + python: \$(python3 -c 'import platform; print(platform.python_version())') + anndata: \$(python3 -c 'import anndata as ad; print(ad.__version__)') + pandas: \$(python3 -c 'import pandas as pd; print(pd.__version__)') + END_VERSIONS + """ +} diff --git a/modules/nf-core/anndata/barcodes/meta.yml b/modules/nf-core/anndata/barcodes/meta.yml new file mode 100644 index 00000000000..96be0d15ae5 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/meta.yml @@ -0,0 +1,58 @@ +name: anndata_barcodes +description: Module to subset AnnData object to cells with matching barcodes from the csv file +keywords: + - single-cell + - barcodes + - anndata + - subsetting + - transcriptomics +tools: + - "anndata": + description: "An annotated data matrix." + homepage: "https://anndata.readthedocs.io" + documentation: "https://anndata.readthedocs.io" + tool_dev_url: "https://github.com/theislab/anndata" + doi: "10.21105/joss.04371" + licence: ["BSD-3-clause"] + identifier: biotools:anndata +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - h5ad: + type: file + description: Anndata object as H5AD file + pattern: "*.h5ad" + - barcodes: + type: file + description: | + CSV file containing barcodes. Barcodes are written in plain text. One column, no header + pattern: "*.csv" + +output: + - h5ad: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + pattern: "*.h5ad" + - "*.h5ad": + type: file + description: | + AnnData file containing all cells with barcodes that match those in the input barcodes csv file + pattern: "*.h5ad" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@nictru" + - "@chaochaowong" + - "@LeonHafner" +maintainers: + - "@nictru" + - "@LeonHafner" diff --git a/modules/nf-core/anndata/barcodes/templates/barcodes.py b/modules/nf-core/anndata/barcodes/templates/barcodes.py new file mode 100644 index 00000000000..b7dcd63a5d2 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/templates/barcodes.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +import platform + +import anndata as ad +import pandas as pd + + +def format_yaml_like(data: dict, indent: int = 0) -> str: + """Formats a dictionary to a YAML-like string. + + Args: + data (dict): The dictionary to format. + indent (int): The current indentation level. + + Returns: + str: A string formatted as YAML. + """ + yaml_str = "" + for key, value in data.items(): + spaces = " " * indent + if isinstance(value, dict): + yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" + else: + yaml_str += f"{spaces}{key}: {value}\\n" + return yaml_str + + +df = pd.read_csv("${barcodes}", header=None) +adata = ad.read_h5ad("${h5ad}") + +adata = adata[df[0].values] + +adata.write_h5ad("${prefix}.h5ad") + +# Versions + +versions = { + "${task.process}": {"python": platform.python_version(), "anndata": ad.__version__, "pandas": pd.__version__} +} + +with open("versions.yml", "w") as f: + f.write(format_yaml_like(versions)) diff --git a/modules/nf-core/anndata/barcodes/tests/main.nf.test b/modules/nf-core/anndata/barcodes/tests/main.nf.test new file mode 100644 index 00000000000..8910016bf45 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/tests/main.nf.test @@ -0,0 +1,62 @@ +nextflow_process { + + name 'Test Process ANNDATA_BARCODES' + script '../main.nf' + process 'ANNDATA_BARCODES' + + tag "modules" + tag "modules_nfcore" + tag "anndata/barcodes" + tag "anndata" + + test("scdownstream - h5ad - csv") { + when { + process { + """ + input[0] = Channel.from([ + [ + [ id:'test', single_end:false ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_raw_matrix_5k.h5ad", checkIfExists: true) + + ] + ]).combine(Channel.from('TGGTTAGCAGAGCCAA', 'GGGAGATAGACTGTAA', 'GAGGTGACAGGTCTCG').collectFile(newLine: true)) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("scdownstream - h5ad - csv - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.from([ + [ + [ id:'test', single_end:false ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/scdownstream/samples/SAMN14430799_raw_matrix_5k.h5ad", checkIfExists: true) + + ] + ]).combine(Channel.from('TGGTTAGCAGAGCCAA', 'GGGAGATAGACTGTAA', 'GAGGTGACAGGTCTCG').collectFile(newLine: true)) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } +} \ No newline at end of file diff --git a/modules/nf-core/anndata/barcodes/tests/main.nf.test.snap b/modules/nf-core/anndata/barcodes/tests/main.nf.test.snap new file mode 100644 index 00000000000..29092a261b1 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "scdownstream - h5ad - csv - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,eacb49282e0ca8e8073368e7cd1e6225" + ], + "h5ad": [ + [ + { + "id": "test", + "single_end": false + }, + "test.h5ad:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,eacb49282e0ca8e8073368e7cd1e6225" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T22:16:28.555901034" + }, + "scdownstream - h5ad - csv": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.h5ad:md5,cb9527dba4ca011ae2eec8442df7178e" + ] + ], + "1": [ + "versions.yml:md5,3a2663ed06ac752477d403b6c389d78a" + ], + "h5ad": [ + [ + { + "id": "test", + "single_end": false + }, + "test.h5ad:md5,cb9527dba4ca011ae2eec8442df7178e" + ] + ], + "versions": [ + "versions.yml:md5,3a2663ed06ac752477d403b6c389d78a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-05T22:16:16.587686784" + } +} \ No newline at end of file diff --git a/modules/nf-core/anndata/barcodes/tests/tags.yml b/modules/nf-core/anndata/barcodes/tests/tags.yml new file mode 100644 index 00000000000..c14cf688da2 --- /dev/null +++ b/modules/nf-core/anndata/barcodes/tests/tags.yml @@ -0,0 +1,2 @@ +anndata/barcodes: + - modules/nf-core/anndata/barcodes/** From 395b54193c2fa95de19d2f137427e7ab8a8a069a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Tue, 5 Nov 2024 23:56:47 +0100 Subject: [PATCH 52/87] remove pre-commit config validator hook (#6940) --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2770405ef1..4586039b389 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,10 +17,6 @@ repos: files: ^subworkflows/nf-core/.*/meta\.yml$ args: ["--schemafile", "subworkflows/yaml-schema.json"] - id: check-github-workflows - - repo: https://github.com/renovatebot/pre-commit-hooks - rev: 39.0.0 - hooks: - - id: renovate-config-validator # use ruff for python files - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.2 From b5e1891a88491d8731b5e68e22bd907726caec4a Mon Sep 17 00:00:00 2001 From: Sameesh Kher Date: Wed, 6 Nov 2024 13:58:08 +0100 Subject: [PATCH 53/87] 5127 new module xenium ranger (#6826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Initial commit for the xeniumranger module * test file correction, placeholder code for relabel * minor fix for segmentation input for xenium import-segmentation * test cases for xenium modules * changes in test config, minor fixes for dockerfile versioning, test suite changes,readme update * updated container image for xeniumranger * Updated xeniumranger version hence the dockerfile, added newer submodule for xeniumranger rename * Updated xeniumranger version hence the dockerfile, added newer submodule for xeniumranger rename * testing xenium modules, tests for rename module * minor fixes for relabel * fix for outs directory * minor fixes for resegment * tested xeniumranger modules with test data, fixed nf-test, testdata fetch * fixed linting issues with xenium modules * minor typo fix * minor typo fix * linting fix, nf-test fix for unstable checksums * Add import-segmentation tests * Rename viz_polygon parameter * Fix testdata source * conda fix for ci workflow, test with resegment * fix for some snapshots, added newer segmentation tests * snapshot fix for xenium modules - import-segmentation, relabel * minor changes for snapshots * fixed meta and xenium bundle file path * minor typo fix for meta id * Update .pre-commit-config.yaml Co-authored-by: Matthias Hörtenhuber --------- Co-authored-by: Sameesh Kher Co-authored-by: Sameesh Kher Co-authored-by: Sameesh Kher Co-authored-by: w620-admin Co-authored-by: w620-admin Co-authored-by: tobiaspk Co-authored-by: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Co-authored-by: Matthias Hörtenhuber --- .github/workflows/test.yml | 9 + modules/nf-core/xeniumranger/.gitignore | 0 modules/nf-core/xeniumranger/Dockerfile | 29 ++ modules/nf-core/xeniumranger/README.md | 20 ++ .../xeniumranger/import-segmentation/main.nf | 81 +++++ .../xeniumranger/import-segmentation/meta.yml | 84 +++++ .../import-segmentation/tests/main.nf.test | 314 ++++++++++++++++++ .../tests/main.nf.test.snap | 127 +++++++ .../import-segmentation/tests/nextflow.config | 0 .../import-segmentation/tests/tags.yml | 2 + modules/nf-core/xeniumranger/relabel/main.nf | 56 ++++ modules/nf-core/xeniumranger/relabel/meta.yml | 53 +++ .../xeniumranger/relabel/tests/main.nf.test | 93 ++++++ .../relabel/tests/main.nf.test.snap | 66 ++++ .../relabel/tests/nextflow.config | 0 .../xeniumranger/relabel/tests/tags.yml | 2 + modules/nf-core/xeniumranger/rename/main.nf | 58 ++++ modules/nf-core/xeniumranger/rename/meta.yml | 55 +++ .../xeniumranger/rename/tests/main.nf.test | 77 +++++ .../rename/tests/main.nf.test.snap | 65 ++++ .../xeniumranger/rename/tests/nextflow.config | 0 .../xeniumranger/rename/tests/tags.yml | 2 + .../nf-core/xeniumranger/resegment/main.nf | 70 ++++ .../nf-core/xeniumranger/resegment/meta.yml | 58 ++++ .../xeniumranger/resegment/tests/main.nf.test | 77 +++++ .../resegment/tests/main.nf.test.snap | 35 ++ .../resegment/tests/nextflow.config | 0 .../xeniumranger/resegment/tests/tags.yml | 2 + 28 files changed, 1435 insertions(+) create mode 100644 modules/nf-core/xeniumranger/.gitignore create mode 100644 modules/nf-core/xeniumranger/Dockerfile create mode 100644 modules/nf-core/xeniumranger/README.md create mode 100644 modules/nf-core/xeniumranger/import-segmentation/main.nf create mode 100644 modules/nf-core/xeniumranger/import-segmentation/meta.yml create mode 100644 modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test create mode 100644 modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test.snap create mode 100644 modules/nf-core/xeniumranger/import-segmentation/tests/nextflow.config create mode 100644 modules/nf-core/xeniumranger/import-segmentation/tests/tags.yml create mode 100644 modules/nf-core/xeniumranger/relabel/main.nf create mode 100644 modules/nf-core/xeniumranger/relabel/meta.yml create mode 100644 modules/nf-core/xeniumranger/relabel/tests/main.nf.test create mode 100644 modules/nf-core/xeniumranger/relabel/tests/main.nf.test.snap create mode 100644 modules/nf-core/xeniumranger/relabel/tests/nextflow.config create mode 100644 modules/nf-core/xeniumranger/relabel/tests/tags.yml create mode 100644 modules/nf-core/xeniumranger/rename/main.nf create mode 100644 modules/nf-core/xeniumranger/rename/meta.yml create mode 100644 modules/nf-core/xeniumranger/rename/tests/main.nf.test create mode 100644 modules/nf-core/xeniumranger/rename/tests/main.nf.test.snap create mode 100644 modules/nf-core/xeniumranger/rename/tests/nextflow.config create mode 100644 modules/nf-core/xeniumranger/rename/tests/tags.yml create mode 100644 modules/nf-core/xeniumranger/resegment/main.nf create mode 100644 modules/nf-core/xeniumranger/resegment/meta.yml create mode 100644 modules/nf-core/xeniumranger/resegment/tests/main.nf.test create mode 100644 modules/nf-core/xeniumranger/resegment/tests/main.nf.test.snap create mode 100644 modules/nf-core/xeniumranger/resegment/tests/nextflow.config create mode 100644 modules/nf-core/xeniumranger/resegment/tests/tags.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3f830774ec8..b06ee12d4ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -664,6 +664,15 @@ jobs: path: subworkflows/nf-core/fastq_align_bwa - profile: conda path: subworkflows/nf-core/fasta_newick_epang_gappa + - profile: conda + path: modules/nf-core/xeniumranger/relabel + - profile: conda + path: modules/nf-core/xeniumranger/rename + - profile: conda + path: modules/nf-core/xeniumranger/resegment + - profile: conda + path: modules/nf-core/xeniumranger/import-segmentation + env: NXF_ANSI_LOG: false NFTEST_VER: "0.9.0" diff --git a/modules/nf-core/xeniumranger/.gitignore b/modules/nf-core/xeniumranger/.gitignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/nf-core/xeniumranger/Dockerfile b/modules/nf-core/xeniumranger/Dockerfile new file mode 100644 index 00000000000..daa3c965c5e --- /dev/null +++ b/modules/nf-core/xeniumranger/Dockerfile @@ -0,0 +1,29 @@ +# Use a base image with the required operating system +FROM ubuntu:20.04 AS builder + +LABEL authors="Sameesh Kher " \ + description="Docker image containing Xenium Ranger" + +RUN apt-get update --allow-releaseinfo-change \ + && apt-get install -y \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# copy over xeniumranger +# the latest version of the xeniumranger tool has been downloaded from https://www.10xgenomics.com/support/software/xenium-ranger/downloads +COPY xeniumranger-3.0.1.tar.gz /xeniumranger-3.0.1.tar.gz + +# install xenium ranger +RUN tar -xzvf /xeniumranger-3.0.1.tar.gz && \ + rm /xeniumranger-3.0.1.tar.gz + +# Set environment variables +# ENV PATH="xeniumranger-xenium3.0/bin:$PATH" + +# multistage to reduce image size +FROM ubuntu:20.04 + +# Set environment variables +ENV PATH="/xeniumranger-xenium3.0/bin:$PATH" + +# copy over xenium from builder +COPY --from=builder /xeniumranger-xenium3.0 /xeniumranger-xenium3.0/ diff --git a/modules/nf-core/xeniumranger/README.md b/modules/nf-core/xeniumranger/README.md new file mode 100644 index 00000000000..9bbe56b01c2 --- /dev/null +++ b/modules/nf-core/xeniumranger/README.md @@ -0,0 +1,20 @@ +# Updating the docker container and making a new module release + +Xenium Ranger is a commercial tool from 10X Genomics. The container provided for the xeniumranger nf-core module is not provided nor supported by 10x Genomics. Updating the Xenium Ranger versions in the container and pushing the update to Dockerhub needs to be done manually. + +1. Navigate to the appropriate download page. - [Xenium Ranger](https://www.10xgenomics.com/support/software/xenium-ranger/downloads): download the tar ball of the desired Xenium Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies. + +2. Edit the Dockerfile. Update the Xenium Ranger versions in this line: + (current version for xenium ranger is fixated at [3.0.1](https://www.10xgenomics.com/support/software/xenium-ranger/downloads) in the dockerfile) + +3. Create and test the container: + +```bash +docker build . -t quay.io/nf-core/xeniumranger: +``` + +4. Access rights are needed to push the container to the Dockerhub nfcore organization, please ask a core team member to do so. + +```bash +docker push quay.io/nf-core/xeniumranger: +``` diff --git a/modules/nf-core/xeniumranger/import-segmentation/main.nf b/modules/nf-core/xeniumranger/import-segmentation/main.nf new file mode 100644 index 00000000000..50b17272a16 --- /dev/null +++ b/modules/nf-core/xeniumranger/import-segmentation/main.nf @@ -0,0 +1,81 @@ +process XENIUMRANGER_IMPORT_SEGMENTATION { + tag "$meta.id" + label 'process_high' + + container "nf-core/xeniumranger:3.0.1" + + input: + tuple val(meta), path(xenium_bundle) + val(expansion_distance) + path(coordinate_transform) + path(nuclei) + path(cells) + path(transcript_assignment) + path(viz_polygons) + + output: + tuple val(meta), path("**/outs/**"), emit: outs + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_IMPORT-SEGMENTATION module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + // image based segmentation options + def expansion_distance = expansion_distance ? "--expansion-distance=\"${expansion_distance}\"": "" // expansion distance (default - 5, range - 0 - 100) + def coordinate_transform = coordinate_transform ? "--coordinate-transform=\"${coordinate_transform}\"": "" + + def nuclei_detection = nuclei ? "--nuclei=\"${nuclei}\"": "" + def cells = cells ? "--cells=\"${cells}\"": "" + + // transcript based segmentation + def transcript_assignment = transcript_assignment ? "--transcript-assignment=\"${transcript_assignment}\"": "" + def viz_polygons = viz_polygons ? "--viz-polygons=\"${viz_polygons}\"":"" + + // shared argument + def units = coordinate_transform ? "--units=microns": "--units=pixels" + + """ + xeniumranger import-segmentation \\ + --id="${prefix}" \\ + --xenium-bundle="${xenium_bundle}" \\ + --localcores=${task.cpus} \\ + --localmem=${task.memory.toGiga()} \\ + ${coordinate_transform} \\ + ${nuclei_detection} \\ + ${cells} \\ + ${expansion_distance} \\ + ${transcript_assignment} \\ + ${viz_polygons} \\ + ${units} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_IMPORT-SEGMENTATION module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p "${prefix}/outs/" + touch "${prefix}/outs/fake_file.txt" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/xeniumranger/import-segmentation/meta.yml b/modules/nf-core/xeniumranger/import-segmentation/meta.yml new file mode 100644 index 00000000000..c3a34ec5339 --- /dev/null +++ b/modules/nf-core/xeniumranger/import-segmentation/meta.yml @@ -0,0 +1,84 @@ +name: xeniumranger_import_segmentation +description: The xeniumranger import-segmentation module allows you to specify 2D + nuclei and/or cell segmentation results for assigning transcripts to cells and recalculate + all Xenium Onboard Analysis (XOA) outputs that depend on segmentation. Segmentation + results can be generated by community-developed tools or prior Xenium segmentation + result. +keywords: + - spatial + - segmentation + - import segmentation + - nuclear segmentation + - cell segmentation + - xeniumranger + - imaging +tools: + - xeniumranger: + description: | + Xenium Ranger is a set of analysis pipelines that process Xenium In Situ Gene Expression data to relabel, resegment, or import new segmentation results from community-developed tools. Xenium Ranger provides flexible off-instrument reanalysis of Xenium In Situ data. Relabel transcripts, resegment cells with the latest 10x segmentation algorithms, or import your own segmentation data to assign transcripts to cells. + homepage: "https://www.10xgenomics.com/support/software/xenium-ranger/latest" + documentation: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/getting-started" + tool_dev_url: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/analysis" + licence: + - "10x Genomics EULA" + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing run information + e.g. [id:'xenium_bundle_path'] + - xenium_bundle: + type: directory + description: Path to the xenium output bundle generated by the Xenium Onboard + Analysis pipeline + - - expansion_distance: + type: integer + description: Nuclei boundary expansion distance in µm. Only for use when nucleus + segmentation provided as input. Default-5 (accepted range 0 - 100) + - - coordinate_transform: + type: file + description: Image alignment file containing similarity transform matrix e.g., + the _imagealignment.csv file exported from Xenium Explorer + - - nuclei: + type: file + description: | + Label mask (TIFF or NPY), polygons of nucleus segmentations (GeoJSON FeatureCollection), or Xenium Onboard Analysis cells.zarr.zip (the nucleus masks as input). + --nuclei will use nucleusGeometry polygon if it exists in the GeoJSON (i.e., for QuPath-like GeoJSON files), + or geometry if it does not. Error if --transcript-assignment argument is used. + - - cells: + type: file + description: | + Label mask (TIFF or NPY), polygons of cell segmentations (GeoJSON FeatureCollection), or Xenium Onboard Analysis cells.zarr.zip (the cell masks as input). + Features with a non-cell objectType will be ignored. Error if --transcript-assignment argument is used. + In Xenium Ranger v2.0, --nuclei no longer needs to be used with --cells. + - - transcript_assignment: + type: file + description: | + Transcript CSV with cell assignment from Baysor v0.6. Error if --cells or --nuclei arguments are used. + - - viz_polygons: + type: file + description: | + Cell boundary polygons (GeoJSON) for visualization from Baysor v0.6. Required if --transcript-assignment argument used. Error if --cells or --nuclei arguments used. +output: + - outs: + - meta: + type: file + description: Files containing the outputs of Cell Ranger, see official 10X Genomics + documentation for a complete list + pattern: "${meta.id}/outs/*" + - "**/outs/**": + type: file + description: Files containing the outputs of xenium ranger, see official 10X + Genomics documentation for a complete list of outputs + pattern: "${meta.id}/outs/*" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@khersameesh24" +maintainers: + - "@khersameesh24" diff --git a/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test b/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test new file mode 100644 index 00000000000..54d3ba00209 --- /dev/null +++ b/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test @@ -0,0 +1,314 @@ +nextflow_process { + + name "Test Process XENIUMRANGER_IMPORT_SEGMENTATION" + script "../main.nf" + process "XENIUMRANGER_IMPORT_SEGMENTATION" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "xeniumranger" + tag "xeniumranger/import-segmentation" + tag "unzip" + + setup { + run("UNZIP") { + script "modules/nf-core/unzip/main.nf" + process { + """ + input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] + """ + } + } + } + + test("xeniumranger import-segmentation nuclei npy") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_import-segmentation"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = 0 + input[2] = [] + input[3] = UNZIP.out.unzipped_archive.map { it[1] } + "/segmentations/nuclei.npy" + input[4] = [] + input[5] = [] + input[6] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + 'analysis_summary.html', + 'metrics_summary.csv', + 'cell_boundaries.csv.gz', + 'cell_boundaries.parquet', + 'nucleus_boundaries.csv.gz', + 'nucleus_boundaries.parquet', + 'cells.csv.gz', + 'cells.parquet', + 'cells.zarr.zip', + 'transcripts.parquet', + 'transcripts.zarr.zip', + 'clusters.csv', + 'differential_expression.csv', + 'components.csv', + 'projection.csv', + 'variance.csv', + 'analysis.zarr.zip', + 'experiment.xenium', + 'cell_feature_matrix.zarr.zip' + ]} + ).match() + }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'clusters.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'differential_expression.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'components.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'projection.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'variance.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() }, + ) + } + } + + + test("xeniumranger import-segmentation nuclei tif") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_import-segmentation"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = 0 + input[2] = [] + input[3] = UNZIP.out.unzipped_archive.map { it[1] } + "/segmentations/nuclei.npy" + input[4] = [] + input[5] = [] + input[6] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + 'analysis_summary.html', + 'metrics_summary.csv', + 'cell_boundaries.csv.gz', + 'cell_boundaries.parquet', + 'nucleus_boundaries.csv.gz', + 'nucleus_boundaries.parquet', + 'cells.csv.gz', + 'cells.parquet', + 'cells.zarr.zip', + 'transcripts.parquet', + 'transcripts.zarr.zip', + 'clusters.csv', + 'differential_expression.csv', + 'components.csv', + 'projection.csv', + 'variance.csv', + 'analysis.zarr.zip', + 'experiment.xenium', + 'cell_feature_matrix.zarr.zip' + ]} + ).match() + }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'clusters.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'differential_expression.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'components.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'projection.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'variance.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() }, + ) + } + } + + test("xeniumranger import-segmentation segmentation csv") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_import-segmentation"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = 0 + input[2] = UNZIP.out.unzipped_archive.map { it[1] } + "/segmentations/imagealignment.csv" + input[3] = [] + input[4] = [] + input[5] = UNZIP.out.unzipped_archive.map { it[1] } + "/segmentations/segmentation.csv" + input[6] = UNZIP.out.unzipped_archive.map { it[1] } + "/segmentations/segmentation_polygons.json" + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + 'analysis_summary.html', + 'metrics_summary.csv', + 'cell_boundaries.csv.gz', + 'cell_boundaries.parquet', + 'nucleus_boundaries.csv.gz', + 'nucleus_boundaries.parquet', + 'cells.csv.gz', + 'cells.parquet', + 'cells.zarr.zip', + 'transcripts.parquet', + 'transcripts.zarr.zip', + 'clusters.csv', + 'differential_expression.csv', + 'components.csv', + 'projection.csv', + 'variance.csv', + 'analysis.zarr.zip', + 'experiment.xenium', + 'cell_feature_matrix.zarr.zip' + ]} + ).match() + }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'clusters.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'differential_expression.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'components.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'projection.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'variance.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() }, + ) + } + } + + test("xeniumranger import-segmentation") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_import-segmentation"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = 0 + input[2] = [] + input[3] = UNZIP.out.unzipped_archive.map { it[1] } + "/cells.zarr.zip" + input[4] = [] + input[5] = [] + input[6] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + 'analysis_summary.html', + 'metrics_summary.csv', + 'cell_boundaries.csv.gz', + 'cell_boundaries.parquet', + 'nucleus_boundaries.csv.gz', + 'nucleus_boundaries.parquet', + 'cells.csv.gz', + 'cells.parquet', + 'cells.zarr.zip', + 'transcripts.parquet', + 'transcripts.zarr.zip', + 'clusters.csv', + 'differential_expression.csv', + 'components.csv', + 'projection.csv', + 'variance.csv', + 'analysis.zarr.zip', + 'experiment.xenium', + 'cell_feature_matrix.zarr.zip' + ]} + ).match() + }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'nucleus_boundaries.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'clusters.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'differential_expression.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'components.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'projection.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'variance.csv' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() }, + ) + } + } + + test("xeniumranger import-segmentation stub") { + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_import-segmentation"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = 0 + input[2] = [] + input[3] = UNZIP.out.unzipped_archive.map { it[1] } + "/cells.zarr.zip" + input[4] = [] + input[5] = [] + input[6] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test.snap b/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test.snap new file mode 100644 index 00000000000..1c312ae0f3b --- /dev/null +++ b/modules/nf-core/xeniumranger/import-segmentation/tests/main.nf.test.snap @@ -0,0 +1,127 @@ +{ + "xeniumranger import-segmentation": { + "content": [ + [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ], + [ + "dispersion.csv:md5,e8b1abb880ece8fb730ce34a15f958b4", + "features_selected.csv:md5,c5e32d69f001f938ed316d2108a21e00", + "cell_feature_matrix.h5:md5,96cb400f1b1dd6f8796daea0ad5c74e6", + "barcodes.tsv.gz:md5,04ea06796d6b28517c288904ca043582", + "features.tsv.gz:md5,7862242129681900a9cc4086dc83b62e", + "matrix.mtx.gz:md5,489f86fbd8d65d6b973bb9cc7c5a76f1", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T00:13:13.575888" + }, + "xeniumranger import-segmentation nuclei npy": { + "content": [ + [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ], + [ + "dispersion.csv:md5,e8b1abb880ece8fb730ce34a15f958b4", + "features_selected.csv:md5,c5e32d69f001f938ed316d2108a21e00", + "cell_feature_matrix.h5:md5,96cb400f1b1dd6f8796daea0ad5c74e6", + "barcodes.tsv.gz:md5,04ea06796d6b28517c288904ca043582", + "features.tsv.gz:md5,7862242129681900a9cc4086dc83b62e", + "matrix.mtx.gz:md5,489f86fbd8d65d6b973bb9cc7c5a76f1", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T23:03:26.726334" + }, + "xeniumranger import-segmentation segmentation csv": { + "content": [ + [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ], + [ + "dispersion.csv:md5,e8b1abb880ece8fb730ce34a15f958b4", + "features_selected.csv:md5,c5e32d69f001f938ed316d2108a21e00", + "cell_feature_matrix.h5:md5,5d74ea595561e0300b6c3e5ec8d06fff", + "barcodes.tsv.gz:md5,97496a9b448d9380cff0575b8e7a6f57", + "features.tsv.gz:md5,7862242129681900a9cc4086dc83b62e", + "matrix.mtx.gz:md5,f93ed82a2a74c154392fc6237642f1d2", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T23:22:58.158857" + }, + "xeniumranger import-segmentation stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_xeniumranger_import-segmentation" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ], + "outs": [ + [ + { + "id": "test_xeniumranger_import-segmentation" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T22:49:39.204133" + }, + "xeniumranger import-segmentation nuclei tif": { + "content": [ + [ + "versions.yml:md5,d76e870d71abf94ed9ae972a08b83f63" + ], + [ + "dispersion.csv:md5,e8b1abb880ece8fb730ce34a15f958b4", + "features_selected.csv:md5,c5e32d69f001f938ed316d2108a21e00", + "cell_feature_matrix.h5:md5,96cb400f1b1dd6f8796daea0ad5c74e6", + "barcodes.tsv.gz:md5,04ea06796d6b28517c288904ca043582", + "features.tsv.gz:md5,7862242129681900a9cc4086dc83b62e", + "matrix.mtx.gz:md5,489f86fbd8d65d6b973bb9cc7c5a76f1", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T23:11:37.18721" + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/import-segmentation/tests/nextflow.config b/modules/nf-core/xeniumranger/import-segmentation/tests/nextflow.config new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/nf-core/xeniumranger/import-segmentation/tests/tags.yml b/modules/nf-core/xeniumranger/import-segmentation/tests/tags.yml new file mode 100644 index 00000000000..90c2b80563c --- /dev/null +++ b/modules/nf-core/xeniumranger/import-segmentation/tests/tags.yml @@ -0,0 +1,2 @@ +xeniumranger/import-segmentation: + - "modules/nf-core/xeniumranger/import-segmentation/**" diff --git a/modules/nf-core/xeniumranger/relabel/main.nf b/modules/nf-core/xeniumranger/relabel/main.nf new file mode 100644 index 00000000000..b06fe9ea13e --- /dev/null +++ b/modules/nf-core/xeniumranger/relabel/main.nf @@ -0,0 +1,56 @@ +process XENIUMRANGER_RELABEL { + tag "$meta.id" + label 'process_high' + + container "nf-core/xeniumranger:3.0.1" + + input: + tuple val(meta), path(xenium_bundle) + path(gene_panel) + + output: + tuple val(meta), path("**/outs/**"), emit: outs + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RELABEL module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + xeniumranger relabel \\ + --id="${prefix}" \\ + --xenium-bundle="${xenium_bundle}" \\ + --panel="${gene_panel}" \\ + --localcores=${task.cpus} \\ + --localmem=${task.memory.toGiga()} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RELABEL module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p "${prefix}/outs/" + touch "${prefix}/outs/fake_file.txt" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/xeniumranger/relabel/meta.yml b/modules/nf-core/xeniumranger/relabel/meta.yml new file mode 100644 index 00000000000..85c1dbfa3a1 --- /dev/null +++ b/modules/nf-core/xeniumranger/relabel/meta.yml @@ -0,0 +1,53 @@ +name: xeniumranger_relabel +description: The xeniumranger relabel module allows you to change the gene labels + applied to decoded transcripts. +keywords: + - spatial + - relabel + - gene labels + - transcripts + - xeniumranger +tools: + - xeniumranger: + description: | + Xenium Ranger is a set of analysis pipelines that process Xenium In Situ Gene Expression data to relabel, resegment, or import new segmentation results from community-developed tools. Xenium Ranger provides flexible off-instrument reanalysis of Xenium In Situ data. Relabel transcripts, resegment cells with the latest 10x segmentation algorithms, or import your own segmentation data to assign transcripts to cells. + homepage: "https://www.10xgenomics.com/support/software/xenium-ranger/latest" + documentation: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/getting-started" + tool_dev_url: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/analysis" + licence: + - 10x Genomics EULA + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing run information + e.g. [id:'xenium_bundle_path'] + - xenium_bundle: + type: directory + description: Path to the xenium output bundle generated by the Xenium Onboard + Analysis pipeline + - - gene_panel: + type: file + description: Gene panel JSON file to use for relabeling decoded transcripts +output: + - outs: + - meta: + type: file + description: Files containing the outputs of Cell Ranger, see official 10X Genomics + documentation for a complete list + pattern: "${meta.id}/outs/*" + - "**/outs/**": + type: file + description: Files containing the outputs of xenium ranger, see official 10X + Genomics documentation for a complete list of outputs + pattern: "${meta.id}/outs/*" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@khersameesh24" +maintainers: + - "@khersameesh24" diff --git a/modules/nf-core/xeniumranger/relabel/tests/main.nf.test b/modules/nf-core/xeniumranger/relabel/tests/main.nf.test new file mode 100644 index 00000000000..d09627386c3 --- /dev/null +++ b/modules/nf-core/xeniumranger/relabel/tests/main.nf.test @@ -0,0 +1,93 @@ +nextflow_process { + + name "Test Process XENIUMRANGER_RELABEL" + script "../main.nf" + process "XENIUMRANGER_RELABEL" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "xeniumranger" + tag "xeniumranger/relabel" + tag "unzip" + + setup { + run("UNZIP") { + script "modules/nf-core/unzip/main.nf" + process { + """ + input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] + """ + } + } + } + + test("xeniumranger relabel") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_relabel"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = UNZIP.out.unzipped_archive.map { it[1] } + "/gene_panel.json" + """ + } + } + then { + assertAll( + { assert process.success }, + { assert process.out.outs != null }, + { + assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + "analysis.zarr.zip", + "experiment.xenium", + "transcripts.zarr.zip", + "analysis_summary.html", + "cell_feature_matrix.zarr.zip", + "differential_expression.csv", + "components.csv", + "projection.csv", + "variance.csv", + "metrics_summary.csv", + "clusters.csv" + ]} + ).match() + }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.zarr.zip' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'differential_expression.csv' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'components.csv' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'projection.csv' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'variance.csv' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'clusters.csv' }).exists() }, + ) + } + } + + test("xeniumranger relabel stub") { + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_relabel"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = UNZIP.out.unzipped_archive.map { it[1] } + "/gene_panel.json" + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/relabel/tests/main.nf.test.snap b/modules/nf-core/xeniumranger/relabel/tests/main.nf.test.snap new file mode 100644 index 00000000000..7c70cfc28fa --- /dev/null +++ b/modules/nf-core/xeniumranger/relabel/tests/main.nf.test.snap @@ -0,0 +1,66 @@ +{ + "xeniumranger relabel": { + "content": [ + [ + "versions.yml:md5,ab2584177544560d5a9e9c36f7d24354" + ], + [ + "dispersion.csv:md5,e8b1abb880ece8fb730ce34a15f958b4", + "features_selected.csv:md5,c5e32d69f001f938ed316d2108a21e00", + "cell_boundaries.csv.gz:md5,8b4f2aa455a6fb14b2669a42db32ea7e", + "cell_boundaries.parquet:md5,e55d6a7fbec336103994baad8c8e4a9a", + "cell_feature_matrix.h5:md5,96cb400f1b1dd6f8796daea0ad5c74e6", + "barcodes.tsv.gz:md5,04ea06796d6b28517c288904ca043582", + "features.tsv.gz:md5,7862242129681900a9cc4086dc83b62e", + "matrix.mtx.gz:md5,489f86fbd8d65d6b973bb9cc7c5a76f1", + "cells.csv.gz:md5,3cef2d7cc8cfba1d47bdb7c65c3d5d5f", + "cells.parquet:md5,9b30b35ab961d2d243a1426e8dc980fe", + "cells.zarr.zip:md5,556e47d5b14150239b10b2f801defa2b", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98", + "nucleus_boundaries.csv.gz:md5,e417b6e293298870956d42c7106cbd0c", + "nucleus_boundaries.parquet:md5,bacbfc3c2e956d899e1d8ccba5dd7c5e", + "transcripts.parquet:md5,c0f40d5c61b87404bc9efb84ff0563a8" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-29T21:06:09.082129" + }, + "xeniumranger relabel stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_xeniumranger_relabel" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,ab2584177544560d5a9e9c36f7d24354" + ], + "outs": [ + [ + { + "id": "test_xeniumranger_relabel" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,ab2584177544560d5a9e9c36f7d24354" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-22T15:22:34.353444" + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/relabel/tests/nextflow.config b/modules/nf-core/xeniumranger/relabel/tests/nextflow.config new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/nf-core/xeniumranger/relabel/tests/tags.yml b/modules/nf-core/xeniumranger/relabel/tests/tags.yml new file mode 100644 index 00000000000..1cb37a80de0 --- /dev/null +++ b/modules/nf-core/xeniumranger/relabel/tests/tags.yml @@ -0,0 +1,2 @@ +xeniumranger/relabel: + - "modules/nf-core/xeniumranger/relabel/**" diff --git a/modules/nf-core/xeniumranger/rename/main.nf b/modules/nf-core/xeniumranger/rename/main.nf new file mode 100644 index 00000000000..d273caf3276 --- /dev/null +++ b/modules/nf-core/xeniumranger/rename/main.nf @@ -0,0 +1,58 @@ +process XENIUMRANGER_RENAME { + tag "$meta.id" + label 'process_high' + + container "nf-core/xeniumranger:3.0.1" + + input: + tuple val(meta), path(xenium_bundle) + val(region_name) + val(cassette_name) + + output: + tuple val(meta), path("**/outs/**"), emit: outs + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RENAME module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + xeniumranger rename \\ + --id="${prefix}" \\ + --xenium-bundle="${xenium_bundle}" \\ + --region-name="${region_name}" \\ + --cassette-name="${cassette_name}" \\ + --localcores=${task.cpus} \\ + --localmem=${task.memory.toGiga()} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RENAME module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p "${prefix}/outs/" + touch "${prefix}/outs/fake_file.txt" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/xeniumranger/rename/meta.yml b/modules/nf-core/xeniumranger/rename/meta.yml new file mode 100644 index 00000000000..d7842b007a7 --- /dev/null +++ b/modules/nf-core/xeniumranger/rename/meta.yml @@ -0,0 +1,55 @@ +name: xeniumranger_rename +description: The xeniumranger rename module allows you to change the sample region_name + and cassette_name throughout all the Xenium Onboard Analysis output files that contain + this information. +keywords: + - spatial + - rename + - gene labels + - transcripts + - xeniumranger +tools: + - xeniumranger: + description: | + Xenium Ranger is a set of analysis pipelines that process Xenium In Situ Gene Expression data to relabel, resegment, or import new segmentation results from community-developed tools. Xenium Ranger provides flexible off-instrument reanalysis of Xenium In Situ data. Relabel transcripts, resegment cells with the latest 10x segmentation algorithms, or import your own segmentation data to assign transcripts to cells. + homepage: "https://www.10xgenomics.com/support/software/xenium-ranger/latest" + documentation: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/getting-started" + tool_dev_url: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/analysis" + licence: + - "10x Genomics EULA" + identifier: "" +input: + - - meta: + type: map + description: Groovy Map containing sample information e.g. [ id:'test' ] + - xenium_bundle: + type: directory + description: Path to the xenium output bundle generated by the Xenium Onboard + Analysis pipeline + - - region_name: + type: string + description: New region name + - - cassette_name: + type: string + description: New cassette name +output: + - outs: + - meta: + type: file + description: Files containing the outputs of Cell Ranger, see official 10X Genomics + documentation for a complete list + pattern: "${meta.id}/outs/*" + - "**/outs/**": + type: file + description: Files containing the outputs of xenium ranger, see official 10X + Genomics documentation for a complete list of outputs + pattern: "${meta.id}/outs/*" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@khersameesh24" +maintainers: + - "@khersameesh24" diff --git a/modules/nf-core/xeniumranger/rename/tests/main.nf.test b/modules/nf-core/xeniumranger/rename/tests/main.nf.test new file mode 100644 index 00000000000..3819a310d19 --- /dev/null +++ b/modules/nf-core/xeniumranger/rename/tests/main.nf.test @@ -0,0 +1,77 @@ +nextflow_process { + + name "Test Process XENIUMRANGER_RENAME" + script "../main.nf" + process "XENIUMRANGER_RENAME" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "xeniumranger" + tag "xeniumranger/rename" + tag "unzip" + + setup { + run("UNZIP") { + script "modules/nf-core/unzip/main.nf" + process { + """ + input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] + """ + } + } + } + + test("xeniumranger rename") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_rename"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = "test_region" + input[2] = "test_cassette" + """ + } + } + then { + assertAll( + { assert process.success }, + { assert process.out.outs != null }, + { + assert snapshot( + process.out.versions, + process.out.outs.get(0).get(1).findAll { file(it).name !in [ + 'analysis_summary.html', + 'experiment.xenium', + ]} + ).match() + }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'experiment.xenium' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'metrics_summary.csv' }).exists() } + ) + } + } + + test("xeniumranger rename stub") { + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_rename"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = "test_region" + input[2] = "test_cassette" + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/rename/tests/main.nf.test.snap b/modules/nf-core/xeniumranger/rename/tests/main.nf.test.snap new file mode 100644 index 00000000000..ea57ab7e0fd --- /dev/null +++ b/modules/nf-core/xeniumranger/rename/tests/main.nf.test.snap @@ -0,0 +1,65 @@ +{ + "xeniumranger rename stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_xeniumranger_rename" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,823917e7bc8f27cf314ef477fe7369eb" + ], + "outs": [ + [ + { + "id": "test_xeniumranger_rename" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,823917e7bc8f27cf314ef477fe7369eb" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T23:10:43.918492" + }, + "xeniumranger rename": { + "content": [ + [ + "versions.yml:md5,823917e7bc8f27cf314ef477fe7369eb" + ], + [ + "analysis.zarr.zip:md5,1ffb1b86586fe6c80ce1676b79137785", + "cell_boundaries.csv.gz:md5,8b4f2aa455a6fb14b2669a42db32ea7e", + "cell_boundaries.parquet:md5,e55d6a7fbec336103994baad8c8e4a9a", + "cell_feature_matrix.h5:md5,96cb400f1b1dd6f8796daea0ad5c74e6", + "cell_feature_matrix.zarr.zip:md5,36f45a290cf4ee1232f2d1cd0fdbd820", + "cells.csv.gz:md5,3cef2d7cc8cfba1d47bdb7c65c3d5d5f", + "cells.parquet:md5,e1450c7eca3d7ce0d4911c95042b1303", + "cells.zarr.zip:md5,556e47d5b14150239b10b2f801defa2b", + "gene_panel.json:md5,8890dd5fd90706e751554ac3fdfdedde", + "metrics_summary.csv:md5,54ad3944eb3ba6a4d7bda01bc2a6bb1c", + "morphology.ome.tif:md5,6b65fff28a38a001b8f25061737fbf9b", + "morphology_focus_0000.ome.tif:md5,90e796ad634d14e62cf2ebcadf2eaf98", + "nucleus_boundaries.csv.gz:md5,e417b6e293298870956d42c7106cbd0c", + "nucleus_boundaries.parquet:md5,bacbfc3c2e956d899e1d8ccba5dd7c5e", + "transcripts.parquet:md5,203cb05ee7689805cc505ebda9557551", + "transcripts.zarr.zip:md5,807e63a2ef8340e085cd899507f45395" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T23:10:34.499597" + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/rename/tests/nextflow.config b/modules/nf-core/xeniumranger/rename/tests/nextflow.config new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/nf-core/xeniumranger/rename/tests/tags.yml b/modules/nf-core/xeniumranger/rename/tests/tags.yml new file mode 100644 index 00000000000..1f9026ac618 --- /dev/null +++ b/modules/nf-core/xeniumranger/rename/tests/tags.yml @@ -0,0 +1,2 @@ +xeniumranger/rename: + - "modules/nf-core/xeniumranger/rename/**" diff --git a/modules/nf-core/xeniumranger/resegment/main.nf b/modules/nf-core/xeniumranger/resegment/main.nf new file mode 100644 index 00000000000..5d28fa698a7 --- /dev/null +++ b/modules/nf-core/xeniumranger/resegment/main.nf @@ -0,0 +1,70 @@ +process XENIUMRANGER_RESEGMENT { + tag "$meta.id" + label 'process_high' + + container "nf-core/xeniumranger:3.0.1" + + input: + tuple val(meta), path(xenium_bundle) + val(expansion_distance) + val(dapi_filter) + val(boundary_stain) + val(interior_stain) + + output: + tuple val(meta), path("**/outs/**"), emit: outs + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RESEGMENT module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + + def expansion_distance = expansion_distance ? "--expansion-distance=\"${expansion_distance}\"": "" + def dapi_filter = dapi_filter ? "--dapi-filter=\"${dapi_filter}\"": "" + + // Do not use boundary stain in analysis, but keep default interior stain and DAPI + def boundary_stain = boundary_stain ? "--boundary-stain=disable": "" + // Do not use interior stain in analysis, but keep default boundary stain and DAPI + def interior_stain = interior_stain ? "--interior-stain=disable": "" + + """ + xeniumranger resegment \\ + --id="${prefix}" \\ + --xenium-bundle="${xenium_bundle}" \\ + ${expansion_distance} \\ + ${dapi_filter} \\ + ${boundary_stain} \\ + ${interior_stain} \\ + --localcores=${task.cpus} \\ + --localmem=${task.memory.toGiga()} \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "XENIUMRANGER_RESEGMENT module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir -p "${prefix}/outs/" + touch "${prefix}/outs/fake_file.txt" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + xeniumranger: \$(xeniumranger -V | sed -e "s/xeniumranger-/- /g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/xeniumranger/resegment/meta.yml b/modules/nf-core/xeniumranger/resegment/meta.yml new file mode 100644 index 00000000000..af0e88826b0 --- /dev/null +++ b/modules/nf-core/xeniumranger/resegment/meta.yml @@ -0,0 +1,58 @@ +name: xeniumranger_resegment +description: The xeniumranger resegment module allows you to generate a new segmentation of the morphology image space by rerunning the Xenium Onboard Analysis (XOA) segmentation algorithms with modified parameters. +keywords: + - spatial + - resegment + - morphology + - segmentation + - xeniumranger +tools: + - xeniumranger: + description: | + Xenium Ranger is a set of analysis pipelines that process Xenium In Situ Gene Expression data to relabel, resegment, or import new segmentation results from community-developed tools. Xenium Ranger provides flexible off-instrument reanalysis of Xenium In Situ data. Relabel transcripts, resegment cells with the latest 10x segmentation algorithms, or import your own segmentation data to assign transcripts to cells. + homepage: "https://www.10xgenomics.com/support/software/xenium-ranger/latest" + documentation: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/getting-started" + tool_dev_url: "https://www.10xgenomics.com/support/software/xenium-ranger/latest/analysis" + licence: + - "10x Genomics EULA" + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing run information + e.g. [ id:'xenium_experiment' ] + - xenium_bundle: + type: directory + description: Path to the xenium output bundle generated by the Xenium Onboard Analysis pipeline + - - expansion_distance: + type: integer + description: Nuclei boundary expansion distance in µm. Only for use when nucleus segmentation provided as input. Default-5 (accepted range 0 - 100) + - - dapi_filter: + type: integer + description: Minimum intensity in photoelectrons to filter nuclei default-100 range of values is 0 to 99th percentile of image stack or 1000, whichever is larger + - - boundary_stain: + type: string + description: Specify the name of the boundary stain to use or disable possible options are default-ATP1A1/CD45/E-Cadherin or disable + - - interior_stain: + type: string + description: Specify the name of the interior stain to use or disable possible options are default-18S or disable +output: + - outs: + - meta: + type: file + description: Files containing the outputs of Cell Ranger, see official 10X Genomics documentation for a complete list + pattern: "${meta.id}/outs/*" + - "**/outs/**": + type: file + description: Files containing the outputs of xenium ranger, see official 10X Genomics documentation for a complete list of outputs + pattern: "${meta.id}/outs/*" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@khersameesh24" +maintainers: + - "@khersameesh24" diff --git a/modules/nf-core/xeniumranger/resegment/tests/main.nf.test b/modules/nf-core/xeniumranger/resegment/tests/main.nf.test new file mode 100644 index 00000000000..861c2414565 --- /dev/null +++ b/modules/nf-core/xeniumranger/resegment/tests/main.nf.test @@ -0,0 +1,77 @@ +nextflow_process { + + name "Test Process XENIUMRANGER_RESEGMENT" + script "../main.nf" + process "XENIUMRANGER_RESEGMENT" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "xeniumranger" + tag "xeniumranger/resegment" + tag "unzip" + + setup { + run("UNZIP") { + script "modules/nf-core/unzip/main.nf" + process { + """ + input[0] = [[], file('https://raw.githubusercontent.com/nf-core/test-datasets/spatialxe/Xenium_Prime_Mouse_Ileum_tiny_outs.zip', checkIfExists: true)] + """ + } + } + } + + test("xeniumranger resegment") { + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_resegment"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = [] + input[2] = [] + input[3] = [] + input[4] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert process.out.outs != null }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis_summary.html' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.csv.gz' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'cells.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.parquet' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'transcripts.zarr.zip' }).exists() }, + { assert file(process.out.outs.get(0).get(1).find { file(it).name == 'analysis.zarr.zip' }).exists() }, + { assert path(process.out.outs.get(0).get(1).find { file(it).name == 'cell_feature_matrix.zarr.zip' }).exists() } + ) + } + } + + test("xeniumranger resegment stub") { + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: "test_xeniumranger_resegment"], + ]).combine(UNZIP.out.unzipped_archive.map { it[1] }) + input[1] = [] + input[2] = [] + input[3] = [] + input[4] = [] + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/resegment/tests/main.nf.test.snap b/modules/nf-core/xeniumranger/resegment/tests/main.nf.test.snap new file mode 100644 index 00000000000..16f94c14ebf --- /dev/null +++ b/modules/nf-core/xeniumranger/resegment/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "xeniumranger resegment stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_xeniumranger_resegment" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,4671141281357e0ce26d9cb35fed23a8" + ], + "outs": [ + [ + { + "id": "test_xeniumranger_resegment" + }, + "fake_file.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,4671141281357e0ce26d9cb35fed23a8" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T23:22:35.438329" + } +} \ No newline at end of file diff --git a/modules/nf-core/xeniumranger/resegment/tests/nextflow.config b/modules/nf-core/xeniumranger/resegment/tests/nextflow.config new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/nf-core/xeniumranger/resegment/tests/tags.yml b/modules/nf-core/xeniumranger/resegment/tests/tags.yml new file mode 100644 index 00000000000..99f47c82ae9 --- /dev/null +++ b/modules/nf-core/xeniumranger/resegment/tests/tags.yml @@ -0,0 +1,2 @@ +xeniumranger/resegment: + - "modules/nf-core/xeniumranger/resegment/**" From ed2d77ccce4c2b4ed719fc6a17bb7909f5087460 Mon Sep 17 00:00:00 2001 From: Niklas Schandry Date: Wed, 6 Nov 2024 20:22:49 +0100 Subject: [PATCH 54/87] Update quast container (#6943) Update container This is a more recent version of the quast container, which comes with bwa in the path. See also here https://github.com/bioconda/bioconda-recipes/pull/36236 --- modules/nf-core/quast/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/nf-core/quast/main.nf b/modules/nf-core/quast/main.nf index d8f36284869..7e08121adb9 100644 --- a/modules/nf-core/quast/main.nf +++ b/modules/nf-core/quast/main.nf @@ -4,8 +4,8 @@ process QUAST { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/quast:5.2.0--py39pl5321h2add14b_1' : - 'biocontainers/quast:5.2.0--py39pl5321h2add14b_1' }" + 'https://depot.galaxyproject.org/singularity/quast:5.2.0--py39pl5321heaaa4ec_4' : + 'biocontainers/quast:5.2.0--py39pl5321heaaa4ec_4' }" input: tuple val(meta) , path(consensus) From d29fcb4ec1274a2982b86225f23fd895c1d7db2f Mon Sep 17 00:00:00 2001 From: tanyasarkjain <67300971+tanyasarkjain@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:36:12 -0800 Subject: [PATCH 55/87] Hiphase - new module (#6854) * basic setup * pbsv * [automated] Fix linting with Prettier * version of pbsv module where all the tests pass * getting rid of un-need comments * updated: * changed website: * update * deleting accidental file * small tweak * updating the meta description * pretty * removing trailing space * space * newline * should pass version test * hiphase template * pretty * passes all tests * prettier * linting * Update modules/nf-core/hiphase/tests/main.nf.test Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * changed pbsv to pbsv/discover - seperating functionality * license name change * added another test * update * pbsv/call * update * fixed spacing * adding end line * Update modules/nf-core/hiphase/main.nf Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * Update modules/nf-core/hiphase/main.nf Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * changes * fixed spacing and pbsv issue --------- Co-authored-by: nf-core-bot Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> Co-authored-by: Tanya Jain Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: Tanya Jain Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- modules/nf-core/hiphase/environment.yml | 7 ++ modules/nf-core/hiphase/main.nf | 55 ++++++++++ modules/nf-core/hiphase/meta.yml | 83 +++++++++++++++ modules/nf-core/hiphase/tests/main.nf.test | 84 +++++++++++++++ .../nf-core/hiphase/tests/main.nf.test.snap | 100 ++++++++++++++++++ .../nf-core/pbsv/call/tests/main.nf.test.snap | 1 - 6 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 modules/nf-core/hiphase/environment.yml create mode 100644 modules/nf-core/hiphase/main.nf create mode 100644 modules/nf-core/hiphase/meta.yml create mode 100644 modules/nf-core/hiphase/tests/main.nf.test create mode 100644 modules/nf-core/hiphase/tests/main.nf.test.snap diff --git a/modules/nf-core/hiphase/environment.yml b/modules/nf-core/hiphase/environment.yml new file mode 100644 index 00000000000..90f9823f0a7 --- /dev/null +++ b/modules/nf-core/hiphase/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::hiphase=1.4.5" diff --git a/modules/nf-core/hiphase/main.nf b/modules/nf-core/hiphase/main.nf new file mode 100644 index 00000000000..46b104e2feb --- /dev/null +++ b/modules/nf-core/hiphase/main.nf @@ -0,0 +1,55 @@ +process HIPHASE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hiphase:1.4.5--h9ee0642_0': + 'biocontainers/hiphase:1.4.5--h9ee0642_0' }" + + input: + tuple val(meta), path(vcf), path(csi) + tuple val(meta2), path(bam), path(bai) + tuple val(meta3), path(fasta) + + output: + tuple val(meta), path("*.vcf"), emit: vcf + tuple val(meta), path("*.csv"), emit: csv + 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}" + + """ + hiphase \ + --bam $bam \ + --vcf $vcf \ + --output-vcf ${prefix}.phased.vcf \ + --output-bam ${prefix}.phased.bam \ + --reference $fasta \ + --stats-file ${prefix}.stats.csv \ + $args \ + --threads ${task.cpus} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hiphase: \$(hiphase --version |& sed '1!d ; s/hiphase //') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.phased.vcf + touch ${prefix}.stats.csv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hiphase: \$(hiphase --version |& sed '1!d ; s/hiphase //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/hiphase/meta.yml b/modules/nf-core/hiphase/meta.yml new file mode 100644 index 00000000000..fcff6059a23 --- /dev/null +++ b/modules/nf-core/hiphase/meta.yml @@ -0,0 +1,83 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "hiphase" +description: pacbio structural variant calling tool +keywords: + - sort + - example + - genomics +tools: + - "hiphase": + description: "Small and structural variant phasing tool for PacBio HiFi reads" + homepage: "https://github.com/PacificBiosciences/HiPhase" + documentation: "https://github.com/PacificBiosciences/HiPhase" + tool_dev_url: "https://github.com/PacificBiosciences/HiPhase" + licence: ["Pacific Biosciences Software License Agreement"] + identifier: biotools:hiphase +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - vcf: + type: file + description: VCF File + pattern: "*.{vcf}" + - csi: + type: file + description: CSI File associated with VCF + pattern: "*.{csi}" + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam}" + - bai: + type: file + description: Index File BAI associated with BAM file + pattern: "*.{bai}" + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fasta: + type: file + description: FASTA File (used for the alignment of the BAM file) + pattern: "*.{fasta}" +output: + - vcf: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.vcf": + type: file + description: Phased VCF file + pattern: "*.vcf" + - csv: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.csv": + type: file + description: stats associated with the phasing + pattern: "*.csv" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@tanyasarkjain" +maintainers: + - "@tanyasarkjain" diff --git a/modules/nf-core/hiphase/tests/main.nf.test b/modules/nf-core/hiphase/tests/main.nf.test new file mode 100644 index 00000000000..d48f2f7fc92 --- /dev/null +++ b/modules/nf-core/hiphase/tests/main.nf.test @@ -0,0 +1,84 @@ +nextflow_process { + name "Test Process HIPHASE" + script "../main.nf" + process "HIPHASE" + + tag "modules" + tag "modules_nfcore" + tag "hiphase" + + test("homo_sapiens pacbio [vcf] [csi] [bam] [bai] [fasta]") { + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz.csi', checkIfExists: true), + + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true), + ] + + input[2] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert file(process.out.vcf[0][1]).name == "test.phased.vcf" }, + { assert file(process.out.csv[0][1]).name == "test.stats.csv" }, + { assert snapshot(process.out).match() } + + ) + } + + } + + test("hiphase - vcf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/vcf/NA03697B2_new.pbmm2.repeats.vcf.gz.csi', checkIfExists: true), + + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true), + ] + + input[2] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/hiphase/tests/main.nf.test.snap b/modules/nf-core/hiphase/tests/main.nf.test.snap new file mode 100644 index 00000000000..fe2c269e3db --- /dev/null +++ b/modules/nf-core/hiphase/tests/main.nf.test.snap @@ -0,0 +1,100 @@ +{ + "hiphase - vcf - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.phased.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.stats.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,bdbe594b7912bdb1acefa03993d4ddf7" + ], + "csv": [ + [ + { + "id": "test" + }, + "test.stats.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.phased.vcf:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bdbe594b7912bdb1acefa03993d4ddf7" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-25T15:30:16.272259201" + }, + "homo_sapiens pacbio [vcf] [csi] [bam] [bai] [fasta]": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.phased.vcf:md5,8d27a1ef3c4b28662a7559ea2ccc4681" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.stats.csv:md5,9901e909f6898db2b2a9d083a4f478d5" + ] + ], + "2": [ + "versions.yml:md5,bdbe594b7912bdb1acefa03993d4ddf7" + ], + "csv": [ + [ + { + "id": "test" + }, + "test.stats.csv:md5,9901e909f6898db2b2a9d083a4f478d5" + ] + ], + "vcf": [ + [ + { + "id": "test" + }, + "test.phased.vcf:md5,8d27a1ef3c4b28662a7559ea2ccc4681" + ] + ], + "versions": [ + "versions.yml:md5,bdbe594b7912bdb1acefa03993d4ddf7" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-06T12:46:36.677573258" + } +} \ No newline at end of file diff --git a/modules/nf-core/pbsv/call/tests/main.nf.test.snap b/modules/nf-core/pbsv/call/tests/main.nf.test.snap index 39055cca7c2..e8cee361e47 100644 --- a/modules/nf-core/pbsv/call/tests/main.nf.test.snap +++ b/modules/nf-core/pbsv/call/tests/main.nf.test.snap @@ -1,7 +1,6 @@ { "pbsv-call - [svsig] [fasta]": { "content": [ - "test.vcf", [ "versions.yml:md5,a8d62b1557c995607b315babfe0bd28b" From 7c08494acb5aba0763c5c6db87f82b249de87ea8 Mon Sep 17 00:00:00 2001 From: Jim Downie <19718667+prototaxites@users.noreply.github.com> Date: Thu, 7 Nov 2024 11:08:24 +0000 Subject: [PATCH 56/87] Add metamdbg module (#6885) * add metamdbg * add metamdbg * update tests * fix linting * Apply suggestions from code review Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> * Add prefix to output files * fix linting * Update modules/nf-core/metamdbg/asm/tests/main.nf.test Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --------- Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- modules/nf-core/metamdbg/asm/environment.yml | 7 ++ modules/nf-core/metamdbg/asm/main.nf | 62 ++++++++++ modules/nf-core/metamdbg/asm/meta.yml | 67 ++++++++++ .../nf-core/metamdbg/asm/tests/main.nf.test | 116 ++++++++++++++++++ .../metamdbg/asm/tests/main.nf.test.snap | 42 +++++++ 5 files changed, 294 insertions(+) create mode 100644 modules/nf-core/metamdbg/asm/environment.yml create mode 100644 modules/nf-core/metamdbg/asm/main.nf create mode 100644 modules/nf-core/metamdbg/asm/meta.yml create mode 100644 modules/nf-core/metamdbg/asm/tests/main.nf.test create mode 100644 modules/nf-core/metamdbg/asm/tests/main.nf.test.snap diff --git a/modules/nf-core/metamdbg/asm/environment.yml b/modules/nf-core/metamdbg/asm/environment.yml new file mode 100644 index 00000000000..854b9ef748e --- /dev/null +++ b/modules/nf-core/metamdbg/asm/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::metamdbg=1.0" diff --git a/modules/nf-core/metamdbg/asm/main.nf b/modules/nf-core/metamdbg/asm/main.nf new file mode 100644 index 00000000000..426ca3d325d --- /dev/null +++ b/modules/nf-core/metamdbg/asm/main.nf @@ -0,0 +1,62 @@ +process METAMDBG_ASM { + 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/metamdbg:1.0--hdcf5f25_1': + 'biocontainers/metamdbg:1.0--hdcf5f25_1' }" + + input: + tuple val(meta), path(reads) + val(input_type) + + output: + tuple val(meta), path("*.contigs.fasta.gz"), emit: contigs + tuple val(meta), path("*.metaMDBG.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}" + switch(input_type) { + case "hifi": input = "--in-hifi ${reads}"; break + case "ont" : input = "--in-ont ${reads}" ; break + default: + error("ERROR: input_type must be one of either 'hifi' or 'ont'.") + break + } + """ + metaMDBG asm \\ + --threads ${task.cpus} \\ + --out-dir . \\ + ${args} \\ + ${input} + + rm -r tmp/ + + mv contigs.fasta.gz ${prefix}.contigs.fasta.gz + mv metaMDBG.log ${prefix}.metaMDBG.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + metamdbg: \$(metaMDBG | grep "Version" | sed 's/ Version: //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.metaMDBG.log + touch ${prefix}.contigs.fasta.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + metamdbg: \$(metaMDBG | grep "Version" | sed 's/ Version: //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/metamdbg/asm/meta.yml b/modules/nf-core/metamdbg/asm/meta.yml new file mode 100644 index 00000000000..2bf7f17b73d --- /dev/null +++ b/modules/nf-core/metamdbg/asm/meta.yml @@ -0,0 +1,67 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "METAMDBG_ASM" +description: Metagenome assembler for long-read sequences (HiFi and ONT). +keywords: + - assembly + - long reads + - metagenome + - metagenome assembler +tools: + - "metamdbg": + description: "MetaMDBG: a lightweight assembler for long and accurate metagenomics + reads." + homepage: "https://github.com/GaetanBenoitDev/metaMDBG" + documentation: "https://github.com/GaetanBenoitDev/metaMDBG" + tool_dev_url: "https://github.com/GaetanBenoitDev/metaMDBG" + doi: "10.1038/s41587-023-01983-6" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - reads: + type: file + description: Long read sequence data from ONT or HiFi in fasta format (can be + gzipped) + pattern: "*.{fa,fasta,fa.gz,fasta.gz}" + + - - input_type: + type: string + description: Sequencing technology for reads - either "hifi" for PacBio HiFi + reads or "ont" for Oxford Nanopore reads. + +output: + - contigs: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.contigs.fasta.gz": + type: file + description: | + Gzipped fasta file containing the assembled contigs from the input + reads. + - log: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.metaMDBG.log": + type: file + description: Log file describing the metaMDBG run. + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@prototaxites" +maintainers: + - "@prototaxites" diff --git a/modules/nf-core/metamdbg/asm/tests/main.nf.test b/modules/nf-core/metamdbg/asm/tests/main.nf.test new file mode 100644 index 00000000000..6b8d59f1fc1 --- /dev/null +++ b/modules/nf-core/metamdbg/asm/tests/main.nf.test @@ -0,0 +1,116 @@ +nextflow_process { + + name "Test Process METAMDBG_ASM" + script "../main.nf" + process "METAMDBG_ASM" + + tag "modules" + tag "modules_nfcore" + tag "metamdbg" + tag "metamdbg/asm" + + test("metamdbg_asm - ont") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/nanopore/fastq/test.fastq.gz', checkIfExists: true), + ] + input[1] = "ont" + """ + } + } + + then { + assertAll( + { assert process.success }, + // output is stochastic - contig names differ per run + // log file contains nextflow work dir paths + { assert snapshot( + file(process.out.contigs[0][1]).name, + file(process.out.log[0][1]).name, + process.out.versions + ).match() }, + { assert path(process.out.log[0][1]).readLines().last().contains("Done!") } + ) + } + } + test("metamdbg_asm - hifi") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), + ] + input[1] = "hifi" + """ + } + } + + then { + assertAll( + { assert process.success }, + // output is stochastic - contig names differ per run + // log file contains nextflow work dir paths + { assert snapshot( + file(process.out.contigs[0][1]).name, + file(process.out.log[0][1]).name, + process.out.versions + ).match() }, + { assert path(process.out.log[0][1]).readLines().last().contains("Done!") } + ) + } + } + + test("metamdbg_asm - wrong format") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), + ] + input[1] = "wrong" + """ + } + } + + then { + assertAll( + { assert process.failed }, + { assert process.errorReport.contains("ERROR: input_type must be one of either 'hifi' or 'ont'.") } + ) + } + + } + + test("metamdbg_asm - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/fastq/test_hifi.fastq.gz', checkIfExists: true), + ] + input[1] = "hifi" + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match("stub_versions") } + ) + } + + } +} diff --git a/modules/nf-core/metamdbg/asm/tests/main.nf.test.snap b/modules/nf-core/metamdbg/asm/tests/main.nf.test.snap new file mode 100644 index 00000000000..1b48053ac1c --- /dev/null +++ b/modules/nf-core/metamdbg/asm/tests/main.nf.test.snap @@ -0,0 +1,42 @@ +{ + "metamdbg_asm - hifi": { + "content": [ + "test.contigs.fasta.gz", + "test.metaMDBG.log", + [ + "versions.yml:md5,d8ff2a5fe2bb5c7eecd24ff95bf70c06" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-05T11:42:07.219676949" + }, + "metamdbg_asm - ont": { + "content": [ + "test.contigs.fasta.gz", + "test.metaMDBG.log", + [ + "versions.yml:md5,d8ff2a5fe2bb5c7eecd24ff95bf70c06" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-05T11:41:15.996586123" + }, + "stub_versions": { + "content": [ + [ + "versions.yml:md5,d8ff2a5fe2bb5c7eecd24ff95bf70c06" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-05T11:42:35.946169222" + } +} \ No newline at end of file From 033f2f25fa14ea81a4b93502d1dc6c2caf21cc92 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 7 Nov 2024 12:49:46 +0100 Subject: [PATCH 57/87] Tidy up Python script to fetch Singularity HTTPS image URLs (#6945) * Tidy up Python script to fetch Singularity HTTPS image URLs * Address review comments --- .github/scripts/wave_singularity.py | 117 ++++++++++++++++++---------- 1 file changed, 75 insertions(+), 42 deletions(-) diff --git a/.github/scripts/wave_singularity.py b/.github/scripts/wave_singularity.py index 5e97395674f..c1ffae47d0e 100755 --- a/.github/scripts/wave_singularity.py +++ b/.github/scripts/wave_singularity.py @@ -2,53 +2,86 @@ # /// script # requires-python = ">=3.10" # dependencies = [ -# "httpx", +# "requests", +# "rich", # ] # /// import logging -import httpx +import requests +import rich_click as click +from rich.logging import RichHandler +# Replace the basic logger setup with rich logging +logging.basicConfig( + level=logging.INFO, + format="%(message)s", + handlers=[ + RichHandler( + rich_tracebacks=True, + show_time=False, + markup=True, + ) + ], +) logger = logging.getLogger(__name__) +click.rich_click.SHOW_ARGUMENTS = True -image_url = "oras://community.wave.seqera.io/library/pybedtools_bedtools_htslib_pip_pypints:aa20de1f1b5ddb30" - -if image_url.startswith("oras://"): - image_url = image_url.replace("oras://", "") - -wave_api_url = "https://wave.seqera.io" -url = f"{wave_api_url}/v1alpha1/inspect" - -# if platform_pat: -# data["toweraccesstoken"] = platform_pat -# else: -# TODO -logger.warning("'platform_pat' not set, no auth to wave back end") - -try: - logger.info(f"calling image inspect at {url} for image url {image_url}") - response = httpx.post( - url=url, - json={"containerImage": image_url}, - headers={"content-type": "application/json"}, - ) - - data = response.json() - logger.debug(data) - layers = data.get("container", {}).get("manifest", {}).get("layers", []) - is_singularity = len(layers) == 1 and layers[0].get("mediaType", "").endswith(".sif") - if not is_singularity: - print(layers) - raise ValueError("not a singularity image") - if "digest" not in layers[0]: - print(layers) - raise ValueError("no 'digest' in first layer found") - - digest = layers[0]["digest"].replace("sha256:", "") - container_url = f"https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/{digest[:2]}/{digest}/data" - print(container_url) - -except httpx.RequestError as exc: - print(f"An error occurred while requesting {exc.request.url!r}.") - print("No singularity image for you") + +@click.command() +@click.option( + "--platform-pat", + envvar="SEQERA_ACCESS_TOKEN", + show_envvar=True, + help="Platform authentication token", +) +@click.argument("image_name") +def main(image_name, platform_pat): + """Script to return a HTTPS Singularity image URL from Seqera Containers.""" + + if image_name.startswith("oras://"): + image_name = image_name.replace("oras://", "") + + wave_api_url_base = "https://wave.seqera.io" + wave_api_url = f"{wave_api_url_base}/v1alpha1/inspect" + container_url_base = "https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256" + + request_data = {"containerImage": image_name} + if platform_pat: + request_data["toweraccesstoken"] = platform_pat + else: + logger.debug("'--platform-pat' / '$TOWER_ACCESS_TOKEN' not set, no auth to wave back end") + + try: + logger.debug(f"Calling image inspect at {wave_api_url} for image url '{image_name}'") + response = requests.post( + url=wave_api_url, + json=request_data, + headers={"content-type": "application/json"}, + ) + + data = response.json() + logger.debug(data) + layers = data.get("container", {}).get("manifest", {}).get("layers", []) + is_singularity = len(layers) == 1 and layers[0].get("mediaType", "").endswith(".sif") + logger.debug(layers) + if not is_singularity: + raise ValueError("Not a singularity image") + if "digest" not in layers[0]: + raise ValueError("no 'digest' in first layer found") + + digest = layers[0]["digest"].replace("sha256:", "") + container_url = f"{container_url_base}/{digest[:2]}/{digest}/data" + print(container_url) + + except requests.RequestException as exc: + raise ValueError(f"An error occurred while requesting {wave_api_url}\n {exc}") + + +if __name__ == "__main__": + try: + main() + except ValueError as exc: + logger.error(f"[red]{exc}[/red]") + exit(1) From a2db453d5fbb85108ce98a5c757aacfb818bc597 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 7 Nov 2024 16:30:49 +0100 Subject: [PATCH 58/87] Add hostile/fetch (#6949) * Add hostile/fetch * [automated] Fix linting with Prettier * Fix nf-core linting * fix stub test * Fix stub version generation and md5sum * Update modules/nf-core/hostile/fetch/meta.yml --------- Co-authored-by: nf-core-bot Co-authored-by: Sateesh Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/hostile/fetch/environment.yml | 7 ++ modules/nf-core/hostile/fetch/main.nf | 50 ++++++++++++ modules/nf-core/hostile/fetch/meta.yml | 38 +++++++++ .../nf-core/hostile/fetch/tests/main.nf.test | 50 ++++++++++++ .../hostile/fetch/tests/main.nf.test.snap | 78 +++++++++++++++++++ 5 files changed, 223 insertions(+) create mode 100644 modules/nf-core/hostile/fetch/environment.yml create mode 100644 modules/nf-core/hostile/fetch/main.nf create mode 100644 modules/nf-core/hostile/fetch/meta.yml create mode 100644 modules/nf-core/hostile/fetch/tests/main.nf.test create mode 100644 modules/nf-core/hostile/fetch/tests/main.nf.test.snap diff --git a/modules/nf-core/hostile/fetch/environment.yml b/modules/nf-core/hostile/fetch/environment.yml new file mode 100644 index 00000000000..ef103e9a834 --- /dev/null +++ b/modules/nf-core/hostile/fetch/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::hostile=1.1.0" diff --git a/modules/nf-core/hostile/fetch/main.nf b/modules/nf-core/hostile/fetch/main.nf new file mode 100644 index 00000000000..87e1244f136 --- /dev/null +++ b/modules/nf-core/hostile/fetch/main.nf @@ -0,0 +1,50 @@ +process HOSTILE_FETCH { + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hostile:1.1.0--pyhdfd78af_0': + 'biocontainers/hostile:1.1.0--pyhdfd78af_0' }" + + output: + path "reference/" , emit: reference + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + mkdir reference/ + export HOSTILE_CACHE_DIR=./reference + + hostile \\ + fetch \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hostile: \$(hostile --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + """ + mkdir reference/ + export HOSTILE_CACHE_DIR=./reference + + touch reference/human-t2t-hla.1.bt2 + touch reference/human-t2t-hla.2.bt2 + touch reference/human-t2t-hla.3.bt2 + touch reference/human-t2t-hla.4.bt2 + touch reference/human-t2t-hla.rev.1.bt2 + touch reference/human-t2t-hla.rev.2.bt2 + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hostile: \$(hostile --version) + END_VERSIONS + """ +} diff --git a/modules/nf-core/hostile/fetch/meta.yml b/modules/nf-core/hostile/fetch/meta.yml new file mode 100644 index 00000000000..b84d82d8471 --- /dev/null +++ b/modules/nf-core/hostile/fetch/meta.yml @@ -0,0 +1,38 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "hostile_fetch" +description: Downloads required reference genomes for Hostile +keywords: + - hostile + - decontamination + - human removal + - download +tools: + - "hostile": + description: "Hostile: accurate host decontamination" + homepage: "https://github.com/bede/hostile" + documentation: "https://github.com/bede/hostile" + tool_dev_url: "https://github.com/bede/hostile" + doi: "10.1093/bioinformatics/btad728" + licence: ["MIT"] + identifier: biotools:hostile + +output: + - reference: + - "reference/": + type: directory + description: Directory containing required reference genome files + for hostile clean + pattern: "reference/" + ontologies: + - edam: "http://edamontology.org/data_1049" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@jfy133" +maintainers: + - "@jfy133" diff --git a/modules/nf-core/hostile/fetch/tests/main.nf.test b/modules/nf-core/hostile/fetch/tests/main.nf.test new file mode 100644 index 00000000000..387c554b563 --- /dev/null +++ b/modules/nf-core/hostile/fetch/tests/main.nf.test @@ -0,0 +1,50 @@ +nextflow_process { + + name "Test Process HOSTILE_FETCH" + script "../main.nf" + process "HOSTILE_FETCH" + + tag "modules" + tag "modules_nfcore" + tag "hostile" + tag "hostile/fetch" + + test("default") { + + when { + process { + """ + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("default - stub") { + + options "-stub" + + when { + process { + """ + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/hostile/fetch/tests/main.nf.test.snap b/modules/nf-core/hostile/fetch/tests/main.nf.test.snap new file mode 100644 index 00000000000..5b666da5df0 --- /dev/null +++ b/modules/nf-core/hostile/fetch/tests/main.nf.test.snap @@ -0,0 +1,78 @@ +{ + "default": { + "content": [ + { + "0": [ + [ + "human-t2t-hla.1.bt2:md5,b481b623a14908f29c5dce42077f8763", + "human-t2t-hla.2.bt2:md5,8df357276c7c3a4e768ecd70ca951b53", + "human-t2t-hla.3.bt2:md5,78289afb436f8d0a9526ecfa95e3fa24", + "human-t2t-hla.4.bt2:md5,198badf146cd0b3886b674424250d419", + "human-t2t-hla.fa.gz:md5,65dfdc3245d5a34616e71c999e0a49d7", + "human-t2t-hla.rev.1.bt2:md5,34c65db94aba9cc49cb31e14d2698c1c", + "human-t2t-hla.rev.2.bt2:md5,53c9901609915475a2e1b009046d8371" + ] + ], + "1": [ + "versions.yml:md5,946753059fc7eb42e87c6e22a8bbfd7b" + ], + "reference": [ + [ + "human-t2t-hla.1.bt2:md5,b481b623a14908f29c5dce42077f8763", + "human-t2t-hla.2.bt2:md5,8df357276c7c3a4e768ecd70ca951b53", + "human-t2t-hla.3.bt2:md5,78289afb436f8d0a9526ecfa95e3fa24", + "human-t2t-hla.4.bt2:md5,198badf146cd0b3886b674424250d419", + "human-t2t-hla.fa.gz:md5,65dfdc3245d5a34616e71c999e0a49d7", + "human-t2t-hla.rev.1.bt2:md5,34c65db94aba9cc49cb31e14d2698c1c", + "human-t2t-hla.rev.2.bt2:md5,53c9901609915475a2e1b009046d8371" + ] + ], + "versions": [ + "versions.yml:md5,946753059fc7eb42e87c6e22a8bbfd7b" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T12:49:16.503252839" + }, + "default - stub": { + "content": [ + { + "0": [ + [ + "human-t2t-hla.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.3.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.4.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.rev.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.rev.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,946753059fc7eb42e87c6e22a8bbfd7b" + ], + "reference": [ + [ + "human-t2t-hla.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.3.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.4.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.rev.1.bt2:md5,d41d8cd98f00b204e9800998ecf8427e", + "human-t2t-hla.rev.2.bt2:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,946753059fc7eb42e87c6e22a8bbfd7b" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T14:53:24.640950662" + } +} \ No newline at end of file From 669eb24fd82a9d3cb18ad0e73673ecb26827f683 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:59:45 -0600 Subject: [PATCH 59/87] Add CI to build mulled containers with Wave (#4080) * build: Add wave * build: Set strategy to dockerfile, conda then container * refactor: Remove container * build: Add a repo to push to * ci(wave): Add wave build https://github.com/nodejs/docker-node/blob/3c4fa6daf06a4786d202f2f610351837806a0380/.github/workflows/build-test.yml#L29 * ci(wave): Switch to all_changed_files * ci(wave): Only look for envronment.ymls * dummy: Change env * ci(wave): Remove raw format * ci(wave): Try a bunch of different things at once * ci(wave): Remove redundant fromJson and wrap in an array * ci(wave): I have no idea what I'm doing * ci(wave): Wrap it * ci(wave): Found an example https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml * ci(wave): Maybe quotes? * ci(wave): That'll do it * ci(wave): Fix wave install * ci(wave): Hard code an image * ci(wave): Add secrets * feat: Try a different files structure * ci(wave): First stab at building singularity images * fixup! feat: Try a different files structure * ci(wave): Add profile to matrix * ci(wave): Give up on fancy substitution * ci(wave): Add await Co-authored-by: ewels * ci(wave): Switch to quay * test(wave): Add freeze and update build repo * refactor(wave): What happens if I add a container? * refactor(wave): Have both bowtie modules use the same env For the sake of demonstration * test: Cut out using wave on tests * refactor: What happens if we use the singularity one? * refactor: Keep container directives for offline download https://github.com/seqeralabs/wave/issues/323 * feat: Try new singularity OCI setting https://github.com/nextflow-io/nextflow/commit/f5362a7b067173a29d684663df22bb48fbbf5659 * build: Update container name Guess #4327 broke that * chore: Bump wave-cli version * ci: Install runc * ci: Switch to singularityhub action https://github.com/nextflow-io/nextflow/issues/4543 * ci: Install new singularity manually Why that action trys to build from source, idk. * ci: Install dependancies for singularity * ci: runc => crun * ci: Fix cgroup error https://blog.misharov.pro/2021-05-16/systemd-github-actions * ci: That'll do it * ci: Remove Dockerfile We'll have a seperate action for this I think * ci: Update name * ci: Push to the correct repos * ci: Remove OCI stuff * ci: Need a full URL * ci: Fix // in container name * ci: Remove push Build once, renovate should bump the images automagically * build: Add containers back * ci: Add cache repos Idk what this does exactly * ci: Change registry name to use _ Because "build" is a api end point on quay.io. So `bowtie/build` doesn't work. Other plus is this matches the conda env name. * build: / => _ in container name * Try ociAutoPull * chore: Add renovate comments to samtools Just to trigger wave build * test: Add ociAutoPull to nf-test * ci: Bump wave version * chore: Bump containers with new wave version Not sure why that's happening... * build: Update to use commity.wave.seqera.io * ci: Bump wave-cli to 1.4.1 * ci: Try apptainer * ci: Remove build-repo to see what happens * build: Bump Nextflow version requirement * fix: Get rid of the environment name? Maybe this will get the auto generated tag? * ci: Bump action versions * ci: Try name-strategy tagPrefix https://github.com/seqeralabs/wave-cli/commit/269df0e52e18c9dbd919a5a5b8934a37b5300ad1 * ci: Remove singularity build for now * ci: Try imageSuffix * ci: Try none * ci: What is the bowtie container name * ci: Remove --name-strategy * style: Add back in container elvis operator * ci: Remove cache repo * Revert "build: Bump Nextflow version requirement" This reverts commit 69e1ea59a079752946682a04c2a3c066b21bc283. * Revert "test: Add ociAutoPull to nf-test" This reverts commit 5a3d54609b67b1814c545b7e3dd8b49a82cb00e6. * test(#6505): Snapshot the versions contents, not the hash * ci(#6505): Update version snapshot after building containers * test(#6505): Attempt a topic channel with tests https://github.com/askimed/nf-test/issues/258 * chore: Bump to 1.5.0 * fix: Remove shard and filter on test bumping * build: Bump images to match environment * ci: Fix nf-test setup * ci: Remove snapshot bumping * build: Fix containers in bowtie --------- Co-authored-by: ewels --- .github/workflows/wave.yml | 138 ++++++++++++++++++ modules/nf-core/bowtie/align/environment.yml | 6 +- modules/nf-core/bowtie/align/main.nf | 4 +- modules/nf-core/bowtie/build/environment.yml | 5 +- modules/nf-core/bowtie/build/main.nf | 4 +- .../nf-core/bowtie/build/tests/main.nf.test | 4 +- modules/nf-core/samtools/view/environment.yml | 2 + modules/nf-core/samtools/view/main.nf | 4 +- 8 files changed, 157 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/wave.yml diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml new file mode 100644 index 00000000000..d450ef24d34 --- /dev/null +++ b/.github/workflows/wave.yml @@ -0,0 +1,138 @@ +name: Wave +# When environment.yml is changed +on: + pull_request: + paths: + - "**/environment.yml" + +# TODO On complete call testing CI +# TODO Skip testing CI if any changes to environment.yml + +env: + WAVE_VER: "1.5.0" + NFTEST_VER: "0.9.1" + +jobs: + gen-matrix: + name: generate-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + + - name: Calculate file differences + id: diff + uses: tj-actions/changed-files@v44 + with: + json: true + quotepath: false + # TODO Add Dockerfiles + files: | + modules/**/environment.yml + - name: Debug + run: echo ${{ steps.diff.outputs.all_changed_files }} + - id: set-matrix + run: echo "matrix={\"profile\":[\"docker\", \"singularity\"],\"files\":${{ steps.diff.outputs.all_changed_files }} }" >> "$GITHUB_OUTPUT" + + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + build: + if: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" + needs: gen-matrix + name: build + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + + - name: Install wave-cli + run: | + wget -q https://github.com/seqeralabs/wave-cli/releases/download/v${WAVE_VER}/wave-${WAVE_VER}-linux-x86_64 + sudo mv wave-${WAVE_VER}-linux-x86_64 /usr/local/bin/wave + chmod +x /usr/local/bin/wave + + - name: Create a registry name + uses: actions/github-script@v7 + id: registry-name + with: + result-encoding: string + script: | + return '${{ matrix.files }}'.replace('modules/nf-core/', '').replace('/environment.yml', '').replace('/', '_'); + + - name: Build container + if: matrix.profile == 'docker' + run: | + wave --conda-file "${{ matrix.files }}" \ + --freeze \ + --await \ + --tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ + --tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} + + - name: Build Singularity + if: matrix.profile == 'singularity' + run: | + wave --conda-file "${{ matrix.files }}" \ + --freeze \ + --await \ + --tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ + --tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} \ + --singularity + + # TODO Build from Dockerfiles + + # bump-versions: + # needs: gen-matrix + # name: bump-versions + # runs-on: ubuntu-latest + # steps: + # - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + # with: + # distribution: "temurin" + # java-version: "17" + + # - uses: nf-core/setup-nextflow@v2 + + # - uses: nf-core/setup-nf-test@v1 + # with: + # version: ${{ env.NFTEST_VER }} + + # - name: Bump Snapshot Versions + # env: + # # NFT_DIFF: "pdiff" + # # NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2" + # SENTIEON_LICSRVR_IP: ${{ secrets.SENTIEON_LICSRVR_IP }} + # SENTIEON_AUTH_MECH: "GitHub Actions - token" + # run: | + # # use "docker_self_hosted" if it runs on self-hosted runner and matrix.profile=docker + # if [ "${{ matrix.profile }}" == "docker" ]; then + # PROFILE="docker_self_hosted" + # else + # PROFILE=${{ matrix.profile }} + # fi + + # NFT_WORKDIR=~ \ + # nf-test test \ + # --profile=${{ matrix.profile }} \ + # --tap=test.tap \ + # # --ci \ + # --verbose \ + # --only-changed \ + # # --shard ${{ matrix.shard }}/${{ env.TOTAL_SHARDS }} \ + # # --filter ${{ matrix.filter }} \ + # --follow-dependencies \ + # --tag version \ + # --update-snapshot + + # - name: Commit & push version bumps + # run: | + # git config user.email "core@nf-co.re" + # git config user.name "nf-core-bot" + # git config push.default upstream + # git add . + # git status + # git commit -m "[automated] Bump versions snapshot" + # git push diff --git a/modules/nf-core/bowtie/align/environment.yml b/modules/nf-core/bowtie/align/environment.yml index 4434c7e7143..61bd69c2c7a 100644 --- a/modules/nf-core/bowtie/align/environment.yml +++ b/modules/nf-core/bowtie/align/environment.yml @@ -2,5 +2,7 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::bowtie=1.3.0 - - bioconda::samtools=1.16.1 + # renovate: datasource=conda depName=bioconda/bowtie + - bioconda::bowtie=1.3.1 + # renovate: datasource=conda depName=bioconda/samtools + - bioconda::samtools=1.20 diff --git a/modules/nf-core/bowtie/align/main.nf b/modules/nf-core/bowtie/align/main.nf index 5e72b02a678..3dee85ffb4d 100644 --- a/modules/nf-core/bowtie/align/main.nf +++ b/modules/nf-core/bowtie/align/main.nf @@ -4,8 +4,8 @@ process BOWTIE_ALIGN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:c84c7c55c45af231883d9ff4fe706ac44c479c36-0' : - 'biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:c84c7c55c45af231883d9ff4fe706ac44c479c36-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/c8/c8c0819a9b1f520c49c933e667ae50de2a0730ece4c8b9efe79ac5e403963a9f/data' : + 'community​.wave​.seqera​.io/library/bowtie_samtools:e1a14e1ce4e0170d' }" input: tuple val(meta), path(reads) diff --git a/modules/nf-core/bowtie/build/environment.yml b/modules/nf-core/bowtie/build/environment.yml index ab5a842215c..61bd69c2c7a 100644 --- a/modules/nf-core/bowtie/build/environment.yml +++ b/modules/nf-core/bowtie/build/environment.yml @@ -2,4 +2,7 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::bowtie=1.3.0 + # renovate: datasource=conda depName=bioconda/bowtie + - bioconda::bowtie=1.3.1 + # renovate: datasource=conda depName=bioconda/samtools + - bioconda::samtools=1.20 diff --git a/modules/nf-core/bowtie/build/main.nf b/modules/nf-core/bowtie/build/main.nf index d5b4c690404..0f6b9d4d1bf 100644 --- a/modules/nf-core/bowtie/build/main.nf +++ b/modules/nf-core/bowtie/build/main.nf @@ -4,8 +4,8 @@ process BOWTIE_BUILD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1' : - 'biocontainers/bowtie:1.3.0--py38hed8969a_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/c8/c8c0819a9b1f520c49c933e667ae50de2a0730ece4c8b9efe79ac5e403963a9f/data' : + 'community​.wave​.seqera​.io/library/bowtie_samtools:e1a14e1ce4e0170d' }" input: tuple val(meta), path(fasta) diff --git a/modules/nf-core/bowtie/build/tests/main.nf.test b/modules/nf-core/bowtie/build/tests/main.nf.test index 25fb3dad83b..81209a7b1fc 100644 --- a/modules/nf-core/bowtie/build/tests/main.nf.test +++ b/modules/nf-core/bowtie/build/tests/main.nf.test @@ -34,6 +34,7 @@ nextflow_process { test("sarscov2 - fasta - stub") { options "-stub" + tag "stub" when { process { @@ -48,7 +49,8 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot(process.out).match() }, + { assert snapshot(path(process.out.versions.get(0)).yaml).match("versions") }, ) } diff --git a/modules/nf-core/samtools/view/environment.yml b/modules/nf-core/samtools/view/environment.yml index 62054fc97ac..02cda6e6a3b 100644 --- a/modules/nf-core/samtools/view/environment.yml +++ b/modules/nf-core/samtools/view/environment.yml @@ -4,5 +4,7 @@ channels: - conda-forge - bioconda dependencies: + # renovate: datasource=conda depName=bioconda/htslib - bioconda::htslib=1.21 + # renovate: datasource=conda depName=bioconda/samtools - bioconda::samtools=1.21 diff --git a/modules/nf-core/samtools/view/main.nf b/modules/nf-core/samtools/view/main.nf index 37e05cec887..41fa3d6a0b9 100644 --- a/modules/nf-core/samtools/view/main.nf +++ b/modules/nf-core/samtools/view/main.nf @@ -4,8 +4,8 @@ process SAMTOOLS_VIEW { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.21--h50ea8bc_0' : - 'biocontainers/samtools:1.21--h50ea8bc_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/9e/9edc2564215d5cd137a8b25ca8a311600987186d406b092022444adf3c4447f7/data' : + 'community​.wave​.seqera​.io/library/htslib_samtools:1​.21--6cb89bfd40cbaabf' }" input: tuple val(meta), path(input), path(index) From dfe1c9a57618d3d3bf0ba4239a3eda0e17eea387 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Thu, 7 Nov 2024 17:33:04 +0100 Subject: [PATCH 60/87] Add FCSGX_FETCHDB (#6948) --- modules/nf-core/fcsgx/fetchdb/environment.yml | 7 +++ modules/nf-core/fcsgx/fetchdb/main.nf | 46 +++++++++++++++ modules/nf-core/fcsgx/fetchdb/meta.yml | 39 +++++++++++++ .../nf-core/fcsgx/fetchdb/tests/main.nf.test | 56 +++++++++++++++++++ .../fcsgx/fetchdb/tests/main.nf.test.snap | 46 +++++++++++++++ 5 files changed, 194 insertions(+) create mode 100644 modules/nf-core/fcsgx/fetchdb/environment.yml create mode 100644 modules/nf-core/fcsgx/fetchdb/main.nf create mode 100644 modules/nf-core/fcsgx/fetchdb/meta.yml create mode 100644 modules/nf-core/fcsgx/fetchdb/tests/main.nf.test create mode 100644 modules/nf-core/fcsgx/fetchdb/tests/main.nf.test.snap diff --git a/modules/nf-core/fcsgx/fetchdb/environment.yml b/modules/nf-core/fcsgx/fetchdb/environment.yml new file mode 100644 index 00000000000..8fbbad1b543 --- /dev/null +++ b/modules/nf-core/fcsgx/fetchdb/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::ncbi-fcs-gx=0.5.4" diff --git a/modules/nf-core/fcsgx/fetchdb/main.nf b/modules/nf-core/fcsgx/fetchdb/main.nf new file mode 100644 index 00000000000..4476225870d --- /dev/null +++ b/modules/nf-core/fcsgx/fetchdb/main.nf @@ -0,0 +1,46 @@ +process FCSGX_FETCHDB { + tag "$manifest.baseName" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ncbi-fcs-gx:0.5.4--h4ac6f70_1': + 'biocontainers/ncbi-fcs-gx:0.5.4--h4ac6f70_1' }" + + input: + val manifest // URL of manifest. Should not stage locally. + + output: + path "$prefix" , emit: database + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "gxdb_$manifest.baseName" + """ + sync_files.py \\ + get \\ + --mft "${manifest.toUriString()}" \\ + --dir "$prefix" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcs_gx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ + + stub: + // def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "gxdb_$manifest.baseName" + """ + touch ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcs_gx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fcsgx/fetchdb/meta.yml b/modules/nf-core/fcsgx/fetchdb/meta.yml new file mode 100644 index 00000000000..29cdb1a7893 --- /dev/null +++ b/modules/nf-core/fcsgx/fetchdb/meta.yml @@ -0,0 +1,39 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "fcsgx_fetchdb" +description: Fetches the NCBI FCS-GX database using a provided manifest URL +keywords: + - fcs-gx + - database + - fetch + - ncbi +tools: + - "fcsgx": + description: "The NCBI Foreign Contamination Screen. Genomic cross-species aligner, + for contamination detection." + homepage: "https://github.com/ncbi/fcs-gx" + documentation: "https://github.com/ncbi/fcs/wiki/" + tool_dev_url: "https://github.com/ncbi/fcs-gx" + doi: "10.1186/s13059-024-03198-7" + licence: ["NCBI-PD"] + identifier: "biotools:ncbi_fcs" + +input: + - - manifest: + type: file + description: URL to a FCXGX database + pattern: "https://ftp*.manifest" + +output: + - database: + - $prefix: + type: directory + description: A directory containing an FCSGX database + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@mahesh-panchal" +maintainers: + - "@mahesh-panchal" diff --git a/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test b/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test new file mode 100644 index 00000000000..4b3fc35dcae --- /dev/null +++ b/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test @@ -0,0 +1,56 @@ +nextflow_process { + + name "Test Process FCSGX_FETCHDB" + script "../main.nf" + process "FCSGX_FETCHDB" + + tag "modules" + tag "modules_nfcore" + tag "fcsgx" + tag "fcsgx/fetchdb" + + test("fcsgx-test-data - test-manifest") { + when { + process { + """ + input[0] = file('https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/FCS/database/test-only/test-only.manifest', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + // Some output files are too large to calcualte MD5sums, so we just list the files in the output directory. + { assert snapshot( + file(process.out.database.get(0)).list().sort(), + process.out.versions + ).match() + } + ) + } + + } + + test("fcsgx-test-data - test-manifest - stub") { + + options "-stub" + + when { + process { + """ + input[0] = file('https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/FCS/database/test-only/test-only.manifest', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test.snap b/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test.snap new file mode 100644 index 00000000000..9eb3101f4b4 --- /dev/null +++ b/modules/nf-core/fcsgx/fetchdb/tests/main.nf.test.snap @@ -0,0 +1,46 @@ +{ + "fcsgx-test-data - test-manifest - stub": { + "content": [ + { + "0": [ + "gxdb_test-only:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "versions.yml:md5,255b19efa9034a4f9485eefab3991403" + ], + "database": [ + "gxdb_test-only:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,255b19efa9034a4f9485eefab3991403" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T10:49:06.260278105" + }, + "fcsgx-test-data - test-manifest": { + "content": [ + [ + "test-only.blast_div.tsv.gz", + "test-only.gxi", + "test-only.gxs", + "test-only.manifest", + "test-only.meta.jsonl", + "test-only.seq_info.tsv.gz", + "test-only.taxa.tsv" + ], + [ + "versions.yml:md5,255b19efa9034a4f9485eefab3991403" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T10:55:34.925919844" + } +} \ No newline at end of file From 6d2697d914c7e62ef22d5856bf5a46b67fa88c2e Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:46:04 -0600 Subject: [PATCH 61/87] Skip wave if the PR is from a fork (#6954) ci: Don't run wave if the PR comes from a fork --- .github/workflows/wave.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index d450ef24d34..eba1e1f90d6 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -13,9 +13,10 @@ env: NFTEST_VER: "0.9.1" jobs: - gen-matrix: + generate-matrix: name: generate-matrix runs-on: ubuntu-latest + if: github.repository == 'nf-core/modules' steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 @@ -39,6 +40,7 @@ jobs: build: if: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" + # if: github.repository == 'nf-core/modules' needs: gen-matrix name: build runs-on: ubuntu-latest From c9644305ef51b9f053649151a2849f1952090864 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Thu, 7 Nov 2024 16:04:11 -0600 Subject: [PATCH 62/87] ci: Use correct job name (#6955) * ci: Use correct job name * chore: Touch an environment.yml to trigger wave --- .github/workflows/wave.yml | 9 +++++---- modules/nf-core/ale/environment.yml | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index eba1e1f90d6..381c2240b36 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -39,15 +39,16 @@ jobs: matrix: ${{ steps.set-matrix.outputs.matrix }} build: - if: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" + # NOTE This should get skipped because generate-matrix won't run # if: github.repository == 'nf-core/modules' - needs: gen-matrix + if: "${{ fromJson(needs.generate-matrix.outputs.matrix) }}" + needs: generate-matrix name: build runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false - matrix: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" + matrix: "${{ fromJson(needs.generate-matrix.outputs.matrix) }}" steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 @@ -87,7 +88,7 @@ jobs: # TODO Build from Dockerfiles # bump-versions: - # needs: gen-matrix + # needs: generate-matrix # name: bump-versions # runs-on: ubuntu-latest # steps: diff --git a/modules/nf-core/ale/environment.yml b/modules/nf-core/ale/environment.yml index 8993eb2a399..566c1d72404 100644 --- a/modules/nf-core/ale/environment.yml +++ b/modules/nf-core/ale/environment.yml @@ -5,4 +5,5 @@ channels: - bioconda - tanghaibao dependencies: + # renovate: datasource=conda depName=bioconda/ale - "bioconda::ale=20180904" From 3f6e7c25c31bc49691838736b0daa9224f0c215c Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:17:09 -0600 Subject: [PATCH 63/87] Enable Harshil Alignment (#6956) * chore: Enable Harshil Alignment in the settings.json * Recommend Nextflow extension * Add nf-core Extension pack to recommended extensions * style: Run prettier --- .vscode/extensions.json | 3 +++ .vscode/settings.json | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000000..110de115712 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["nextflow.nextflow", "nf-core.nf-core-extensionpack"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000000..e810756abdf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "nextflow.formatting.harshilAlignment": true +} From b55cf80ac92cba9bff88ad8bdf01d434ccf2d73c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 07:52:23 +0100 Subject: [PATCH 64/87] chore(deps): update github actions (#6957) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/wave.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index 381c2240b36..715112e39a5 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -19,11 +19,11 @@ jobs: if: github.repository == 'nf-core/modules' steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Calculate file differences id: diff - uses: tj-actions/changed-files@v44 + uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44 with: json: true quotepath: false @@ -50,7 +50,7 @@ jobs: fail-fast: false matrix: "${{ fromJson(needs.generate-matrix.outputs.matrix) }}" steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Install wave-cli run: | @@ -59,7 +59,7 @@ jobs: chmod +x /usr/local/bin/wave - name: Create a registry name - uses: actions/github-script@v7 + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 id: registry-name with: result-encoding: string From f8cba37720f1db2ba89e9b3b7824cd92642a8835 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 06:54:52 +0000 Subject: [PATCH 65/87] chore(deps): update tj-actions/changed-files action to v45 (#6958) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/wave.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index 715112e39a5..08e376c50ee 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -23,7 +23,7 @@ jobs: - name: Calculate file differences id: diff - uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44 + uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45 with: json: true quotepath: false From ca0b47f14ab29d460e269fc41973bf85e063391b Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Fri, 8 Nov 2024 16:18:37 +0100 Subject: [PATCH 66/87] Add FCSGX_RUNGX (#6952) * Add FCSGX_RUNGX * Update tests for conda --- modules/nf-core/fcsgx/rungx/environment.yml | 7 + modules/nf-core/fcsgx/rungx/main.nf | 64 +++++++++ modules/nf-core/fcsgx/rungx/meta.yml | 93 +++++++++++++ .../nf-core/fcsgx/rungx/tests/main.nf.test | 85 ++++++++++++ .../fcsgx/rungx/tests/main.nf.test.snap | 125 ++++++++++++++++++ 5 files changed, 374 insertions(+) create mode 100644 modules/nf-core/fcsgx/rungx/environment.yml create mode 100644 modules/nf-core/fcsgx/rungx/main.nf create mode 100644 modules/nf-core/fcsgx/rungx/meta.yml create mode 100644 modules/nf-core/fcsgx/rungx/tests/main.nf.test create mode 100644 modules/nf-core/fcsgx/rungx/tests/main.nf.test.snap diff --git a/modules/nf-core/fcsgx/rungx/environment.yml b/modules/nf-core/fcsgx/rungx/environment.yml new file mode 100644 index 00000000000..8fbbad1b543 --- /dev/null +++ b/modules/nf-core/fcsgx/rungx/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::ncbi-fcs-gx=0.5.4" diff --git a/modules/nf-core/fcsgx/rungx/main.nf b/modules/nf-core/fcsgx/rungx/main.nf new file mode 100644 index 00000000000..af6411aebcf --- /dev/null +++ b/modules/nf-core/fcsgx/rungx/main.nf @@ -0,0 +1,64 @@ +process FCSGX_RUNGX { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ncbi-fcs-gx:0.5.4--h4ac6f70_1': + 'biocontainers/ncbi-fcs-gx:0.5.4--h4ac6f70_1' }" + + input: + tuple val(meta), val(taxid), path(fasta) + path gxdb + val ramdisk_path + + output: + tuple val(meta), path("*.fcs_gx_report.txt"), emit: fcsgx_report + tuple val(meta), path("*.taxonomy.rpt") , emit: taxonomy_report + tuple val(meta), path("*.summary.txt") , emit: log + tuple val(meta), path("*.hits.tsv.gz") , emit: hits, optional: true + 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}" + def mv_database_to_ram = ramdisk_path ? "rclone copy $gxdb $ramdisk_path/$task.index/" : '' + def database = ramdisk_path ? "$ramdisk_path/$task.index/" : gxdb // Use task.index to make memory location unique + """ + # Copy DB to RAM-disk when supplied. Otherwise, the tool is very slow. + $mv_database_to_ram + + export GX_NUM_CORES=${task.cpus} + run_gx.py \\ + --fasta ${fasta} \\ + --gx-db ${database} \\ + --tax-id ${taxid} \\ + --generate-logfile true \\ + --out-basename ${prefix} \\ + --out-dir . \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcsgx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ + + stub: + // def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fcs_gx_report.txt + touch ${prefix}.taxonomy.rpt + touch ${prefix}.summary.txt + echo "" | gzip > ${prefix}.hits.tsv.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcsgx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fcsgx/rungx/meta.yml b/modules/nf-core/fcsgx/rungx/meta.yml new file mode 100644 index 00000000000..3d1c8ec6c11 --- /dev/null +++ b/modules/nf-core/fcsgx/rungx/meta.yml @@ -0,0 +1,93 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "fcsgx_rungx" +description: Runs FCS-GX (Foreign Contamination Screen - Genome eXtractor) to screen + and remove foreign contamination from genome assemblies +keywords: + - genome + - assembly + - contamination + - screening + - cleaning + - fcs-gx +tools: + - "fcsgx": + description: "The NCBI Foreign Contamination Screen. Genomic cross-species aligner, + for contamination detection." + homepage: "https://github.com/ncbi/fcs-gx" + documentation: "https://github.com/ncbi/fcs/wiki/" + tool_dev_url: "https://github.com/ncbi/fcs-gx" + doi: "10.1186/s13059-024-03198-7" + licence: ["NCBI-PD"] + identifier: "biotools:ncbi_fcs" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - taxid: + type: string + description: Taxonomy ID of the expected organism + - fasta: + type: file + description: Input genome assembly file in FASTA format + pattern: "*.{fa,fasta,fna}" + - - gxdb: + type: directory + description: Directory containing the FCS-GX database + - - ramdisk_path: + type: string + description: Path to RAM disk for improved performance (optional) + +output: + - fcsgx_report: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.fcs_gx_report.txt": + type: file + description: Final contamination report with contaminant cleaning actions. Interpreted by gx clean genome to separate cleaned sequences from contaminants. + - taxonomy_report: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.taxonomy.rpt": + type: file + description: Intermediate report with assigned taxonomies to individual sequences. + pattern: "*.taxonomy.rpt" + - log: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.summary.txt": + type: file + description: FCSGX log file + pattern: "*.summary.txt" + - hits: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.hits.tsv.gz": + type: file + description: Save intermediate alignments + pattern: "*.hits.tsv.gz" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@tillenglert" + - "@mahesh-panchal" +maintainers: + - "@tillenglert" + - "@mahesh-panchal" diff --git a/modules/nf-core/fcsgx/rungx/tests/main.nf.test b/modules/nf-core/fcsgx/rungx/tests/main.nf.test new file mode 100644 index 00000000000..e6a4dae58f3 --- /dev/null +++ b/modules/nf-core/fcsgx/rungx/tests/main.nf.test @@ -0,0 +1,85 @@ +nextflow_process { + + name "Test Process FCSGX_RUNGX" + script "../main.nf" + process "FCSGX_RUNGX" + + tag "modules" + tag "modules_nfcore" + tag "fcsgx" + tag "fcsgx/fetchdb" + tag "fcsgx/rungx" + + setup { + run("FCSGX_FETCHDB"){ + script "../../fetchdb/main.nf" + process { + """ + input[0] = file('https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/FCS/database/test-only/test-only.manifest', checkIfExists: true) + """ + } + } + } + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + '2697049', // taxid for SARS-CoV-2 + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[1] = FCSGX_FETCHDB.out.database + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.fcsgx_report[0][1]).readLines()[1], // Timestamp in header L:0 + file(process.out.taxonomy_report[0][1]).readLines()[1..2], // Timestamp in header L:0 + file(process.out.log[0][1]).readLines()[0..9], // Timestamps and binary paths present + file(process.out.log[0][1]).text.contains('fcs_gx_report.txt contamination summary:'), + file(process.out.log[0][1]).text.contains('fcs_gx_report.txt action summary:'), + process.out.hits, + process.out.versions + ).match() + } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + '2697049', // taxid for SARS-CoV-2 + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[1] = FCSGX_FETCHDB.out.database + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/fcsgx/rungx/tests/main.nf.test.snap b/modules/nf-core/fcsgx/rungx/tests/main.nf.test.snap new file mode 100644 index 00000000000..d51384a4788 --- /dev/null +++ b/modules/nf-core/fcsgx/rungx/tests/main.nf.test.snap @@ -0,0 +1,125 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fcs_gx_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.taxonomy.rpt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.summary.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hits.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "4": [ + "versions.yml:md5,9a9c07bf6f7a48b8dc475924076dad06" + ], + "fcsgx_report": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fcs_gx_report.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "hits": [ + [ + { + "id": "test", + "single_end": false + }, + "test.hits.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.summary.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "taxonomy_report": [ + [ + { + "id": "test", + "single_end": false + }, + "test.taxonomy.rpt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,9a9c07bf6f7a48b8dc475924076dad06" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-07T15:25:22.810638794" + }, + "sarscov2 - fasta": { + "content": [ + "#seq_id\tstart_pos\tend_pos\tseq_len\taction\tdiv\tagg_cont_cov\ttop_tax_name", + [ + "#seq-id\tseq-len\t(xp,lc,co,n,mt,pt,pm)-len\tcvg-by-all\tsep1\ttax-name-1\ttax-id-1\tdiv-1\tcvg-by-div-1\tcvg-by-tax-1\tscore-1\tsep2\ttax-id-2\tdiv-2\tcvg-by-div-2\tcvg-by-tax-2\tscore-2\tsep3\ttax-id-3\tdiv-3\tcvg-by-div-3\tcvg-by-tax-3\tscore-3\tsep4\ttax-id-4\tdiv-4\tcvg-by-div-4\tcvg-by-tax-4\tscore-4\tsep5\treserved\tresult\tdiv\tdiv_pct_cvg", + "MT192765.1\t29829\t0,0,0,0,0,0,0\t0\t|\t\t\t\t\t\t\t|\t\t\t\t\t\t|\t\t\t\t\t\t|\t\t\t\t\t\t|\tn/a\tlow-coverage\tnone\t0" + ], + [ + "", + "-----------------------------------------------------------------------------", + "", + "tax-id : 2697049", + "fasta : genome.fasta", + "size : 0.02 MiB", + "split-fa : True", + "BLAST-div : viruses", + "gx-div : virs:viruses", + "w/same-tax: True" + ], + true, + true, + [ + + ], + [ + "versions.yml:md5,9a9c07bf6f7a48b8dc475924076dad06" + ] + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-08T08:38:13.07344551" + } +} \ No newline at end of file From 5a03dfaaf946ddca2776734de385c0e92d88f41f Mon Sep 17 00:00:00 2001 From: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Date: Fri, 8 Nov 2024 19:34:33 +0100 Subject: [PATCH 67/87] Remove pytest remainings (#6962) remove old pytest files --- tests/modules/nf-core/checkm/qa/main.nf | 44 ------------------- .../modules/nf-core/checkm/qa/nextflow.config | 16 ------- tests/modules/nf-core/checkm/qa/test.yml | 16 ------- 3 files changed, 76 deletions(-) delete mode 100644 tests/modules/nf-core/checkm/qa/main.nf delete mode 100644 tests/modules/nf-core/checkm/qa/nextflow.config delete mode 100644 tests/modules/nf-core/checkm/qa/test.yml diff --git a/tests/modules/nf-core/checkm/qa/main.nf b/tests/modules/nf-core/checkm/qa/main.nf deleted file mode 100644 index 8f4c64e5630..00000000000 --- a/tests/modules/nf-core/checkm/qa/main.nf +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { CHECKM_LINEAGEWF } from '../../../../../modules/nf-core/checkm/lineagewf/main.nf' -include { CHECKM_LINEAGEWF as CHECKM_LINEAGEWF_FASTA } from '../../../../../modules/nf-core/checkm/lineagewf/main.nf' -include { CHECKM_QA } from '../../../../../modules/nf-core/checkm/qa/main.nf' -include { CHECKM_QA as CHECKM_QA_FASTA } from '../../../../../modules/nf-core/checkm/qa/main.nf' - -workflow test_checkm_qa { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true) ] - fasta_ext = 'fasta' - - CHECKM_LINEAGEWF ( input, fasta_ext, [] ) - - ch_checkmqa_input = CHECKM_LINEAGEWF.out.checkm_output - .join(CHECKM_LINEAGEWF.out.marker_file) - .map{ - meta, dir, marker -> - [ meta, dir, marker, []] - } - - CHECKM_QA ( ch_checkmqa_input, [] ) -} - -workflow test_checkm_qa_fasta { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true) ] - fasta_ext = 'fasta' - - CHECKM_LINEAGEWF_FASTA ( input, fasta_ext, [] ) - - ch_checkmqa_input = CHECKM_LINEAGEWF_FASTA.out.checkm_output - .join(CHECKM_LINEAGEWF_FASTA.out.marker_file) - .map{ - meta, dir, marker -> - [ meta, dir, marker, []] - } - - CHECKM_QA_FASTA ( ch_checkmqa_input, [] ) -} diff --git a/tests/modules/nf-core/checkm/qa/nextflow.config b/tests/modules/nf-core/checkm/qa/nextflow.config deleted file mode 100644 index 0f5e524b1d8..00000000000 --- a/tests/modules/nf-core/checkm/qa/nextflow.config +++ /dev/null @@ -1,16 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: CHECKM_QA { - ext.prefix = { "${meta.id}.qa" } - } - - - withName: CHECKM_QA_FASTA { - ext.args = "-o 9" - ext.prefix = { "${meta.id}.qa" } - } - - -} diff --git a/tests/modules/nf-core/checkm/qa/test.yml b/tests/modules/nf-core/checkm/qa/test.yml deleted file mode 100644 index bee7dedeb23..00000000000 --- a/tests/modules/nf-core/checkm/qa/test.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: checkm qa test_checkm_qa - command: nextflow run ./tests/modules/nf-core/checkm/qa -entry test_checkm_qa -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/checkm/qa/nextflow.config - tags: - - checkm/qa - - checkm - files: - - path: output/checkm/test.qa.txt - md5sum: 645f4282569afb4b171396732b2d2582 - -- name: checkm qa test_checkm_qa_fasta - command: nextflow run ./tests/modules/nf-core/checkm/qa -entry test_checkm_qa_fasta -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/checkm/qa/nextflow.config - tags: - - checkm/qa - - checkm - files: - - path: output/checkm/test.qa.fasta From 9c6d8022918de14061523c7af5289b2ad546ad7a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:46:16 +0100 Subject: [PATCH 68/87] chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.7.3 (#6961) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4586039b389..5d9bf144771 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: check-github-workflows # use ruff for python files - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.2 + rev: v0.7.3 hooks: - id: ruff files: \.py$ From 685fbead1e7082e7439bf7972d336ad1a90ce4e1 Mon Sep 17 00:00:00 2001 From: Leon Hafner <60394289+LeonHafner@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:26:39 +0100 Subject: [PATCH 69/87] New module: anndata/getsize module (#6925) * add anndata/getsize module * add license * change singularity container definition * use proper test data * shorten anndata import Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --------- Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- .../nf-core/anndata/getsize/environment.yml | 5 + modules/nf-core/anndata/getsize/main.nf | 36 +++++ modules/nf-core/anndata/getsize/meta.yml | 54 +++++++ .../anndata/getsize/templates/getsize.py | 60 ++++++++ .../anndata/getsize/tests/main.nf.test | 108 +++++++++++++ .../anndata/getsize/tests/main.nf.test.snap | 142 ++++++++++++++++++ 6 files changed, 405 insertions(+) create mode 100644 modules/nf-core/anndata/getsize/environment.yml create mode 100644 modules/nf-core/anndata/getsize/main.nf create mode 100644 modules/nf-core/anndata/getsize/meta.yml create mode 100644 modules/nf-core/anndata/getsize/templates/getsize.py create mode 100644 modules/nf-core/anndata/getsize/tests/main.nf.test create mode 100644 modules/nf-core/anndata/getsize/tests/main.nf.test.snap diff --git a/modules/nf-core/anndata/getsize/environment.yml b/modules/nf-core/anndata/getsize/environment.yml new file mode 100644 index 00000000000..b43edd6c7ae --- /dev/null +++ b/modules/nf-core/anndata/getsize/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - conda-forge::anndata=0.10.9 diff --git a/modules/nf-core/anndata/getsize/main.nf b/modules/nf-core/anndata/getsize/main.nf new file mode 100644 index 00000000000..b23124bea04 --- /dev/null +++ b/modules/nf-core/anndata/getsize/main.nf @@ -0,0 +1,36 @@ +process ANNDATA_GETSIZE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/04/04529821c1eff131c79f1f867fd9e8465a53ea5473bc6e4ac9405d2b9965d976/data': + 'community.wave.seqera.io/library/anndata:0.10.9--1eab54e300e1e584' }" + + input: + tuple val(meta), path(h5ad) + val size_type + + output: + tuple val(meta), path("*.txt"), emit: size + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + prefix = task.ext.prefix ?: "${meta.id}" + template 'getsize.py' + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.txt + + cat <<-END_VERSIONS > versions.yml + ${task.process}: + python: \$(python3 -c 'import platform; print(platform.python_version())') + anndata: \$(python3 -c 'import anndata; print(anndata.__version__)') + END_VERSIONS + """ +} diff --git a/modules/nf-core/anndata/getsize/meta.yml b/modules/nf-core/anndata/getsize/meta.yml new file mode 100644 index 00000000000..52b1127b5f2 --- /dev/null +++ b/modules/nf-core/anndata/getsize/meta.yml @@ -0,0 +1,54 @@ +name: "anndata_getsize" +description: Get the size (n_cells or n_genes) of an anndata object stored as a h5ad file +keywords: + - anndata + - single-cell + - scanpy +tools: + - "anndata": + description: "An annotated data matrix." + homepage: "http://anndata.rtfd.io" + documentation: "http://anndata.rtfd.io" + tool_dev_url: "https://github.com/theislab/anndata" + doi: "10.21105/joss.04371" + licence: ["BSD-3-clause"] + identifier: biotools:anndata + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - h5ad: + type: file + description: H5AD file of anndata object + pattern: "*.h5ad" + + - - size_type: + type: string + description: either 'cells', 'genes', 'obs', or 'var' + +output: + - size: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.txt": + type: file + description: text file containing the requested size + pattern: "*.txt" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@LeonHafner" +maintainers: + - "@LeonHafner" diff --git a/modules/nf-core/anndata/getsize/templates/getsize.py b/modules/nf-core/anndata/getsize/templates/getsize.py new file mode 100644 index 00000000000..3fca8cd6a9a --- /dev/null +++ b/modules/nf-core/anndata/getsize/templates/getsize.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 + +""" +Author: + Leon Hafner + +Copyright (c) 2024, Leon Hafner. All rights reserved. + +License: MIT License +""" + +import platform + +import anndata as ad + + +def format_yaml_like(data: dict, indent: int = 0) -> str: + """Formats a dictionary to a YAML-like string. + + Args: + data (dict): The dictionary to format. + indent (int): The current indentation level. + + Returns: + str: A string formatted as YAML. + """ + yaml_str = "" + for key, value in data.items(): + spaces = " " * indent + if isinstance(value, dict): + yaml_str += f"{spaces}{key}:\\n{format_yaml_like(value, indent + 1)}" + else: + yaml_str += f"{spaces}{key}: {value}\\n" + return yaml_str + + +adata = ad.read_h5ad("${h5ad}", backed="r") + +size_functions = { + "cells": lambda: adata.n_obs, + "genes": lambda: adata.n_vars, + "obs": lambda: adata.n_obs, + "var": lambda: adata.n_vars, +} + +size_type = "${size_type}".lower() +if size_type not in size_functions: + raise ValueError(f'Size type must be one of {', '.join(size_functions.keys())}.') + +size = size_functions[size_type]() + +with open("${prefix}.txt", "w") as f: + f.write(str(size)) + + +# Versions +versions = {"${task.process}": {"python": platform.python_version(), "anndata": ad.__version__}} + +with open("versions.yml", "w") as f: + f.write(format_yaml_like(versions)) diff --git a/modules/nf-core/anndata/getsize/tests/main.nf.test b/modules/nf-core/anndata/getsize/tests/main.nf.test new file mode 100644 index 00000000000..f331a4f8507 --- /dev/null +++ b/modules/nf-core/anndata/getsize/tests/main.nf.test @@ -0,0 +1,108 @@ +nextflow_process { + + name "Test Process ANNDATA_GETSIZE" + script "../main.nf" + process "ANNDATA_GETSIZE" + + tag "modules" + tag "modules_nfcore" + tag "anndata" + tag "anndata/getsize" + + test("scdownstream - h5ad - cells") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/scrnaseq/h5ad/pbmc1k.h5ad', checkIfExists: true), + ] + input[1] = 'cells' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("scdownstream - h5ad - genes") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/scrnaseq/h5ad/pbmc1k.h5ad', checkIfExists: true), + ] + input[1] = 'genes' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("scdownstream - h5ad - cells - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/scrnaseq/h5ad/pbmc1k.h5ad', checkIfExists: true), + ] + input[1] = 'cells' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("scdownstream - h5ad - genes - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/scrnaseq/h5ad/pbmc1k.h5ad', checkIfExists: true), + ] + input[1] = 'genes' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/anndata/getsize/tests/main.nf.test.snap b/modules/nf-core/anndata/getsize/tests/main.nf.test.snap new file mode 100644 index 00000000000..89682a69718 --- /dev/null +++ b/modules/nf-core/anndata/getsize/tests/main.nf.test.snap @@ -0,0 +1,142 @@ +{ + "scdownstream - h5ad - genes - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ], + "size": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-09T13:04:13.902701833" + }, + "scdownstream - h5ad - genes": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,a9b7ba70783b617e9998dc4dd82eb3c5" + ] + ], + "1": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ], + "size": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,a9b7ba70783b617e9998dc4dd82eb3c5" + ] + ], + "versions": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-09T13:03:53.529202389" + }, + "scdownstream - h5ad - cells - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ], + "size": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-09T13:04:03.83006762" + }, + "scdownstream - h5ad - cells": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,a9b7ba70783b617e9998dc4dd82eb3c5" + ] + ], + "1": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ], + "size": [ + [ + { + "id": "test", + "single_end": false + }, + "test.txt:md5,a9b7ba70783b617e9998dc4dd82eb3c5" + ] + ], + "versions": [ + "versions.yml:md5,6b2a8ca48de3490b049767f211f8daab" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-09T13:03:44.379543952" + } +} \ No newline at end of file From b4c2b037719d63aa5a1b82706b3d9ad12b98c15f Mon Sep 17 00:00:00 2001 From: Jim Downie <19718667+prototaxites@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:46:25 +0000 Subject: [PATCH 70/87] Add Coverm contigs module (#6959) * add coverm contig * update tests * Update main.nf.test * fix linting * Update main.nf --- modules/nf-core/coverm/contig/environment.yml | 7 ++ modules/nf-core/coverm/contig/main.nf | 55 +++++++++ modules/nf-core/coverm/contig/meta.yml | 76 +++++++++++++ .../nf-core/coverm/contig/tests/main.nf.test | 107 ++++++++++++++++++ .../coverm/contig/tests/main.nf.test.snap | 107 ++++++++++++++++++ 5 files changed, 352 insertions(+) create mode 100644 modules/nf-core/coverm/contig/environment.yml create mode 100644 modules/nf-core/coverm/contig/main.nf create mode 100644 modules/nf-core/coverm/contig/meta.yml create mode 100644 modules/nf-core/coverm/contig/tests/main.nf.test create mode 100644 modules/nf-core/coverm/contig/tests/main.nf.test.snap diff --git a/modules/nf-core/coverm/contig/environment.yml b/modules/nf-core/coverm/contig/environment.yml new file mode 100644 index 00000000000..eb4b2a44cf3 --- /dev/null +++ b/modules/nf-core/coverm/contig/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::coverm=0.7.0" diff --git a/modules/nf-core/coverm/contig/main.nf b/modules/nf-core/coverm/contig/main.nf new file mode 100644 index 00000000000..f34d55a018a --- /dev/null +++ b/modules/nf-core/coverm/contig/main.nf @@ -0,0 +1,55 @@ +process COVERM_CONTIG { + tag "${meta.id}" + label "process_medium" + + conda "bioconda::coverm=0.7.0-0" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/coverm:0.7.0--h07ea13f_0' : + 'biocontainers/coverm:0.7.0--h07ea13f_0' }" + + input: + tuple val(meta), path(input) + tuple val(meta2), path(reference) + val bam_input + val interleaved + + output: + tuple val(meta), path("*.depth.txt"), emit: coverage + 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}" + def fastq_input = meta.single_end ? "--single" : interleaved ? "--interleaved" : "--coupled" + def input_type = bam_input ? "--bam-files" : "${fastq_input}" + def reference_str = bam_input ? "" : "--reference ${reference}" + """ + TMPDIR=. + + coverm contig \\ + --threads ${task.cpus} \\ + ${input_type} ${input} \\ + ${reference_str} \\ + ${args} \\ + --output-file ${prefix}.depth.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + coverm: \$(coverm --version | sed 's/coverm //') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.depth.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + coverm: \$(coverm --version | sed 's/coverm //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/coverm/contig/meta.yml b/modules/nf-core/coverm/contig/meta.yml new file mode 100644 index 00000000000..f97b7117a04 --- /dev/null +++ b/modules/nf-core/coverm/contig/meta.yml @@ -0,0 +1,76 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "coverm_contig" +description: Map reads to contigs and estimate coverage +keywords: + - mapping + - genomics + - metagenomics + - coverage +tools: + - "coverm": + description: "CoverM aims to be a configurable, easy to use and fast DNA read + coverage and relative abundance calculator focused on metagenomics applications" + homepage: "https://github.com/wwood/CoverM" + documentation: "https://wwood.github.io/CoverM/coverm-contig.html" + tool_dev_url: "https://github.com/wwood/CoverM" + doi: "10.5281/zenodo.10531253" + licence: ["GPL v3"] + identifier: biotools:coverm + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - input: + type: file + description: | + FASTA/FASTQ containing reads (can be gzipped), or sorted BAM files of reads mapped to a reference. + If supplying PE fasta for multiple samples, should be in the order "sample1_1, sample1_2, sample2_1, sample2_2...". + pattern: "*.{fa,fq,fa.gz,fq.gz,bam}" + + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'sample1', single_end:false ]` + + - reference: + type: file + description: Reference FASTA file to map reads to, or minimap2/strobealign index. + Not required if using BAM input. + pattern: "*.{fasta,fasta.gz,mmi,sti}" + + - - bam_input: + type: boolean + description: True if input is bam files + + - - interleaved: + type: boolean + description: True if input is interleaved fastq file + +output: + - coverage: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + pattern: "*.depths.{txt}" + - "*.depth.txt": + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + pattern: "*.depths.{txt}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@prototaxites" +maintainers: + - "@prototaxites" diff --git a/modules/nf-core/coverm/contig/tests/main.nf.test b/modules/nf-core/coverm/contig/tests/main.nf.test new file mode 100644 index 00000000000..845068cd9d6 --- /dev/null +++ b/modules/nf-core/coverm/contig/tests/main.nf.test @@ -0,0 +1,107 @@ +nextflow_process { + + name "Test Process COVERM_CONTIG" + script "../main.nf" + process "COVERM_CONTIG" + + tag "modules" + tag "modules_nfcore" + tag "coverm" + tag "coverm/contig" + + test("coverm_contig - fastq") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_2.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test2_2.fastq.gz', checkIfExists: true), + ] + ] + input[1] = [ + [ id:'test_ref' ], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz') + ] + input[2] = false + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("coverm_contig - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test1.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/bam/test2.sorted.bam', checkIfExists: true) + ] + input[1] = [ + [], + [] + ] + input[2] = true + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("coverm_contig - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/illumina/fastq/test1_2.fastq.gz', checkIfExists: true), + ] + ] + input[1] = [ + [ id:'test_ref' ], + file(params.modules_testdata_base_path + 'genomics/prokaryotes/bacteroides_fragilis/genome/genome.fna.gz') + ] + input[2] = false + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/coverm/contig/tests/main.nf.test.snap b/modules/nf-core/coverm/contig/tests/main.nf.test.snap new file mode 100644 index 00000000000..734a9d2680c --- /dev/null +++ b/modules/nf-core/coverm/contig/tests/main.nf.test.snap @@ -0,0 +1,107 @@ +{ + "coverm_contig - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ], + "coverage": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-08T10:22:23.71903442" + }, + "coverm_contig - fastq": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,cc6eff84ef45ac8607286805fede0f2d" + ] + ], + "1": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ], + "coverage": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,cc6eff84ef45ac8607286805fede0f2d" + ] + ], + "versions": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-08T10:21:59.723160615" + }, + "coverm_contig - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,e62a5d74dbb62d1ef9f52c12d9a8dcb2" + ] + ], + "1": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ], + "coverage": [ + [ + { + "id": "test", + "single_end": false + }, + "test.depth.txt:md5,e62a5d74dbb62d1ef9f52c12d9a8dcb2" + ] + ], + "versions": [ + "versions.yml:md5,c430e2f31175deec3a7e349f635e881b" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-08T10:22:12.710853713" + } +} From 89e06f63c5ee7abe5d6910277aff8e83b00a8b50 Mon Sep 17 00:00:00 2001 From: vaxyzek Date: Mon, 11 Nov 2024 12:43:43 -0500 Subject: [PATCH 71/87] Add deepsomatic module scaffolding (#6622) * Add deepsomatic module scaffolding * Add test against sample nf-core test-datasets data Bump deepsomatic version to 1.7.0 * Add test against nf-core test-datasets * * minor updates on test parameters and snapshot * linting * [automated] Fix linting with Prettier * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Maxime U Garcia * Exclude the conda and singularity tests for deepsomatic * Apply suggestions from code review * Update modules/nf-core/deepsomatic/tests/main.nf.test.snap * Apply suggestions from code review * Update .github/workflows/test.yml --------- Co-authored-by: Vasiliy Strelnikov Co-authored-by: Maxime U Garcia Co-authored-by: nf-core-bot Co-authored-by: Maxime U Garcia --- .github/workflows/test.yml | 4 + modules/nf-core/deepsomatic/main.nf | 71 ++++++++++ modules/nf-core/deepsomatic/meta.yml | 128 ++++++++++++++++++ .../nf-core/deepsomatic/tests/main.nf.test | 59 ++++++++ .../deepsomatic/tests/main.nf.test.snap | 20 +++ .../nf-core/deepsomatic/tests/nextflow.config | 6 + modules/nf-core/deepsomatic/tests/tags.yml | 2 + 7 files changed, 290 insertions(+) create mode 100644 modules/nf-core/deepsomatic/main.nf create mode 100644 modules/nf-core/deepsomatic/meta.yml create mode 100644 modules/nf-core/deepsomatic/tests/main.nf.test create mode 100644 modules/nf-core/deepsomatic/tests/main.nf.test.snap create mode 100644 modules/nf-core/deepsomatic/tests/nextflow.config create mode 100644 modules/nf-core/deepsomatic/tests/tags.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b06ee12d4ab..7a4c49df720 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -538,6 +538,10 @@ jobs: path: modules/nf-core/custom/dumpsoftwareversions - profile: conda path: modules/nf-core/deepcell/mesmer + - profile: conda + path: modules/nf-core/deepsomatic + - profile: singularity + path: modules/nf-core/deepsomatic - profile: conda path: modules/nf-core/deepvariant - profile: conda diff --git a/modules/nf-core/deepsomatic/main.nf b/modules/nf-core/deepsomatic/main.nf new file mode 100644 index 00000000000..fb5b8bc4eb4 --- /dev/null +++ b/modules/nf-core/deepsomatic/main.nf @@ -0,0 +1,71 @@ +process DEEPSOMATIC { + tag "$meta.id" + label 'process_high' + + container "docker.io/google/deepsomatic:1.7.0" + input: + tuple val(meta), path(input_normal), path(index_normal), path(input_tumor), path(index_tumor) + tuple val(meta2), path(intervals) + tuple val(meta3), path(fasta) + tuple val(meta4), path(fai) + tuple val(meta5), path(gzi) + + output: + tuple val(meta), path("${prefix}.vcf.gz") , emit: vcf + tuple val(meta), path("${prefix}.vcf.gz.tbi") , emit: vcf_tbi + tuple val(meta), path("${prefix}.g.vcf.gz") , emit: gvcf + tuple val(meta), path("${prefix}.g.vcf.gz.tbi"), emit: gvcf_tbi + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def regions = intervals ? "--regions=${intervals}" : "" + def VERSION = '1.7.0' + + """ + run_deepsomatic \\ + --ref=${fasta} \\ + --reads_normal=${input_normal} \\ + --reads_tumor=${input_tumor} \\ + --output_vcf=${prefix}.vcf.gz \\ + --output_gvcf=${prefix}.g.vcf.gz \\ + --sample_name_tumor="tumor" \\ + --sample_name_normal="normal" \\ + ${args} \\ + ${regions} \\ + --intermediate_results_dir=tmp \\ + --num_shards=${task.cpus} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deepsomatic: $VERSION + END_VERSIONS + """ + + stub: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "DEEPSOMATIC module does not support Conda. Please use Docker / Singularity / Podman instead." + } + prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = '1.7.0' + """ + touch ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + touch ${prefix}.g.vcf.gz + touch ${prefix}.g.vcf.gz.tbi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deepsomatic: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/deepsomatic/meta.yml b/modules/nf-core/deepsomatic/meta.yml new file mode 100644 index 00000000000..434c0f5cc97 --- /dev/null +++ b/modules/nf-core/deepsomatic/meta.yml @@ -0,0 +1,128 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "deepsomatic" +description: DeepSomatic is an extension of deep learning-based variant caller DeepVariant + that takes aligned reads (in BAM or CRAM format) from tumor and normal data, produces pileup + image tensors from them, classifies each tensor using a convolutional neural network, and + finally reports somatic variants in a standard VCF or gVCF file. +keywords: + - variant calling + - machine learning + - neural network +tools: + - "deepsomatic": + description: "" + homepage: "https://github.com/google/deepsomatic" + documentation: "https://github.com/google/deepsomatic" + tool_dev_url: "https://github.com/google/deepsomatic" + doi: "10.1101/2024.08.16.608331" + licence: ["BSD-3-clause"] + identifier: "biotools:deepsomatic" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - input_normal: + type: file + description: BAM/CRAM file + pattern: "*.bam/cram" + - index_normal: + type: file + description: Index of BAM/CRAM file + pattern: "*.bai/crai" + - input_tumor: + type: file + description: BAM/CRAM file + pattern: "*.bam/cram" + - index_tumor: + type: file + description: Index of BAM/CRAM file + pattern: "*.bai/crai" + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - intervals: + type: file + description: file containing intervals + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: The reference fasta file + pattern: "*.fasta" + - - meta4: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fai: + type: file + description: Index of reference fasta file + pattern: "*.fai" + - - meta5: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - gzi: + type: file + description: GZI index of reference fasta file + pattern: "*.gzi" + +output: + - vcf: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "${prefix}.vcf.gz": + type: file + description: Compressed VCF file + pattern: "*.vcf.gz" + - vcf_tbi: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "${prefix}.vcf.gz.tbi": + type: file + description: Index of compressed VCF file + pattern: "*.vcf.gz.tbi" + - gvcf: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "${prefix}.g.vcf.gz": + type: file + description: Compressed GVCF file + pattern: "*.g.vcf.gz" + - gvcf_tbi: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "${prefix}.g.vcf.gz.tbi": + type: file + description: Index of compressed Genotyped VCF file + pattern: "*.g.vcf.gz.tbi" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@vaxyzek" +maintainers: + - "@vaxyzek" diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test b/modules/nf-core/deepsomatic/tests/main.nf.test new file mode 100644 index 00000000000..eaa5f8fe6db --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/main.nf.test @@ -0,0 +1,59 @@ +nextflow_process { + + name "Test Process DEEPSOMATIC" + script "../main.nf" + process "DEEPSOMATIC" + + tag "modules" + tag "modules_nfcore" + tag "deepsomatic" + + test("tumor_normal_pair") { + config './nextflow.config' + + when { + process { + """ + input[0] = [ + [ id:'tumor_vs_normal' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.recalibrated.sorted.bam.bai', checkIfExists: true) + ] + input[1] = [ + [ id:'intervals' ], + [] + ] + input[2] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta', checkIfExists: true) + ] + input[3] = [ + [ id:'genome' ], + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/chr21/sequence/genome.fasta.fai', checkIfExists: true) + ] + input[4] = [ + [ id: 'gzi' ], + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { + assert snapshot( + process.out.vcf.collect { file(it[1]).getName() }, + process.out.tbi.collect { file(it[1]).getName() }, + process.out.versions, + ).match() + } + ) + } + + } + +} diff --git a/modules/nf-core/deepsomatic/tests/main.nf.test.snap b/modules/nf-core/deepsomatic/tests/main.nf.test.snap new file mode 100644 index 00000000000..1a7886ec970 --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/main.nf.test.snap @@ -0,0 +1,20 @@ +{ + "tumor_normal_pair": { + "content": [ + [ + "tumor_vs_normal_out.vcf.gz" + ], + [ + + ], + [ + "versions.yml:md5,d64cbd049771dd1a8d0885499ea16f11" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-10-22T21:52:00.932502018" + } +} \ No newline at end of file diff --git a/modules/nf-core/deepsomatic/tests/nextflow.config b/modules/nf-core/deepsomatic/tests/nextflow.config new file mode 100644 index 00000000000..fff76401ab7 --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withName: DEEPSOMATIC { + ext.args = "--regions='chr21:6110000-6120000'" + ext.prefix = { "${meta.id}_out" } + } +} diff --git a/modules/nf-core/deepsomatic/tests/tags.yml b/modules/nf-core/deepsomatic/tests/tags.yml new file mode 100644 index 00000000000..a8bf10c9f3f --- /dev/null +++ b/modules/nf-core/deepsomatic/tests/tags.yml @@ -0,0 +1,2 @@ +deepsomatic: + - "modules/nf-core/deepsomatic/**" From a15872dde4c4affaac2dfee6c3c65fadab4719bd Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:25:16 +0530 Subject: [PATCH 72/87] migrate to nf-test (#6970) * migrate to nf-test * Update modules/nf-core/mummer/tests/main.nf.test --- modules/nf-core/mummer/main.nf | 2 +- modules/nf-core/mummer/tests/main.nf.test | 58 ++++++++++++++++ .../nf-core/mummer/tests/main.nf.test.snap | 68 +++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/mummer/main.nf | 14 ---- tests/modules/nf-core/mummer/nextflow.config | 5 -- tests/modules/nf-core/mummer/test.yml | 7 -- 7 files changed, 127 insertions(+), 30 deletions(-) create mode 100644 modules/nf-core/mummer/tests/main.nf.test create mode 100644 modules/nf-core/mummer/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/mummer/main.nf delete mode 100644 tests/modules/nf-core/mummer/nextflow.config delete mode 100644 tests/modules/nf-core/mummer/test.yml diff --git a/modules/nf-core/mummer/main.nf b/modules/nf-core/mummer/main.nf index e1a3f992fc0..17b05dd5d96 100644 --- a/modules/nf-core/mummer/main.nf +++ b/modules/nf-core/mummer/main.nf @@ -50,7 +50,7 @@ process MUMMER { def prefix = task.ext.prefix ?: "${meta.id}" def VERSION = '3.23' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. """ - touch ${prefx}.coords + touch ${prefix}.coords cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/mummer/tests/main.nf.test b/modules/nf-core/mummer/tests/main.nf.test new file mode 100644 index 00000000000..b079d2098a5 --- /dev/null +++ b/modules/nf-core/mummer/tests/main.nf.test @@ -0,0 +1,58 @@ +nextflow_process { + + name "Test Process MUMMER" + script "../main.nf" + process "MUMMER" + + tag "modules" + tag "modules_nfcore" + tag "mummer" + + test("sarscov2 - bam") { + + when { + process { + """ + + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/transcriptome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/transcriptome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/mummer/tests/main.nf.test.snap b/modules/nf-core/mummer/tests/main.nf.test.snap new file mode 100644 index 00000000000..fea2282af32 --- /dev/null +++ b/modules/nf-core/mummer/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.coords:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,c36e386e2de805cf815ba20359fca81c" + ], + "coords": [ + [ + { + "id": "test" + }, + "test.coords:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,c36e386e2de805cf815ba20359fca81c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T06:08:50.368788562" + }, + "sarscov2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.coords:md5,6084fe43c7cb2eca8b96d674560bdefc" + ] + ], + "1": [ + "versions.yml:md5,c36e386e2de805cf815ba20359fca81c" + ], + "coords": [ + [ + { + "id": "test" + }, + "test.coords:md5,6084fe43c7cb2eca8b96d674560bdefc" + ] + ], + "versions": [ + "versions.yml:md5,c36e386e2de805cf815ba20359fca81c" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T06:08:40.932078101" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 9a569832bdb..63f4bec7421 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -443,9 +443,6 @@ msisensor2/msi: msisensorpro/msisomatic: - modules/nf-core/msisensorpro/msisomatic/** - tests/modules/nf-core/msisensorpro/msisomatic/** -mummer: - - modules/nf-core/mummer/** - - tests/modules/nf-core/mummer/** muscle: - modules/nf-core/muscle/** - tests/modules/nf-core/muscle/** diff --git a/tests/modules/nf-core/mummer/main.nf b/tests/modules/nf-core/mummer/main.nf deleted file mode 100644 index 68cfcfceb9d..00000000000 --- a/tests/modules/nf-core/mummer/main.nf +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { MUMMER } from '../../../../modules/nf-core/mummer/main.nf' - -workflow test_mummer { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), - file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] - - MUMMER ( input ) -} diff --git a/tests/modules/nf-core/mummer/nextflow.config b/tests/modules/nf-core/mummer/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/mummer/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/mummer/test.yml b/tests/modules/nf-core/mummer/test.yml deleted file mode 100644 index a110f8cb32d..00000000000 --- a/tests/modules/nf-core/mummer/test.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: mummer test_mummer - command: nextflow run ./tests/modules/nf-core/mummer -entry test_mummer -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/mummer/nextflow.config - tags: - - mummer - files: - - path: output/mummer/test.coords - md5sum: 6084fe43c7cb2eca8b96d674560bdefc From 52e382788f0a5eedf8acee8329c775358db09720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=BCbra=20Narc=C4=B1?= Date: Tue, 12 Nov 2024 10:31:19 +0100 Subject: [PATCH 73/87] happy/sompy change -f to -R (#6965) -f to -R --- modules/nf-core/happy/sompy/main.nf | 2 +- .../nf-core/happy/sompy/tests/main.nf.test.snap | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/nf-core/happy/sompy/main.nf b/modules/nf-core/happy/sompy/main.nf index a81639a2ca0..ba23fd16765 100644 --- a/modules/nf-core/happy/sompy/main.nf +++ b/modules/nf-core/happy/sompy/main.nf @@ -28,7 +28,7 @@ process HAPPY_SOMPY { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def regions = regions_bed ? "-f ${regions_bed}" : "" + def regions = regions_bed ? "-R ${regions_bed}" : "" def targets = targets_bed ? "-T ${targets_bed}" : "" def false_positives = false_positives_bed ? "--false-positives ${false_positives_bed}" : "" def ambiguous = ambiguous_beds ? "--ambiguous ${ambiguous_beds}" : "" diff --git a/modules/nf-core/happy/sompy/tests/main.nf.test.snap b/modules/nf-core/happy/sompy/tests/main.nf.test.snap index e483f1cfe7f..8fd374a9113 100644 --- a/modules/nf-core/happy/sompy/tests/main.nf.test.snap +++ b/modules/nf-core/happy/sompy/tests/main.nf.test.snap @@ -6,7 +6,7 @@ { "id": "test" }, - "test.stats.csv:md5,0fa86a9726fcc3e2172342dd1305cf82" + "test.stats.csv:md5,8b35dd00bf7b5bd697a05d73fb8c0816" ] ], [ @@ -16,10 +16,10 @@ "test.features.csv" ], "meta": { - "nf-test": "0.9.1", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-28T10:43:13.082233148" + "timestamp": "2024-11-11T16:03:54.153552746" }, "homo_sapiens - vcf - bam": { "content": [ @@ -28,7 +28,7 @@ { "id": "test" }, - "test.stats.csv:md5,2502fe315dcf32d00c9961b9462759aa" + "test.stats.csv:md5,5e9aae3e92641f1934c10fe88f250e59" ] ], [ @@ -38,10 +38,10 @@ "test.features.csv" ], "meta": { - "nf-test": "0.9.1", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-10-28T10:43:32.122793995" + "timestamp": "2024-11-11T16:04:07.938866093" }, "homo_sapiens - vcf - stub": { "content": [ From 1e66ca43956d3624e12ee9164c3f81c6cfff9656 Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:40:52 +0530 Subject: [PATCH 74/87] stub + nf-test (#6971) * stub + nf-test * add versions to snap --- modules/nf-core/nucmer/main.nf | 12 ++ modules/nf-core/nucmer/tests/main.nf.test | 61 ++++++++++ .../nf-core/nucmer/tests/main.nf.test.snap | 115 ++++++++++++++++++ tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/nucmer/main.nf | 14 --- tests/modules/nf-core/nucmer/nextflow.config | 5 - tests/modules/nf-core/nucmer/test.yml | 9 -- 7 files changed, 188 insertions(+), 31 deletions(-) create mode 100644 modules/nf-core/nucmer/tests/main.nf.test create mode 100644 modules/nf-core/nucmer/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/nucmer/main.nf delete mode 100644 tests/modules/nf-core/nucmer/nextflow.config delete mode 100644 tests/modules/nf-core/nucmer/test.yml diff --git a/modules/nf-core/nucmer/main.nf b/modules/nf-core/nucmer/main.nf index 7572e78b91d..0fd77c9cf4d 100644 --- a/modules/nf-core/nucmer/main.nf +++ b/modules/nf-core/nucmer/main.nf @@ -45,4 +45,16 @@ process NUCMER { nucmer: \$( nucmer --version 2>&1 | grep "version" | sed -e "s/NUCmer (NUCleotide MUMmer) version //g; s/nucmer//g;" ) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.delta + touch ${prefix}.coords + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nucmer: \$( nucmer --version 2>&1 | grep "version" | sed -e "s/NUCmer (NUCleotide MUMmer) version //g; s/nucmer//g;" ) + END_VERSIONS + """ } diff --git a/modules/nf-core/nucmer/tests/main.nf.test b/modules/nf-core/nucmer/tests/main.nf.test new file mode 100644 index 00000000000..6f2b59afe13 --- /dev/null +++ b/modules/nf-core/nucmer/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process NUCMER" + script "../main.nf" + process "NUCMER" + + tag "modules" + tag "modules_nfcore" + tag "nucmer" + + test("sarscov2 - bam") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/transcriptome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.delta[0][1]).readLines()[2..-1], + file(process.out.coords[0][1]).readLines()[2..-1], + process.out.versions) + .match() } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/transcriptome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/nucmer/tests/main.nf.test.snap b/modules/nf-core/nucmer/tests/main.nf.test.snap new file mode 100644 index 00000000000..26ba299f8cc --- /dev/null +++ b/modules/nf-core/nucmer/tests/main.nf.test.snap @@ -0,0 +1,115 @@ +{ + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.delta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.coords:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,a1cf532789a7b367346c4e9384ffcc88" + ], + "coords": [ + [ + { + "id": "test" + }, + "test.coords:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "delta": [ + [ + { + "id": "test" + }, + "test.delta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,a1cf532789a7b367346c4e9384ffcc88" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T07:00:08.433663621" + }, + "sarscov2 - bam": { + "content": [ + [ + ">MT192765.1 lcl|MT192765.1_cds_QIK50426.1_1 29829 21291", + "259 21548 1 21291 1 1 0", + "-13203", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50427.1_2 29829 3822", + "21556 25377 1 3822 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50428.1_3 29829 828", + "25386 26213 1 828 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50429.1_4 29829 228", + "26238 26465 1 228 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50430.1_5 29829 669", + "26516 27184 1 669 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50431.1_6 29829 186", + "27195 27380 1 186 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50432.1_7 29829 366", + "27387 27752 1 366 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50433.1_8 29829 132", + "27749 27880 1 132 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50434.1_9 29829 366", + "27887 28252 1 366 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50435.1_10 29829 1260", + "28267 29526 1 1260 0 0 0", + "0", + ">MT192765.1 lcl|MT192765.1_cds_QIK50436.1_11 29829 117", + "29551 29667 1 117 0 0 0", + "0" + ], + [ + "", + " [S1] [E1] | [S2] [E2] | [LEN 1] [LEN 2] | [% IDY] | [TAGS]", + "=====================================================================================", + " 259 21548 | 1 21291 | 21290 21291 | 99.99 | MT192765.1\tlcl|MT192765.1_cds_QIK50426.1_1", + " 21556 25377 | 1 3822 | 3822 3822 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50427.1_2", + " 25386 26213 | 1 828 | 828 828 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50428.1_3", + " 26238 26465 | 1 228 | 228 228 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50429.1_4", + " 26516 27184 | 1 669 | 669 669 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50430.1_5", + " 27195 27380 | 1 186 | 186 186 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50431.1_6", + " 27387 27752 | 1 366 | 366 366 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50432.1_7", + " 27749 27880 | 1 132 | 132 132 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50433.1_8", + " 27887 28252 | 1 366 | 366 366 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50434.1_9", + " 28267 29526 | 1 1260 | 1260 1260 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50435.1_10", + " 29551 29667 | 1 117 | 117 117 | 100.00 | MT192765.1\tlcl|MT192765.1_cds_QIK50436.1_11" + ], + [ + "versions.yml:md5,a1cf532789a7b367346c4e9384ffcc88" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T06:59:56.241209512" + } +} \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 63f4bec7421..55984e2de9e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -452,9 +452,6 @@ nanomonsv/parse: ncbitools/vecscreen: - modules/nf-core/ncbitools/vecscreen/** - tests/modules/nf-core/ncbitools/vecscreen/** -nucmer: - - modules/nf-core/nucmer/** - - tests/modules/nf-core/nucmer/** oncocnv: - modules/nf-core/oncocnv/** - tests/modules/nf-core/oncocnv/** diff --git a/tests/modules/nf-core/nucmer/main.nf b/tests/modules/nf-core/nucmer/main.nf deleted file mode 100644 index 0799c7ff375..00000000000 --- a/tests/modules/nf-core/nucmer/main.nf +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { NUCMER } from '../../../../modules/nf-core/nucmer/main.nf' - -workflow test_nucmer { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), - file(params.test_data['sarscov2']['genome']['transcriptome_fasta'], checkIfExists: true) ] - - NUCMER ( input ) -} diff --git a/tests/modules/nf-core/nucmer/nextflow.config b/tests/modules/nf-core/nucmer/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/nucmer/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/nucmer/test.yml b/tests/modules/nf-core/nucmer/test.yml deleted file mode 100644 index 9899eea4acb..00000000000 --- a/tests/modules/nf-core/nucmer/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: nucmer test_nucmer - command: nextflow run ./tests/modules/nf-core/nucmer -entry test_nucmer -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/nucmer/nextflow.config - tags: - - nucmer - files: - - path: output/nucmer/test.coords - contains: ["MT192765.1"] - - path: output/nucmer/test.delta - contains: ["MT192765.1"] From 8da5d813184fad188e197883ef883d8b708ee9cf Mon Sep 17 00:00:00 2001 From: Zach Norgaard Date: Wed, 13 Nov 2024 00:06:55 -0800 Subject: [PATCH 75/87] chore: bump fgbio version (#6978) --- .../callduplexconsensusreads/environment.yml | 2 +- .../fgbio/callduplexconsensusreads/main.nf | 4 +- .../tests/main.nf.test.snap | 20 +++---- .../environment.yml | 2 +- .../fgbio/callmolecularconsensusreads/main.nf | 4 +- .../tests/main.nf.test.snap | 20 +++---- .../collectduplexseqmetrics/environment.yml | 4 +- .../fgbio/collectduplexseqmetrics/main.nf | 4 +- .../tests/main.nf.test.snap | 16 +++--- .../nf-core/fgbio/fastqtobam/environment.yml | 2 +- modules/nf-core/fgbio/fastqtobam/main.nf | 4 +- .../fgbio/fastqtobam/tests/main.nf.test.snap | 56 +++++++++---------- .../filterconsensusreads/environment.yml | 2 +- .../fgbio/filterconsensusreads/main.nf | 4 +- .../tests/main.nf.test.snap | 20 +++---- .../fgbio/groupreadsbyumi/environment.yml | 2 +- modules/nf-core/fgbio/groupreadsbyumi/main.nf | 4 +- .../groupreadsbyumi/tests/main.nf.test.snap | 20 +++---- modules/nf-core/fgbio/sortbam/environment.yml | 2 +- modules/nf-core/fgbio/sortbam/main.nf | 4 +- .../fgbio/sortbam/tests/main.nf.test.snap | 20 +++---- .../nf-core/fgbio/zipperbams/environment.yml | 2 +- modules/nf-core/fgbio/zipperbams/main.nf | 4 +- .../fgbio/zipperbams/tests/main.nf.test.snap | 24 ++++---- 24 files changed, 123 insertions(+), 123 deletions(-) diff --git a/modules/nf-core/fgbio/callduplexconsensusreads/environment.yml b/modules/nf-core/fgbio/callduplexconsensusreads/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/callduplexconsensusreads/environment.yml +++ b/modules/nf-core/fgbio/callduplexconsensusreads/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/callduplexconsensusreads/main.nf b/modules/nf-core/fgbio/callduplexconsensusreads/main.nf index 30b1f1eb908..0913700431b 100644 --- a/modules/nf-core/fgbio/callduplexconsensusreads/main.nf +++ b/modules/nf-core/fgbio/callduplexconsensusreads/main.nf @@ -4,8 +4,8 @@ process FGBIO_CALLDUPLEXCONSENSUSREADS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(grouped_bam) diff --git a/modules/nf-core/fgbio/callduplexconsensusreads/tests/main.nf.test.snap b/modules/nf-core/fgbio/callduplexconsensusreads/tests/main.nf.test.snap index 6966ffabb13..97736281a76 100644 --- a/modules/nf-core/fgbio/callduplexconsensusreads/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/callduplexconsensusreads/tests/main.nf.test.snap @@ -12,7 +12,7 @@ ] ], "1": [ - "versions.yml:md5,7277dba1bc055b578eb6d8d6af43b128" + "versions.yml:md5,b2c92e1b52c4e42b0b1e74ec828feb04" ], "bam": [ [ @@ -24,15 +24,15 @@ ] ], "versions": [ - "versions.yml:md5,7277dba1bc055b578eb6d8d6af43b128" + "versions.yml:md5,b2c92e1b52c4e42b0b1e74ec828feb04" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-07-02T17:44:41.656625835" + "timestamp": "2024-11-11T12:21:15.700422" }, "homo_sapiens - bam": { "content": [ @@ -47,7 +47,7 @@ ] ], "1": [ - "versions.yml:md5,7277dba1bc055b578eb6d8d6af43b128" + "versions.yml:md5,b2c92e1b52c4e42b0b1e74ec828feb04" ], "bam": [ [ @@ -59,14 +59,14 @@ ] ], "versions": [ - "versions.yml:md5,7277dba1bc055b578eb6d8d6af43b128" + "versions.yml:md5,b2c92e1b52c4e42b0b1e74ec828feb04" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-17T06:05:28.894178772" + "timestamp": "2024-11-11T12:21:02.896452" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/callmolecularconsensusreads/environment.yml b/modules/nf-core/fgbio/callmolecularconsensusreads/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/callmolecularconsensusreads/environment.yml +++ b/modules/nf-core/fgbio/callmolecularconsensusreads/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/callmolecularconsensusreads/main.nf b/modules/nf-core/fgbio/callmolecularconsensusreads/main.nf index 8a2cdb247e2..7d2e660d02f 100644 --- a/modules/nf-core/fgbio/callmolecularconsensusreads/main.nf +++ b/modules/nf-core/fgbio/callmolecularconsensusreads/main.nf @@ -4,8 +4,8 @@ process FGBIO_CALLMOLECULARCONSENSUSREADS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(grouped_bam) diff --git a/modules/nf-core/fgbio/callmolecularconsensusreads/tests/main.nf.test.snap b/modules/nf-core/fgbio/callmolecularconsensusreads/tests/main.nf.test.snap index 088f99238ca..e7e4507f2d8 100644 --- a/modules/nf-core/fgbio/callmolecularconsensusreads/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/callmolecularconsensusreads/tests/main.nf.test.snap @@ -11,7 +11,7 @@ ] ], "1": [ - "versions.yml:md5,8a39cbc62685ce7afb5ae36609898bde" + "versions.yml:md5,b5ef59a06877dec12426c4c2c02e887c" ], "bam": [ [ @@ -22,15 +22,15 @@ ] ], "versions": [ - "versions.yml:md5,8a39cbc62685ce7afb5ae36609898bde" + "versions.yml:md5,b5ef59a06877dec12426c4c2c02e887c" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-17T06:01:29.676084265" + "timestamp": "2024-11-11T12:22:07.722755" }, "homo_sapiens - bam": { "content": [ @@ -44,7 +44,7 @@ ] ], "1": [ - "versions.yml:md5,8a39cbc62685ce7afb5ae36609898bde" + "versions.yml:md5,b5ef59a06877dec12426c4c2c02e887c" ], "bam": [ [ @@ -55,14 +55,14 @@ ] ], "versions": [ - "versions.yml:md5,8a39cbc62685ce7afb5ae36609898bde" + "versions.yml:md5,b5ef59a06877dec12426c4c2c02e887c" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:34:16.47828891" + "timestamp": "2024-11-11T12:21:46.241305" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/collectduplexseqmetrics/environment.yml b/modules/nf-core/fgbio/collectduplexseqmetrics/environment.yml index 48539f033bc..aa73390d8fa 100644 --- a/modules/nf-core/fgbio/collectduplexseqmetrics/environment.yml +++ b/modules/nf-core/fgbio/collectduplexseqmetrics/environment.yml @@ -4,5 +4,5 @@ channels: - conda-forge - bioconda dependencies: - - "bioconda::fgbio=2.0.2" - - "conda-forge::r-ggplot2=3.4.4" + - "bioconda::fgbio=2.4.0" + - "conda-forge::r-ggplot2=3.5.1" diff --git a/modules/nf-core/fgbio/collectduplexseqmetrics/main.nf b/modules/nf-core/fgbio/collectduplexseqmetrics/main.nf index d1d6bfc6a14..d86e401acc9 100644 --- a/modules/nf-core/fgbio/collectduplexseqmetrics/main.nf +++ b/modules/nf-core/fgbio/collectduplexseqmetrics/main.nf @@ -4,8 +4,8 @@ process FGBIO_COLLECTDUPLEXSEQMETRICS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-51891ad0b60843e4aade9cde2eb5d40c5ae92b80:72c944cdea5caff7f03b96034968ce2a4f1737bc-0': - 'biocontainers/mulled-v2-51891ad0b60843e4aade9cde2eb5d40c5ae92b80:72c944cdea5caff7f03b96034968ce2a4f1737bc-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/d6/d65e7c77d89e7e443384d17a94ffe31fe988b05bc7d695f2a75beaf502721925/data': + 'community.wave.seqera.io/library/fgbio_r-ggplot2:cf2b9a5308d77b67' }" input: tuple val(meta), path(grouped_bam) diff --git a/modules/nf-core/fgbio/collectduplexseqmetrics/tests/main.nf.test.snap b/modules/nf-core/fgbio/collectduplexseqmetrics/tests/main.nf.test.snap index 7dfa35f5801..588f8f079c3 100644 --- a/modules/nf-core/fgbio/collectduplexseqmetrics/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/collectduplexseqmetrics/tests/main.nf.test.snap @@ -41,15 +41,15 @@ ], [ - "versions.yml:md5,637a7384cd910f0e0541a631c52b95e1" + "versions.yml:md5,d19c5782883e16da8a29a27d7074c080" ], "test.duplex_qc.pdf" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-07-17T19:26:23.325859809" + "timestamp": "2024-11-11T12:22:45.594572" }, "homo_sapiens - bam": { "content": [ @@ -93,14 +93,14 @@ ], [ - "versions.yml:md5,637a7384cd910f0e0541a631c52b95e1" + "versions.yml:md5,d19c5782883e16da8a29a27d7074c080" ], "test.duplex_qc.pdf" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.3" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-07-17T19:26:03.1373243" + "timestamp": "2024-11-11T12:22:30.764995" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/fastqtobam/environment.yml b/modules/nf-core/fgbio/fastqtobam/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/fastqtobam/environment.yml +++ b/modules/nf-core/fgbio/fastqtobam/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/fastqtobam/main.nf b/modules/nf-core/fgbio/fastqtobam/main.nf index b1c884e863e..b4223db0f8c 100644 --- a/modules/nf-core/fgbio/fastqtobam/main.nf +++ b/modules/nf-core/fgbio/fastqtobam/main.nf @@ -4,8 +4,8 @@ process FGBIO_FASTQTOBAM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(reads) diff --git a/modules/nf-core/fgbio/fastqtobam/tests/main.nf.test.snap b/modules/nf-core/fgbio/fastqtobam/tests/main.nf.test.snap index fe9c01cdab8..dd167b97683 100644 --- a/modules/nf-core/fgbio/fastqtobam/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/fastqtobam/tests/main.nf.test.snap @@ -6,14 +6,14 @@ ], "test.cram", [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:35:16.955213727" + "timestamp": "2024-11-11T12:23:19.214068" }, "homo_sapiens - fastq1": { "content": [ @@ -22,14 +22,14 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:35:50.320465546" + "timestamp": "2024-11-11T12:23:52.501663" }, "homo_sapiens - [fastq1, fastq2] - default": { "content": [ @@ -38,14 +38,14 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:34:53.093519753" + "timestamp": "2024-11-11T12:23:02.561152" }, "homo_sapiens - [fastq1, fastq2] - umi": { "content": [ @@ -54,14 +54,14 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:36:07.216840033" + "timestamp": "2024-11-11T12:24:09.020635" }, "homo_sapiens - [fastq1, fastq2] - bam": { "content": [ @@ -70,14 +70,14 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:35:33.666898844" + "timestamp": "2024-11-11T12:23:35.97054" }, "homo_sapiens - [fastq1, fastq2] - custom sample": { "content": [ @@ -86,14 +86,14 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:36:24.905643178" + "timestamp": "2024-11-11T12:24:25.692023" }, "homo_sapiens - [fastq1, fastq2] - stub": { "content": [ @@ -102,13 +102,13 @@ ], [ - "versions.yml:md5,f6c3db3a20ce5e11c96e0ddd8ccd51de" + "versions.yml:md5,5f78e5611a92d4bd41337180b6d071b3" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:36:38.954087571" + "timestamp": "2024-11-11T12:24:37.828713" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/filterconsensusreads/environment.yml b/modules/nf-core/fgbio/filterconsensusreads/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/filterconsensusreads/environment.yml +++ b/modules/nf-core/fgbio/filterconsensusreads/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/filterconsensusreads/main.nf b/modules/nf-core/fgbio/filterconsensusreads/main.nf index 48379b9c3c0..89d21486d41 100644 --- a/modules/nf-core/fgbio/filterconsensusreads/main.nf +++ b/modules/nf-core/fgbio/filterconsensusreads/main.nf @@ -4,8 +4,8 @@ process FGBIO_FILTERCONSENSUSREADS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(bam) diff --git a/modules/nf-core/fgbio/filterconsensusreads/tests/main.nf.test.snap b/modules/nf-core/fgbio/filterconsensusreads/tests/main.nf.test.snap index 5c7f517eda6..5e3b46f0a2d 100644 --- a/modules/nf-core/fgbio/filterconsensusreads/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/filterconsensusreads/tests/main.nf.test.snap @@ -12,7 +12,7 @@ ] ], "1": [ - "versions.yml:md5,63ca8ca45ef2080260cc973288239e7b" + "versions.yml:md5,851cc03732cb4307aa499b822bb80b33" ], "bam": [ [ @@ -24,15 +24,15 @@ ] ], "versions": [ - "versions.yml:md5,63ca8ca45ef2080260cc973288239e7b" + "versions.yml:md5,851cc03732cb4307aa499b822bb80b33" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T06:05:27.436987863" + "timestamp": "2024-11-11T12:25:06.750465" }, "sarscov2 - bam": { "content": [ @@ -47,7 +47,7 @@ ] ], "1": [ - "versions.yml:md5,63ca8ca45ef2080260cc973288239e7b" + "versions.yml:md5,851cc03732cb4307aa499b822bb80b33" ], "bam": [ [ @@ -59,14 +59,14 @@ ] ], "versions": [ - "versions.yml:md5,63ca8ca45ef2080260cc973288239e7b" + "versions.yml:md5,851cc03732cb4307aa499b822bb80b33" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T06:08:24.799849173" + "timestamp": "2024-11-11T12:24:54.71894" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/groupreadsbyumi/environment.yml b/modules/nf-core/fgbio/groupreadsbyumi/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/groupreadsbyumi/environment.yml +++ b/modules/nf-core/fgbio/groupreadsbyumi/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/groupreadsbyumi/main.nf b/modules/nf-core/fgbio/groupreadsbyumi/main.nf index da9bf80acee..c0506c90223 100644 --- a/modules/nf-core/fgbio/groupreadsbyumi/main.nf +++ b/modules/nf-core/fgbio/groupreadsbyumi/main.nf @@ -4,8 +4,8 @@ process FGBIO_GROUPREADSBYUMI { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(bam) diff --git a/modules/nf-core/fgbio/groupreadsbyumi/tests/main.nf.test.snap b/modules/nf-core/fgbio/groupreadsbyumi/tests/main.nf.test.snap index dc89a622c76..67956c53370 100644 --- a/modules/nf-core/fgbio/groupreadsbyumi/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/groupreadsbyumi/tests/main.nf.test.snap @@ -21,7 +21,7 @@ ] ], "2": [ - "versions.yml:md5,e293eed3614f921114b3bd5b0e1ada10" + "versions.yml:md5,3951d85671eb08c5731449a16bd9a229" ], "bam": [ [ @@ -42,15 +42,15 @@ ] ], "versions": [ - "versions.yml:md5,e293eed3614f921114b3bd5b0e1ada10" + "versions.yml:md5,3951d85671eb08c5731449a16bd9a229" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:48:29.108067677" + "timestamp": "2024-11-11T12:25:36.897639" }, "sarscov2 - bam": { "content": [ @@ -74,7 +74,7 @@ ] ], "2": [ - "versions.yml:md5,e293eed3614f921114b3bd5b0e1ada10" + "versions.yml:md5,3951d85671eb08c5731449a16bd9a229" ], "bam": [ [ @@ -95,14 +95,14 @@ ] ], "versions": [ - "versions.yml:md5,e293eed3614f921114b3bd5b0e1ada10" + "versions.yml:md5,3951d85671eb08c5731449a16bd9a229" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:48:14.269677258" + "timestamp": "2024-11-11T12:25:25.077144" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/sortbam/environment.yml b/modules/nf-core/fgbio/sortbam/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/sortbam/environment.yml +++ b/modules/nf-core/fgbio/sortbam/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/sortbam/main.nf b/modules/nf-core/fgbio/sortbam/main.nf index e061f7caff8..818cdb40a96 100644 --- a/modules/nf-core/fgbio/sortbam/main.nf +++ b/modules/nf-core/fgbio/sortbam/main.nf @@ -4,8 +4,8 @@ process FGBIO_SORTBAM { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(bam) diff --git a/modules/nf-core/fgbio/sortbam/tests/main.nf.test.snap b/modules/nf-core/fgbio/sortbam/tests/main.nf.test.snap index 39761a99d27..6f437ba477d 100644 --- a/modules/nf-core/fgbio/sortbam/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/sortbam/tests/main.nf.test.snap @@ -11,7 +11,7 @@ ] ], "1": [ - "versions.yml:md5,384c5398cae017e4fe0df8cb8f004017" + "versions.yml:md5,2d127286141b26c7cf87e99f2875d10e" ], "bam": [ [ @@ -22,15 +22,15 @@ ] ], "versions": [ - "versions.yml:md5,384c5398cae017e4fe0df8cb8f004017" + "versions.yml:md5,2d127286141b26c7cf87e99f2875d10e" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T05:37:31.605753331" + "timestamp": "2024-11-11T12:26:05.650691" }, "sarscov2 - bam": { "content": [ @@ -44,7 +44,7 @@ ] ], "1": [ - "versions.yml:md5,384c5398cae017e4fe0df8cb8f004017" + "versions.yml:md5,2d127286141b26c7cf87e99f2875d10e" ], "bam": [ [ @@ -55,14 +55,14 @@ ] ], "versions": [ - "versions.yml:md5,384c5398cae017e4fe0df8cb8f004017" + "versions.yml:md5,2d127286141b26c7cf87e99f2875d10e" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:48:47.945706955" + "timestamp": "2024-11-11T12:25:53.613141" } } \ No newline at end of file diff --git a/modules/nf-core/fgbio/zipperbams/environment.yml b/modules/nf-core/fgbio/zipperbams/environment.yml index 6f3c75600d8..e2c4b144f32 100644 --- a/modules/nf-core/fgbio/zipperbams/environment.yml +++ b/modules/nf-core/fgbio/zipperbams/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::fgbio=2.2.1 + - bioconda::fgbio=2.4.0 diff --git a/modules/nf-core/fgbio/zipperbams/main.nf b/modules/nf-core/fgbio/zipperbams/main.nf index 2316a8ab28b..6ac212138a3 100644 --- a/modules/nf-core/fgbio/zipperbams/main.nf +++ b/modules/nf-core/fgbio/zipperbams/main.nf @@ -4,8 +4,8 @@ process FGBIO_ZIPPERBAMS { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fgbio:2.2.1--hdfd78af_0' : - 'biocontainers/fgbio:2.2.1--hdfd78af_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/87/87626ef674e2f19366ae6214575a114fe80ce598e796894820550731706a84be/data' : + 'community.wave.seqera.io/library/fgbio:2.4.0--913bad9d47ff8ddc' }" input: tuple val(meta), path(unmapped_bam) diff --git a/modules/nf-core/fgbio/zipperbams/tests/main.nf.test.snap b/modules/nf-core/fgbio/zipperbams/tests/main.nf.test.snap index 046c82770e8..ac7f19f7917 100644 --- a/modules/nf-core/fgbio/zipperbams/tests/main.nf.test.snap +++ b/modules/nf-core/fgbio/zipperbams/tests/main.nf.test.snap @@ -12,7 +12,7 @@ ] ], "1": [ - "versions.yml:md5,febce3e93c176534d546b12a8766778c" + "versions.yml:md5,14c9cd3297b43902a9a0cb60aea4def4" ], "bam": [ [ @@ -24,15 +24,15 @@ ] ], "versions": [ - "versions.yml:md5,febce3e93c176534d546b12a8766778c" + "versions.yml:md5,14c9cd3297b43902a9a0cb60aea4def4" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:29:48.140540051" + "timestamp": "2024-11-11T12:26:44.653937" }, "sarscov2 - bam": { "content": [ @@ -43,11 +43,11 @@ "id": "test", "single_end": false }, - "test_zipped.bam:md5,b309c59ad774142b42c48b122d1f38bb" + "test_zipped.bam:md5,1980b44177f4720f1005c9be62b09f79" ] ], "1": [ - "versions.yml:md5,febce3e93c176534d546b12a8766778c" + "versions.yml:md5,14c9cd3297b43902a9a0cb60aea4def4" ], "bam": [ [ @@ -55,18 +55,18 @@ "id": "test", "single_end": false }, - "test_zipped.bam:md5,b309c59ad774142b42c48b122d1f38bb" + "test_zipped.bam:md5,1980b44177f4720f1005c9be62b09f79" ] ], "versions": [ - "versions.yml:md5,febce3e93c176534d546b12a8766778c" + "versions.yml:md5,14c9cd3297b43902a9a0cb60aea4def4" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.0", + "nextflow": "24.04.4" }, - "timestamp": "2024-05-21T10:31:35.808757537" + "timestamp": "2024-11-11T12:26:29.680188" } } \ No newline at end of file From 76fc14f27d9696757cbd7636bb57ce60b23583ae Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Wed, 13 Nov 2024 11:31:51 +0000 Subject: [PATCH 76/87] Starting point for differential subworkflow (#6951) * Starting point for differential subworkflow * [automated] Fix linting with Prettier * Fix linting * Add missing tags * Add missing tags * Add test configs * Fix alignment * update meta.yml * [automated] Fix linting with Prettier * Fix up main.nf.test * Fix limma array test * Replace a snapshot test with a content check * Fix missing outputs in tests --------- Co-authored-by: nf-core-bot --- .../abundance_differential_filter/main.nf | 120 ++++++ .../abundance_differential_filter/meta.yml | 83 ++++ .../tests/deseq2_basic.config | 5 + .../tests/limma_basic_microarray.config | 19 + .../tests/limma_voom.config | 13 + .../tests/main.nf.test | 289 ++++++++++++++ .../tests/main.nf.test.snap | 376 ++++++++++++++++++ 7 files changed, 905 insertions(+) create mode 100644 subworkflows/nf-core/abundance_differential_filter/main.nf create mode 100644 subworkflows/nf-core/abundance_differential_filter/meta.yml create mode 100644 subworkflows/nf-core/abundance_differential_filter/tests/deseq2_basic.config create mode 100644 subworkflows/nf-core/abundance_differential_filter/tests/limma_basic_microarray.config create mode 100644 subworkflows/nf-core/abundance_differential_filter/tests/limma_voom.config create mode 100644 subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test create mode 100644 subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test.snap diff --git a/subworkflows/nf-core/abundance_differential_filter/main.nf b/subworkflows/nf-core/abundance_differential_filter/main.nf new file mode 100644 index 00000000000..f7ca8787512 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/main.nf @@ -0,0 +1,120 @@ +// +// Perform differential analysis +// + +include { LIMMA_DIFFERENTIAL } from '../../../modules/nf-core/limma/differential/main' +include { LIMMA_DIFFERENTIAL as LIMMA_NORM } from '../../../modules/nf-core/limma/differential/main' +include { DESEQ2_DIFFERENTIAL } from '../../../modules/nf-core/deseq2/differential/main' +include { DESEQ2_DIFFERENTIAL as DESEQ2_NORM } from '../../../modules/nf-core/deseq2/differential/main' +include { CUSTOM_FILTERDIFFERENTIALTABLE } from '../../../modules/nf-core/custom/filterdifferentialtable/main' + +workflow ABUNDANCE_DIFFERENTIAL_FILTER { + take: + ch_abundance // [ meta_exp, counts ] with meta keys: method, args_diff + ch_transcript_lengths // [ meta_exp, transcript_lengths] + ch_control_features // [ meta_exp, control_features] + ch_samplesheet // [ meta_exp, samplesheet ] + ch_contrasts // [ meta_contrast, contrast_variable, reference, target ] + differential_method // limma, deseq2, propd + FC_threshold // float + padj_threshold // float + + main: + + // initialize empty results channels + ch_normalised_matrix = Channel.empty() + ch_variance_stabilised_matrix = Channel.empty() + ch_model = Channel.empty() + + ch_results_genewise = Channel.empty() + ch_results_genewise_filtered = Channel.empty() + ch_versions = Channel.empty() + + // Derive some commonly used derived channels + ch_samples_and_matrix = ch_samplesheet.join(ch_abundance).first() + + logFC_column = null + padj_column = null + + // ---------------------------------------------------- + // Perform differential analysis with DESeq2 + // ---------------------------------------------------- + + if (differential_method == 'deseq2') { + + logFC_column = "log2FoldChange" + padj_column = "padj" + + // Run the module once to generate a normalised matrix. We can't just + // use e.g. the first run of DESEQ_DIFFERENTIAL, because it may remove + // some samples + + DESEQ2_NORM ( + ch_contrasts.first(), + ch_samples_and_matrix, + ch_control_features, + ch_transcript_lengths + ) + + ch_normalised_matrix = DESEQ2_NORM.out.normalised_counts + ch_variance_stabilised_matrix = DESEQ2_NORM.out.rlog_counts.concat(DESEQ2_NORM.out.vst_counts) + + // Run the DESeq differential module + + DESEQ2_DIFFERENTIAL ( + ch_contrasts, + ch_samples_and_matrix, + ch_control_features, + ch_transcript_lengths + ) + + ch_results_genewise = DESEQ2_DIFFERENTIAL.out.results + ch_model = DESEQ2_DIFFERENTIAL.out.model + + ch_versions = ch_versions + .mix(DESEQ2_DIFFERENTIAL.out.versions) + + } else if (differential_method == 'limma'){ + + logFC_column = "logFC" + padj_column = "adj.P.Val" + + // Run the module once to generate a normalised matrix. We can't just + // use e.g. the first run of LIMMA_DIFFERENTIAL, because it may remove + // some samples + + LIMMA_NORM ( + ch_contrasts.first(), + ch_samples_and_matrix + ) + + ch_normalised_matrix = LIMMA_NORM.out.normalised_counts + + LIMMA_DIFFERENTIAL ( + ch_contrasts, + ch_samples_and_matrix + ) + ch_results_genewise = LIMMA_DIFFERENTIAL.out.results + ch_model = LIMMA_DIFFERENTIAL.out.model + + ch_versions = ch_versions + .mix(LIMMA_DIFFERENTIAL.out.versions) + + } + + CUSTOM_FILTERDIFFERENTIALTABLE( + ch_results_genewise, + logFC_column, + FC_threshold, + padj_column, + padj_threshold + ) + + emit: + results_genewise = ch_results_genewise // channel: [ val(meta), path(results) ] + results_genewise_filtered = CUSTOM_FILTERDIFFERENTIALTABLE.out.filtered // channel: [ val(meta), path(filtered_results) ] + normalised_matrix = ch_normalised_matrix // channel: [ val(meta), path(normalised_matrix) ] + variance_stabilised_matrix = ch_variance_stabilised_matrix // channel: [ val(meta), path(variance_stabilised_matrix) ] (Optional) + model = ch_model // channel: [ val(meta), path(model) ] + versions = ch_versions // channel: [ path(versions.yml) ] +} diff --git a/subworkflows/nf-core/abundance_differential_filter/meta.yml b/subworkflows/nf-core/abundance_differential_filter/meta.yml new file mode 100644 index 00000000000..07c31cca254 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/meta.yml @@ -0,0 +1,83 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "abundance_differential_filter" +description: Perform differential analysis and filtering on abundance data +keywords: + - differential expression + - RNA-seq + - DESeq2 + - limma + - filtering +components: + - deseq2/differential + - limma/differential + - custom/filterdifferentialtable +input: + - ch_abundance: + type: file + description: | + Channel with abundance data and metadata + Structure: [ val(meta_exp), path(counts) ] + meta keys: method, args_diff + - ch_transcript_lengths: + type: file + description: | + Channel with transcript length information + Structure: [ val(meta_exp), path(transcript_lengths) ] + - ch_control_features: + type: file + description: | + Channel with control features information + Structure: [ val(meta_exp), path(control_features) ] + - ch_samplesheet: + type: file + description: | + Channel with sample information + Structure: [ val(meta_exp), path(samplesheet) ] + - ch_contrasts: + type: value + description: | + Channel with contrast information + Structure: [ val(meta_contrast), val(contrast_variable), val(reference), val(target) ] + - differential_method: + type: string + description: | + Method to use for differential analysis. Options: 'limma', 'deseq2' + - FC_threshold: + type: float + description: | + Fold change threshold for filtering differential results + - padj_threshold: + type: float + description: | + Adjusted p-value threshold for filtering differential results + +output: + - results_genewise: + type: file + description: Unfiltered differential analysis results + pattern: "*.{csv,tsv}" + - results_genewise_filtered: + type: file + description: Filtered differential analysis results + pattern: "*.{csv,tsv}" + - normalised_matrix: + type: file + description: Normalised count matrix + pattern: "*.{csv,tsv}" + - variance_stabilised_matrix: + type: file + description: Variance stabilised count matrix (optional, DESeq2 only) + pattern: "*.{csv,tsv}" + - model: + type: file + description: Statistical model object from differential analysis + pattern: "*.rds" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@pinin4fjords" +maintainers: + - "@pinin4fjords" diff --git a/subworkflows/nf-core/abundance_differential_filter/tests/deseq2_basic.config b/subworkflows/nf-core/abundance_differential_filter/tests/deseq2_basic.config new file mode 100644 index 00000000000..0e4e63a13f7 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/tests/deseq2_basic.config @@ -0,0 +1,5 @@ +process { + withName: 'DESEQ2_DIFFERENTIAL' { + ext.args = { "--round_digits 5 --blocking_variables $meta.blocking --vs_method rlog" } + } +} diff --git a/subworkflows/nf-core/abundance_differential_filter/tests/limma_basic_microarray.config b/subworkflows/nf-core/abundance_differential_filter/tests/limma_basic_microarray.config new file mode 100644 index 00000000000..98c5e882164 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/tests/limma_basic_microarray.config @@ -0,0 +1,19 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col name", + "--blocking_variables $meta.blocking" + ].join(' ').trim() } + } + + withName: 'AFFY_JUSTRMA' { + ext.args = "--sample_name_col name" + publishDir = [ enabled: false ] + } + withName: 'UNTAR' { + publishDir = [ enabled: false ] + } +} diff --git a/subworkflows/nf-core/abundance_differential_filter/tests/limma_voom.config b/subworkflows/nf-core/abundance_differential_filter/tests/limma_voom.config new file mode 100644 index 00000000000..a1e505570e1 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/tests/limma_voom.config @@ -0,0 +1,13 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'LIMMA_DIFFERENTIAL' { + ext.args = { [ + "--sample_id_col sample", + "--probe_id_col gene_id", + "--use_voom TRUE" + ].join(' ').trim() } + } + +} diff --git a/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test b/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test new file mode 100644 index 00000000000..144d61c87a7 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test @@ -0,0 +1,289 @@ +nextflow_workflow { + + name "Test Workflow ABUNDANCE_DIFFERENTIAL_FILTER" + script "../main.nf" + workflow "ABUNDANCE_DIFFERENTIAL_FILTER" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "subworkflows/abundance_differential_filter" + tag "custom/filterdifferentialtable" + tag "limma/differential" + tag "deseq2/differential" + tag "affy/justrma" + tag "untar" + + test("deseq2 - mouse - basic") { + config './deseq2_basic.config' + + when { + workflow { + """ + // Define test data + def testData = [ + expression_test_data_dir: params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/', + contrasts_file: 'SRP254919.contrasts.csv', + abundance_file: 'SRP254919.salmon.merged.gene_counts.top1000cov.tsv', + samplesheet_file: 'SRP254919.samplesheet.csv' + ] + + // Define inputs + input[0] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.abundance_file) + ]) + input[1] = Channel.of([ [], [] ]) + input[2] = Channel.of([ [], [] ]) + input[3] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.samplesheet_file) + ]) + input[4] = Channel.fromPath(file(testData.expression_test_data_dir + testData.contrasts_file)) + .splitCsv ( header:true, sep:',' ) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[5] = 'deseq2' + input[6] = 1.5 + input[7] = 0.05 + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.results_genewise, + workflow.out.results_genewise_filtered, + workflow.out.normalised_matrix, + workflow.out.variance_stabilised_matrix, + workflow.out.model, + workflow.out.versions + ).match() } + ) + } + } + + test("limma - basic - microarray") { + config './limma_basic_microarray.config' + + setup { + run("UNTAR") { + script "../../../../modules/nf-core/untar/main.nf" + process { + """ + input[0] = [ + [id: 'test'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751_RAW.tar", checkIfExists: true) + ] + """ + } + } + run("AFFY_JUSTRMA") { + script "../../../../modules/nf-core/affy/justrma/main.nf" + process { + """ + ch_samplesheet = Channel.of([ + [ id:'test'], + file(params.modules_testdata_base_path + "genomics/homo_sapiens/array_expression/GSE38751.csv", checkIfExists: true) + ] + ) + input[0] = ch_samplesheet.join(UNTAR.out.untar) + input[1] = [[],[]] + """ + } + } + } + + when { + workflow { + """ + // Define test data + def testData = [ + expression_test_data_dir: params.modules_testdata_base_path + 'genomics/homo_sapiens/array_expression/', + contrasts_file: 'GSE38751.contrasts.csv', + samplesheet_file: 'GSE38751.csv' + ] + + // Define inputs + input[0] = AFFY_JUSTRMA.out.expression + input[1] = Channel.of([ [], [] ]) + input[2] = Channel.of([ [], [] ]) + input[3] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.samplesheet_file) + ]) + input[4] = Channel.of(['id': 'diagnosis_normal_uremia', 'variable': 'diagnosis', 'reference': 'normal', 'target': 'uremia']) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[5] = 'limma' + input[6] = 1.5 + input[7] = 0.05 + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.results_genewise, + workflow.out.results_genewise_filtered, + workflow.out.normalised_matrix, + workflow.out.model, + workflow.out.versions + ).match() } + ) + } + } + + test("limma - voom") { + config './limma_voom.config' + + when { + workflow { + """ + // Define test data + def testData = [ + expression_test_data_dir: params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/', + contrasts_file: 'SRP254919.contrasts.csv', + abundance_file: 'SRP254919.salmon.merged.gene_counts.top1000cov.tsv', + samplesheet_file: 'SRP254919.samplesheet.csv' + ] + + // Define inputs + input[0] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.abundance_file) + ]) + input[1] = Channel.of([ [], [] ]) + input[2] = Channel.of([ [], [] ]) + input[3] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.samplesheet_file) + ]) + input[4] = Channel.of(['id': 'test', 'variable': 'treatment', 'reference': 'hND6', 'target': 'mCherry']) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[5] = 'limma' + input[6] = 1.5 + input[7] = 0.05 + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert path(workflow.out.results_genewise[0][1]).getText().contains("ENSMUSG00000023978\t-2.84055986312942") }, + { assert snapshot( + workflow.out.results_genewise_filtered, + workflow.out.normalised_matrix, + workflow.out.model, + workflow.out.versions + ).match() } + ) + } + } + + test("deseq2 - with transcript lengths") { + config './deseq2_basic.config' + + when { + workflow { + """ + // Define test data + def testData = [ + expression_test_data_dir: params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/', + contrasts_file: 'SRP254919.contrasts.csv', + abundance_file: 'SRP254919.salmon.merged.gene_counts.top1000cov.tsv', + samplesheet_file: 'SRP254919.samplesheet.csv', + lengths_file: 'SRP254919.spoofed_lengths.tsv' + ] + + // Define inputs + input[0] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.abundance_file) + ]) + input[1] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.lengths_file) + ]) + input[2] = Channel.of([ [], [] ]) + input[3] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.samplesheet_file) + ]) + input[4] = Channel.fromPath(file(testData.expression_test_data_dir + testData.contrasts_file)) + .splitCsv ( header:true, sep:',' ) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[5] = 'deseq2' + input[6] = 1.5 + input[7] = 0.05 + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.results_genewise, + workflow.out.results_genewise_filtered, + workflow.out.normalised_matrix, + workflow.out.variance_stabilised_matrix, + workflow.out.model, + workflow.out.versions + ).match() } + ) + } + } + + test("stub") { + config './deseq2_basic.config' + + options "-stub" + + when { + workflow { + """ + // Define test data + def testData = [ + expression_test_data_dir: params.modules_testdata_base_path + 'genomics/mus_musculus/rnaseq_expression/', + contrasts_file: 'SRP254919.contrasts.csv', + abundance_file: 'SRP254919.salmon.merged.gene_counts.top1000cov.tsv', + samplesheet_file: 'SRP254919.samplesheet.csv' + ] + + // Define inputs + input[0] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.abundance_file) + ]) + input[1] = Channel.of([ [], [] ]) + input[2] = Channel.of([ [], [] ]) + input[3] = Channel.of([ + [ id:'test' ], + file(testData.expression_test_data_dir + testData.samplesheet_file) + ]) + input[4] = Channel.fromPath(file(testData.expression_test_data_dir + testData.contrasts_file)) + .splitCsv ( header:true, sep:',' ) + .map{ + tuple(it, it.variable, it.reference, it.target) + } + input[5] = 'deseq2' + input[6] = 1.5 + input[7] = 0.05 + """ + } + } + then { + assertAll( + { assert workflow.success }, + { assert snapshot(workflow.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test.snap b/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test.snap new file mode 100644 index 00000000000..5053ea3db63 --- /dev/null +++ b/subworkflows/nf-core/abundance_differential_filter/tests/main.nf.test.snap @@ -0,0 +1,376 @@ +{ + "limma - basic - microarray": { + "content": [ + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia.limma.results.tsv:md5,4f0944b54b3ab7aa6ded5dd4b4e82802" + ] + ], + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia_filtered.tsv:md5,a971455ece4ae3c3ab902407b36fc6a5" + ] + ], + [ + + ], + [ + [ + { + "id": "diagnosis_normal_uremia", + "variable": "diagnosis", + "reference": "normal", + "target": "uremia" + }, + "diagnosis_normal_uremia.limma.model.txt:md5,70b000f632b8bdba4917046362dd876b" + ] + ], + [ + "versions.yml:md5,1ddaab440e2528c688c05a02dd066f12" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-13T09:33:03.414506" + }, + "limma - voom": { + "content": [ + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test_filtered.tsv:md5,0bfc9215edc6aad064c3ce6abc81bfce" + ] + ], + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.normalised_counts.tsv:md5,2aa4880ba5ae246a728b25f4316ca2ca" + ] + ], + [ + [ + { + "id": "test", + "variable": "treatment", + "reference": "hND6", + "target": "mCherry" + }, + "test.limma.model.txt:md5,d2113d82b76046c319e6602da2ad74d6" + ] + ], + [ + "versions.yml:md5,1ddaab440e2528c688c05a02dd066f12" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-12T12:09:18.770313" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.results.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6__filtered.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.normalised_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.rlog.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.model.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + "versions.yml:md5,05e3901f6d78f8839a7e07f422e9bc03" + ], + "model": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.model.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "normalised_matrix": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.normalised_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "results_genewise": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.results.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "results_genewise_filtered": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6__filtered.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "variance_stabilised_matrix": [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.rlog.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,05e3901f6d78f8839a7e07f422e9bc03" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-12T12:09:58.505823" + }, + "deseq2 - mouse - basic": { + "content": [ + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.results.tsv:md5,791cdba2615a445cded13cae95df73ef" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6__filtered.tsv:md5,7829ead408f4c9cad4277598a231c494" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.normalised_counts.tsv:md5,46ab7200c626649ab6256ed797ef5071" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.rlog.tsv:md5,b1adc1fba6bd0c8b55973608f4b97030" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.model.txt:md5,d2113d82b76046c319e6602da2ad74d6" + ] + ], + [ + "versions.yml:md5,2c0576aefff8da32c7c0cfd8529aa4b5" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-12T12:08:02.729948" + }, + "deseq2 - with transcript lengths": { + "content": [ + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.results.tsv:md5,944176b73455aa7c8de3ec32c03edef6" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6__filtered.tsv:md5,a48241fb5f24d961d3cce208f060b624" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.normalised_counts.tsv:md5,7050f44c460cc13e3f101d048d503527" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.rlog.tsv:md5,22a4b117246b2317e0f4daf7919703f2" + ] + ], + [ + [ + { + "id": "treatment_mCherry_hND6_", + "variable": "treatment", + "reference": "mCherry", + "target": "hND6", + "blocking": "" + }, + "treatment_mCherry_hND6_.deseq2.model.txt:md5,d2113d82b76046c319e6602da2ad74d6" + ] + ], + [ + "versions.yml:md5,2c0576aefff8da32c7c0cfd8529aa4b5" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-11-12T12:09:42.281946" + } +} \ No newline at end of file From 809053d64c7687d0686bc368c9bbe0459c2f5617 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:50:40 -0600 Subject: [PATCH 77/87] Ignore wave being flakey (#6985) * ci: Allow continue on error for wave jobs for now * ci: Update the event to be the PR head --- .github/workflows/wave.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index 08e376c50ee..5d6026f49bf 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -16,7 +16,7 @@ jobs: generate-matrix: name: generate-matrix runs-on: ubuntu-latest - if: github.repository == 'nf-core/modules' + if: github.event.pull_request.head.repo.full_name == "nf-core/modules" steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 @@ -67,6 +67,8 @@ jobs: return '${{ matrix.files }}'.replace('modules/nf-core/', '').replace('/environment.yml', '').replace('/', '_'); - name: Build container + # FIXME Hack while iron out the CI + continue-on-error: true if: matrix.profile == 'docker' run: | wave --conda-file "${{ matrix.files }}" \ @@ -76,6 +78,8 @@ jobs: --tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} - name: Build Singularity + # FIXME Hack while iron out the CI + continue-on-error: true if: matrix.profile == 'singularity' run: | wave --conda-file "${{ matrix.files }}" \ From bc6d86f063cd2e15015a339769c9ed18e5185a74 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:39:24 -0600 Subject: [PATCH 78/87] ci(wave): Get the syntax right (#6986) --- .github/workflows/wave.yml | 3 ++- modules/nf-core/fgbio/sortbam/environment.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/wave.yml b/.github/workflows/wave.yml index 5d6026f49bf..4f36575b6d1 100644 --- a/.github/workflows/wave.yml +++ b/.github/workflows/wave.yml @@ -16,7 +16,8 @@ jobs: generate-matrix: name: generate-matrix runs-on: ubuntu-latest - if: github.event.pull_request.head.repo.full_name == "nf-core/modules" + # Only run on Pull Requests within the same repository, and not from forks + if: github.event.pull_request.head.repo.full_name == github.repository steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 diff --git a/modules/nf-core/fgbio/sortbam/environment.yml b/modules/nf-core/fgbio/sortbam/environment.yml index e2c4b144f32..562a945934b 100644 --- a/modules/nf-core/fgbio/sortbam/environment.yml +++ b/modules/nf-core/fgbio/sortbam/environment.yml @@ -2,4 +2,5 @@ channels: - conda-forge - bioconda dependencies: + # renovate: datasource=conda depName=bioconda/fgbio - bioconda::fgbio=2.4.0 From cd6a81e9ce38e66c0fe368ab83e2eb4db8f6c011 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:44:28 -0600 Subject: [PATCH 79/87] ci(renovate): Allow channels in environment.ymls (#5400) --- .github/renovate.json5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 7ffc321969b..e19fc0f1dbe 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -35,8 +35,8 @@ // description: "Upgrade conda dependencies", // fileMatch: ["(^|/)environment(.*).ya?ml$"], // matchStrings: [ - // '#\\s*renovate\\s+datasource=conda\\s+depName=(?.*?)\\s+-\\s*[\\w-]+\\s*==?\\s*"?(?.*)"?', - // '# renovate: datasource=conda depName=(?.*?)\\s+-\\s*[\\w-]+\\s*==?\\s*"?(?.*)"?', + // '#\\s*renovate\\s+datasource=conda\\s+depName=(?.*?)\\s+-\\s*[\\w-]+:?:?[\\w-]+\\s*==?\\s*"?(?.*)"?', + // '# renovate: datasource=conda depName=(?.*?)\\s+-\\s*[\\w-]+:?:?[\\w-]+\\s*==?\\s*"?(?.*)"?', // ], // datasourceTemplate: "conda", // }, From 5d776f1de39e0636515df9039f5639ea6d5289eb Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:48:08 -0600 Subject: [PATCH 80/87] Renovate DRY (#5768) * ci: Use renovate config from ops repo * ci: Add process_updaters * ci: Run test workflow on renovate branches to avoid creating PRs * ci: Enable process updaters * ci: Disable automerge for conda, pypi, and docker --- .github/renovate.json5 | 87 +++++--------------------------------- .github/workflows/test.yml | 4 ++ 2 files changed, 15 insertions(+), 76 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index e19fc0f1dbe..1f9b112d4f6 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,79 +1,14 @@ { - $schema: "https://docs.renovatebot.com/renovate-schema.json", - extends: ["config:best-practices"], - vulnerabilityAlerts: { - labels: ["security"], - schedule: "at any time", - }, - prHourlyLimit: 3, - platform: "github", - onboarding: false, - dependencyDashboard: true, - dependencyDashboardTitle: "Renovate Dashboard 🤖", - suppressNotifications: ["prIgnoreNotification"], - rebaseWhen: "conflicted", - reviewers: ["team:modules"], - assigneesFromCodeOwners: true, - gitAuthor: "nf-core-bot ", - prHeader: "## WARNING\n - [ ] I have made sure to update the singularity and conda images", - "pre-commit": { - enabled: true, - }, - customManagers: [ - // TODO waiting on https://github.com/nf-core/modules/pull/4080 - // { - // customType: "regex", - // description: "Process Containers dependencies", - // fileMatch: ["(^|/)main\\.nf$"], - // matchStrings: [ - // "\\s+'(?\\S+):(?.*\\-.*)' }\"\n", - // ], - // datasourceTemplate: "docker", - // }, - // { - // customType: "regex", - // description: "Upgrade conda dependencies", - // fileMatch: ["(^|/)environment(.*).ya?ml$"], - // matchStrings: [ - // '#\\s*renovate\\s+datasource=conda\\s+depName=(?.*?)\\s+-\\s*[\\w-]+:?:?[\\w-]+\\s*==?\\s*"?(?.*)"?', - // '# renovate: datasource=conda depName=(?.*?)\\s+-\\s*[\\w-]+:?:?[\\w-]+\\s*==?\\s*"?(?.*)"?', - // ], - // datasourceTemplate: "conda", - // }, - // { - // customType: "regex", - // description: "Upgrade pypi dependencies inside conda environment files", - // fileMatch: ["(^|/)environment(.*).ya?ml$"], - // matchStrings: [ - // "# renovate datasource=pypi\\s+-\\s*(?[\\w-]+)\\s*(\\[[\\w,\\s]+\\])?\\s*==?\\s*(?.*)", - // "# renovate: datasource=pypi\\s+-\\s*(?[\\w-]+)\\s*(\\[[\\w,\\s]+\\])?\\s*==?\\s*(?.*)", - // ], - // datasourceTemplate: "pypi", - // }, - ], - packageRules: [ - { - matchDatasources: ["docker"], - registryUrls: ["quay.io"], - }, - { - matchManagers: ["github-actions"], - automerge: true, - pinDigest: { - enabled: false, - }, - matchPackageNames: ["/^nf-core//", "/^seqera/"], - }, - { - matchManagers: ["github-actions"], - groupName: "GitHub Actions", - automerge: true, - schedule: ["before 9am"], - }, - { - automerge: true, - schedule: ["before 9am on Monday"], - matchPackageNames: ["/renovate-config-validator/"], - }, + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>nf-core/ops//.github/renovate/default.json5", + "github>nf-core/ops//.github/renovate/process_updaters.json5" ], + "prHeader": "## WARNING\n - [ ] I have made sure to update the singularity and conda images", + "packageRules": [ + { + "matchManagers": ["conda", "pypi", "docker"], + "automerge": false + } + ] } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a4c49df720..8b0270f5b59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,9 @@ name: Run tests on: + push: + branches: + # https://docs.renovatebot.com/key-concepts/automerge/#branch-vs-pr-automerging + - "renovate/**" # branches Renovate creates pull_request: branches: [master] merge_group: From bc26bc782d279e7f4adab424123a188856ccd665 Mon Sep 17 00:00:00 2001 From: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> Date: Wed, 13 Nov 2024 20:58:43 -0600 Subject: [PATCH 81/87] ci(renovate): Managers => Datasources (#6988) --- .github/renovate.json5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 1f9b112d4f6..46af7821e36 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -7,7 +7,7 @@ "prHeader": "## WARNING\n - [ ] I have made sure to update the singularity and conda images", "packageRules": [ { - "matchManagers": ["conda", "pypi", "docker"], + "matchDatasources": ["conda", "pypi", "docker"], "automerge": false } ] From 9900d6d9b5ce115418bfd266616f4664c39477ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Thu, 14 Nov 2024 08:15:03 +0100 Subject: [PATCH 82/87] temporarely switch github runners (#6989) --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b0270f5b59..43fe9733d3a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,7 +139,7 @@ jobs: echo ${{ steps.outputs.outputs.subworkflows }} nf-core-lint-modules: - runs-on: ${{ github.event.inputs.runners || 'self-hosted' }} + runs-on: ${{ github.event.inputs.runners || 'ubuntu-latest' }} name: nf-core-lint-modules needs: [pytest-changes, nf-test-changes] if: ${{ (needs.pytest-changes.outputs.modules != '[]') || ( needs.nf-test-changes.outputs.modules != '[]') }} @@ -223,7 +223,7 @@ jobs: run: nf-core subworkflows lint ${{ matrix.tags }} pytest: - runs-on: ${{ github.event.inputs.runners || 'self-hosted' }} + runs-on: ${{ github.event.inputs.runners || 'ubuntu-latest' }} name: pytest needs: [pytest-changes] if: needs.pytest-changes.outputs.tags != '[]' @@ -489,7 +489,7 @@ jobs: !${{ github.workspace }}/.singularity nf-test: - runs-on: ${{ github.event.inputs.runners || 'self-hosted' }} + runs-on: ${{ github.event.inputs.runners || 'ubuntu-latest' }} name: nf-test needs: [nf-test-changes] if: ( needs.nf-test-changes.outputs.paths != '[]' ) From 4265ef4b3b9af8877671715b081f102041c64cfd Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 14 Nov 2024 08:49:27 +0100 Subject: [PATCH 83/87] Update GANON/BUILDCUSTOM (fix support for alternative input type) (#6982) * Change input system to ensure fastas come with (optional) TSV rather than mutually exclusively (missing tests) * Fix ganon build module to work with file input * Update modules/nf-core/ganon/buildcustom/tests/main.nf.test --- modules/nf-core/ganon/buildcustom/main.nf | 6 +- modules/nf-core/ganon/buildcustom/meta.yml | 12 ++-- .../ganon/buildcustom/tests/main.nf.test | 55 +++++++++++++++++-- .../ganon/buildcustom/tests/main.nf.test.snap | 47 +++++++++++----- .../ganon/buildcustom/tests/nextflow.config | 2 +- .../nf-core/ganon/classify/tests/main.nf.test | 2 +- .../nf-core/ganon/report/tests/main.nf.test | 2 +- .../nf-core/ganon/table/tests/main.nf.test | 2 +- 8 files changed, 95 insertions(+), 33 deletions(-) diff --git a/modules/nf-core/ganon/buildcustom/main.nf b/modules/nf-core/ganon/buildcustom/main.nf index 212e49f7f97..41ffd688be1 100644 --- a/modules/nf-core/ganon/buildcustom/main.nf +++ b/modules/nf-core/ganon/buildcustom/main.nf @@ -8,7 +8,7 @@ process GANON_BUILDCUSTOM { input: tuple val(meta), path(input) - val input_type + path input_tsv path taxonomy_files path genome_size_files @@ -23,14 +23,14 @@ process GANON_BUILDCUSTOM { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def input_cmd = input_type == 'fasta' ? "--input ${input}" : input_type == 'tsv' ? "--input-file ${input}" : error("Invalid input type: ${input_type}. Options: fasta, tsv") + def input_cmd = input_tsv ? "--input-file ${input_tsv}" : "--input ${input}" def taxonomy_args = taxonomy_files ? "--taxonomy-files ${taxonomy_files}" : "" def genome_size_args = genome_size_files ? "--genome-size-files ${genome_size_files}" : "" """ ganon \\ build-custom \\ --threads ${task.cpus} \\ - --input ${input} \\ + ${input_cmd} \\ --db-prefix ${prefix} \\ ${taxonomy_args} \\ ${genome_size_args} \\ diff --git a/modules/nf-core/ganon/buildcustom/meta.yml b/modules/nf-core/ganon/buildcustom/meta.yml index 39bc07349ad..5c481ec0f44 100644 --- a/modules/nf-core/ganon/buildcustom/meta.yml +++ b/modules/nf-core/ganon/buildcustom/meta.yml @@ -28,14 +28,14 @@ input: description: | List of input FASTA files, or a directory containing input FASTA files. Note you must supply --input-extension via ext.args if FASTA extensions do not end in the default `fna.gz`. - pattern: "*" - - - input_type: + pattern: "*.{fasta,fna,fa,fa,fasta.gz,fna.gz,fa.gz,fa.gz}" + - - input_tsv: type: string description: | - Specify whether the file(s) given to the input channel are in FASTA format (and will be supplied as --input) - or in TSV format (and will be supplied as --input-file). For TSV format, the 'file' column should be just the - file name so that it's local to the working directory of this process. - pattern: "fasta|tsv" + (Optional) Specify an TSV file containing the paths, and relevant metadata to the input FASTA files to use the `--input-file` option. + The 'file' column should be just the file name of each FASTA file (so that it's local to the working directory of the process). + See ganon documentation for more more information on the other columns. + pattern: "*tsv" - - taxonomy_files: type: file description: Pre-downloaded taxonomy files of input sequences. See ganon docs diff --git a/modules/nf-core/ganon/buildcustom/tests/main.nf.test b/modules/nf-core/ganon/buildcustom/tests/main.nf.test index 8fa42278035..9fe3948955e 100644 --- a/modules/nf-core/ganon/buildcustom/tests/main.nf.test +++ b/modules/nf-core/ganon/buildcustom/tests/main.nf.test @@ -10,16 +10,19 @@ nextflow_process { tag "ganon" tag "ganon/buildcustom" - test("sarscov2 - genome fasta") { + test("sarscov2 - genome - fasta") { when { + params { + module_args = '--input-target sequence' + } process { """ input[0] = [ [ id:'test' ], // meta map file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), ] - input[1] = 'fasta' + input[1] = [] input[2] = [] input[3] = [] """ @@ -31,10 +34,49 @@ nextflow_process { { assert process.success }, { assert snapshot( process.out.db.get(0).get(1).findAll { file(it).name != "test.tax" }, - process.out.versions + process.out.versions, + file(process.out.db.get(0).get(1).find { file(it).name == "test.tax" }).text.contains("MT192765.1") ).match() }, - { assert file(process.out.db.get(0).get(1).find { file(it).name == "test.tax" }).text.contains("MT192765.1") }, + ) + } + } + +test("sarscov2 - genome - tsv") { + + when { + params { + module_args = '--input-target file' + } + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), + ] + input[1] = ch_ganon_input_tsv = Channel.of(["genome.fasta", "Severe_acute_respiratory_syndrome_coronavirus_2", "2697049"]). + map { it.join("\t") } + .collectFile ( + name: "ganon_fasta_input.tsv", + newLine: true + ) + input[2] = [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_nodes.dmp', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/metagenome/prot_names.dmp', checkIfExists: true) + ] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.db.get(0).get(1), + process.out.versions + ).match() + } ) } } @@ -44,13 +86,16 @@ nextflow_process { options "-stub" when { + params { + module_args = '' + } process { """ input[0] = [ [ id:'test' ], // meta map file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), ] - input[1] = 'fasta' + input[1] = [] input[2] = [] input[3] = [] """ diff --git a/modules/nf-core/ganon/buildcustom/tests/main.nf.test.snap b/modules/nf-core/ganon/buildcustom/tests/main.nf.test.snap index 2c3243ffbdc..e27a749e38a 100644 --- a/modules/nf-core/ganon/buildcustom/tests/main.nf.test.snap +++ b/modules/nf-core/ganon/buildcustom/tests/main.nf.test.snap @@ -1,4 +1,36 @@ { + "sarscov2 - genome - tsv": { + "content": [ + [ + "test.hibf:md5,9edfe4c3873d621a88ebcad438dca42c", + "test.tax:md5,e15400a1e43cce61545834695da46465" + ], + [ + "versions.yml:md5,9c73293ae36914c6ce3718ad6728ad9e" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-13T13:37:14.320278404" + }, + "sarscov2 - genome - fasta": { + "content": [ + [ + "test.hibf:md5,d10fe6fc6d198696bc15ca85a1459614" + ], + [ + "versions.yml:md5,9c73293ae36914c6ce3718ad6728ad9e" + ], + true + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-13T13:36:52.317157496" + }, "sarscov2 - genome fasta - stub": { "content": [ { @@ -53,20 +85,5 @@ "nextflow": "24.04.4" }, "timestamp": "2024-10-07T17:00:22.98042261" - }, - "sarscov2 - genome fasta": { - "content": [ - [ - "test.hibf:md5,d10fe6fc6d198696bc15ca85a1459614" - ], - [ - "versions.yml:md5,9c73293ae36914c6ce3718ad6728ad9e" - ] - ], - "meta": { - "nf-test": "0.9.0", - "nextflow": "24.04.4" - }, - "timestamp": "2024-10-07T19:03:25.060306554" } } \ No newline at end of file diff --git a/modules/nf-core/ganon/buildcustom/tests/nextflow.config b/modules/nf-core/ganon/buildcustom/tests/nextflow.config index a12988eee89..15c20b612c1 100644 --- a/modules/nf-core/ganon/buildcustom/tests/nextflow.config +++ b/modules/nf-core/ganon/buildcustom/tests/nextflow.config @@ -1,5 +1,5 @@ process { withName: GANON_BUILDCUSTOM { - ext.args = "--input-target sequence" + ext.args = params.module_args } } diff --git a/modules/nf-core/ganon/classify/tests/main.nf.test b/modules/nf-core/ganon/classify/tests/main.nf.test index 40ea069e782..c031e442d8b 100644 --- a/modules/nf-core/ganon/classify/tests/main.nf.test +++ b/modules/nf-core/ganon/classify/tests/main.nf.test @@ -20,7 +20,7 @@ nextflow_process { [ id:'test' ], // meta map file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), ] - input[1] = 'fasta' + input[1] = [] input[2] = [] input[3] = [] """ diff --git a/modules/nf-core/ganon/report/tests/main.nf.test b/modules/nf-core/ganon/report/tests/main.nf.test index e6437b498bc..5804d7af6d0 100644 --- a/modules/nf-core/ganon/report/tests/main.nf.test +++ b/modules/nf-core/ganon/report/tests/main.nf.test @@ -21,7 +21,7 @@ nextflow_process { [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), ] - input[1] = 'fasta' + input[1] = [] input[2] = [] input[3] = [] """ diff --git a/modules/nf-core/ganon/table/tests/main.nf.test b/modules/nf-core/ganon/table/tests/main.nf.test index 9aae4ead0c5..f7b97f66936 100644 --- a/modules/nf-core/ganon/table/tests/main.nf.test +++ b/modules/nf-core/ganon/table/tests/main.nf.test @@ -22,7 +22,7 @@ nextflow_process { [ id:'test' ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), ] - input[1] = 'fasta' + input[1] = [] input[2] = [] input[3] = [] """ From b48e64d5982a587e57e9d3fba585d852c68ac512 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Thu, 14 Nov 2024 08:50:23 +0100 Subject: [PATCH 84/87] Add FCSGX_CLEANGENOME (#6975) Co-authored-by: Lauren huet Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: Edmund Miller <20095261+edmundmiller@users.noreply.github.com> --- .../nf-core/fcsgx/cleangenome/environment.yml | 7 ++ modules/nf-core/fcsgx/cleangenome/main.nf | 51 +++++++++ modules/nf-core/fcsgx/cleangenome/meta.yml | 64 +++++++++++ .../fcsgx/cleangenome/tests/main.nf.test | 85 +++++++++++++++ .../fcsgx/cleangenome/tests/main.nf.test.snap | 100 ++++++++++++++++++ 5 files changed, 307 insertions(+) create mode 100644 modules/nf-core/fcsgx/cleangenome/environment.yml create mode 100644 modules/nf-core/fcsgx/cleangenome/main.nf create mode 100644 modules/nf-core/fcsgx/cleangenome/meta.yml create mode 100644 modules/nf-core/fcsgx/cleangenome/tests/main.nf.test create mode 100644 modules/nf-core/fcsgx/cleangenome/tests/main.nf.test.snap diff --git a/modules/nf-core/fcsgx/cleangenome/environment.yml b/modules/nf-core/fcsgx/cleangenome/environment.yml new file mode 100644 index 00000000000..8fbbad1b543 --- /dev/null +++ b/modules/nf-core/fcsgx/cleangenome/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::ncbi-fcs-gx=0.5.4" diff --git a/modules/nf-core/fcsgx/cleangenome/main.nf b/modules/nf-core/fcsgx/cleangenome/main.nf new file mode 100644 index 00000000000..e46507a6396 --- /dev/null +++ b/modules/nf-core/fcsgx/cleangenome/main.nf @@ -0,0 +1,51 @@ +process FCSGX_CLEANGENOME { + 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/ncbi-fcs-gx:0.5.4--h4ac6f70_1': + 'biocontainers/ncbi-fcs-gx:0.5.4--h4ac6f70_1' }" + + input: + tuple val(meta), path(fasta), path(fcsgx_report) + + output: + tuple val(meta), path("*.cleaned.fasta") , emit: cleaned + tuple val(meta), path("*.contaminants.fasta"), emit: contaminants + 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}" + """ + gx \\ + clean-genome \\ + --input ${fasta} \\ + --action-report ${fcsgx_report} \\ + --output ${prefix}.cleaned.fasta \\ + --contam-fasta-out ${prefix}.contaminants.fasta \\ + ${args} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcsgx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ + + stub: + // def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.cleaned.fasta + touch ${prefix}.contaminants.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fcsgx: \$( gx --help | sed '/build/!d; s/.*:v//; s/-.*//' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fcsgx/cleangenome/meta.yml b/modules/nf-core/fcsgx/cleangenome/meta.yml new file mode 100644 index 00000000000..380ec0283fc --- /dev/null +++ b/modules/nf-core/fcsgx/cleangenome/meta.yml @@ -0,0 +1,64 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "fcsgx_cleangenome" +description: Runs FCS-GX (Foreign Contamination Screen - Genome eXtractor) to + remove foreign contamination from genome assemblies +keywords: + - genome + - assembly + - contamination + - screening + - cleaning + - fcs-gx +tools: + - "fcsgx": + description: "The NCBI Foreign Contamination Screen. Genomic cross-species aligner, + for contamination detection." + homepage: "https://github.com/ncbi/fcs-gx" + documentation: "https://github.com/ncbi/fcs/wiki/" + tool_dev_url: "https://github.com/ncbi/fcs-gx" + doi: "10.1186/s13059-024-03198-7" + licence: ["NCBI-PD"] + identifier: "biotools:ncbi_fcs" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fasta: + type: file + description: Input genome assembly file in FASTA format + pattern: "*.{fa,fasta,fna}" + - fcsgx_report: + type: file + description: Final contamination report with contaminant cleaning actions. Generated using FCSGX_RUNGX +output: + - cleaned: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.cleaned.fasta": + type: file + description: The fasta file after cleaning, where sequences annotated as ACTION_EXCLUDE or ACTION_TRIM are excluded + - contaminants: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.contaminants.fasta": + type: file + description: Sequences annotated as ACTION_EXCLUDE which are marked as contaminants. + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@mahesh-panchal" + - "@LaurenHuet" +maintainers: + - "@mahesh-panchal" diff --git a/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test b/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test new file mode 100644 index 00000000000..8000093d744 --- /dev/null +++ b/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test @@ -0,0 +1,85 @@ +nextflow_process { + + name "Test Process FCSGX_CLEANGENOME" + script "../main.nf" + process "FCSGX_CLEANGENOME" + + tag "modules" + tag "modules_nfcore" + tag "fcsgx" + tag "fcsgx/fetchdb" + tag "fcsgx/rungx" + tag "fcsgx/cleangenome" + + setup { + run("FCSGX_FETCHDB"){ + script "../../fetchdb/main.nf" + process { + """ + input[0] = file('https://ftp.ncbi.nlm.nih.gov/genomes/TOOLS/FCS/database/test-only/test-only.manifest', checkIfExists: true) + """ + } + } + run("FCSGX_RUNGX") { + script "../../rungx/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], // meta map + '2697049', // taxid for SARS-CoV-2 + file('https://zenodo.org/records/10932013/files/FCS_combo_test.fa', checkIfExists: true), + ] + input[1] = FCSGX_FETCHDB.out.database + input[2] = [] + """ + } + } + } + + test("sarscov2 - fasta") { + + when { + process { + """ + input[0] = Channel.value([ + [ id:'test' ], // meta map + file('https://zenodo.org/records/10932013/files/FCS_combo_test.fa', checkIfExists: true), + ]).join(FCSGX_RUNGX.out.fcsgx_report) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = Channel.value([ + [ id:'test' ], // meta map + file('https://zenodo.org/records/10932013/files/FCS_combo_test.fa', checkIfExists: true), + ]).join(FCSGX_RUNGX.out.fcsgx_report) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test.snap b/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test.snap new file mode 100644 index 00000000000..a62f95b480b --- /dev/null +++ b/modules/nf-core/fcsgx/cleangenome/tests/main.nf.test.snap @@ -0,0 +1,100 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.cleaned.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.contaminants.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,4235d280269123cbd3e43d920bcf71b9" + ], + "cleaned": [ + [ + { + "id": "test" + }, + "test.cleaned.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "contaminants": [ + [ + { + "id": "test" + }, + "test.contaminants.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,4235d280269123cbd3e43d920bcf71b9" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T10:02:26.605398704" + }, + "sarscov2 - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.cleaned.fasta:md5,59ba4b4c773f02a0dc90034762aa1ddf" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.contaminants.fasta:md5,17c11ea7d2d0076be5183b87618ee91e" + ] + ], + "2": [ + "versions.yml:md5,4235d280269123cbd3e43d920bcf71b9" + ], + "cleaned": [ + [ + { + "id": "test" + }, + "test.cleaned.fasta:md5,59ba4b4c773f02a0dc90034762aa1ddf" + ] + ], + "contaminants": [ + [ + { + "id": "test" + }, + "test.contaminants.fasta:md5,17c11ea7d2d0076be5183b87618ee91e" + ] + ], + "versions": [ + "versions.yml:md5,4235d280269123cbd3e43d920bcf71b9" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-12T12:05:43.065207163" + } +} \ No newline at end of file From 03a9f356a1a333923c1177c2912fa7bc61bb46f3 Mon Sep 17 00:00:00 2001 From: Evangelos Karatzas <32259775+vagkaratzas@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:51:04 +0200 Subject: [PATCH 85/87] =?UTF-8?q?hmmalign=20ported=20to=20nf-test,=20versi?= =?UTF-8?q?on=20bump,=20wave=20container,=20standard=20ou=E2=80=A6=20(#699?= =?UTF-8?q?2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hmmalign ported to nf-test, version bump, wave container, standard output format, hmmbuild version bump, wave container, subworkflow updated accordingly --- .../nf-core/hmmer/hmmalign/environment.yml | 2 +- modules/nf-core/hmmer/hmmalign/main.nf | 21 ++- modules/nf-core/hmmer/hmmalign/meta.yml | 7 +- .../nf-core/hmmer/hmmalign/tests/main.nf.test | 58 +++++++ .../hmmer/hmmalign/tests/main.nf.test.snap | 68 ++++++++ .../nf-core/hmmer/hmmbuild/environment.yml | 2 +- modules/nf-core/hmmer/hmmbuild/main.nf | 4 +- .../nf-core/hmmer/hmmbuild/tests/main.nf.test | 12 +- .../hmmer/hmmbuild/tests/main.nf.test.snap | 14 +- .../nf-core/fasta_newick_epang_gappa/main.nf | 4 +- .../tests/main.nf.test.snap | 164 +++++++++--------- tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/hmmer/hmmalign/main.nf | 30 ---- .../nf-core/hmmer/hmmalign/nextflow.config | 8 - tests/modules/nf-core/hmmer/hmmalign/test.yml | 16 -- 15 files changed, 247 insertions(+), 166 deletions(-) create mode 100644 modules/nf-core/hmmer/hmmalign/tests/main.nf.test create mode 100644 modules/nf-core/hmmer/hmmalign/tests/main.nf.test.snap delete mode 100644 tests/modules/nf-core/hmmer/hmmalign/main.nf delete mode 100644 tests/modules/nf-core/hmmer/hmmalign/nextflow.config delete mode 100644 tests/modules/nf-core/hmmer/hmmalign/test.yml diff --git a/modules/nf-core/hmmer/hmmalign/environment.yml b/modules/nf-core/hmmer/hmmalign/environment.yml index 7c62eac7e3a..c5ddec5d912 100644 --- a/modules/nf-core/hmmer/hmmalign/environment.yml +++ b/modules/nf-core/hmmer/hmmalign/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::hmmer=3.3.2 + - bioconda::hmmer=3.4 diff --git a/modules/nf-core/hmmer/hmmalign/main.nf b/modules/nf-core/hmmer/hmmalign/main.nf index 00ae8da2b95..39b17c787d8 100644 --- a/modules/nf-core/hmmer/hmmalign/main.nf +++ b/modules/nf-core/hmmer/hmmalign/main.nf @@ -4,16 +4,16 @@ process HMMER_HMMALIGN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/hmmer:3.3.2--h1b792b2_1' : - 'biocontainers/hmmer:3.3.2--h1b792b2_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/07/07c4cbd91c4459dc86b13b5cd799cacba96b27d66c276485550d299c7a4c6f8a/data' : + 'community.wave.seqera.io/library/hmmer:3.4--cb5d2dd2e85974ca' }" input: tuple val(meta), path(fasta) path hmm output: - tuple val(meta), path("*.sthlm.gz"), emit: sthlm - path "versions.yml" , emit: versions + tuple val(meta), path("*.sto.gz"), emit: sto + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -25,7 +25,18 @@ process HMMER_HMMALIGN { hmmalign \\ $args \\ $hmm \\ - $fasta | gzip -c > ${prefix}.sthlm.gz + $fasta | gzip -c > ${prefix}.sto.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(hmmalign -h | grep -o '^# HMMER [0-9.]*' | sed 's/^# HMMER *//') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + echo | gzip > ${prefix}.sto.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/hmmer/hmmalign/meta.yml b/modules/nf-core/hmmer/hmmalign/meta.yml index 366cf4f5a58..fb16ba6822e 100644 --- a/modules/nf-core/hmmer/hmmalign/meta.yml +++ b/modules/nf-core/hmmer/hmmalign/meta.yml @@ -30,16 +30,16 @@ input: description: A gzipped HMM file pattern: "*.hmm.gz" output: - - sthlm: + - sto: - meta: type: map description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - "*.sthlm.gz": + - "*.sto.gz": type: file description: Multiple alignment in gzipped Stockholm format - pattern: "*.sthlm.gz" + pattern: "*.sto.gz" - versions: - versions.yml: type: file @@ -51,3 +51,4 @@ authors: maintainers: - "@erikrikarddaniel" - "@jfy133" + - "@vagkaratzas" diff --git a/modules/nf-core/hmmer/hmmalign/tests/main.nf.test b/modules/nf-core/hmmer/hmmalign/tests/main.nf.test new file mode 100644 index 00000000000..7b0368fc630 --- /dev/null +++ b/modules/nf-core/hmmer/hmmalign/tests/main.nf.test @@ -0,0 +1,58 @@ + +nextflow_process { + + name "Test Process HMMER_HMMALIGN" + script "../main.nf" + process "HMMER_HMMALIGN" + + tag "modules" + tag "modules_nfcore" + tag "hmmer" + tag "hmmer/hmmalign" + + test("test-hmmer-hmmalign") { + + when { + process { + """ + input[0] = [ + [ id: 'test' ], // meta map + file(params.modules_testdata_base_path + 'delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test-hmmer-hmmalign-stub") { + options '-stub' + + when { + process { + """ + input[0] = [ + [ id: 'test' ], // meta map + file(params.modules_testdata_base_path + 'delete_me/hmmer/e_coli_k12_16s.fna.gz', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'delete_me/hmmer/bac.16S_rRNA.hmm.gz', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + +} diff --git a/modules/nf-core/hmmer/hmmalign/tests/main.nf.test.snap b/modules/nf-core/hmmer/hmmalign/tests/main.nf.test.snap new file mode 100644 index 00000000000..ae65cacb18b --- /dev/null +++ b/modules/nf-core/hmmer/hmmalign/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "test-hmmer-hmmalign": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.sto.gz:md5,4ae989d5ade2aaae9578cb88ba031e8f" + ] + ], + "1": [ + "versions.yml:md5,601e13e7a1e6057766d862a828d501c4" + ], + "sto": [ + [ + { + "id": "test" + }, + "test.sto.gz:md5,4ae989d5ade2aaae9578cb88ba031e8f" + ] + ], + "versions": [ + "versions.yml:md5,601e13e7a1e6057766d862a828d501c4" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "23.04.5" + }, + "timestamp": "2024-11-13T12:37:26.551497424" + }, + "test-hmmer-hmmalign-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.sto.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,601e13e7a1e6057766d862a828d501c4" + ], + "sto": [ + [ + { + "id": "test" + }, + "test.sto.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,601e13e7a1e6057766d862a828d501c4" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "23.04.5" + }, + "timestamp": "2024-11-13T12:37:32.244343836" + } +} \ No newline at end of file diff --git a/modules/nf-core/hmmer/hmmbuild/environment.yml b/modules/nf-core/hmmer/hmmbuild/environment.yml index 7c62eac7e3a..c5ddec5d912 100644 --- a/modules/nf-core/hmmer/hmmbuild/environment.yml +++ b/modules/nf-core/hmmer/hmmbuild/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::hmmer=3.3.2 + - bioconda::hmmer=3.4 diff --git a/modules/nf-core/hmmer/hmmbuild/main.nf b/modules/nf-core/hmmer/hmmbuild/main.nf index b4629cb47a6..8eed7fcd7ad 100644 --- a/modules/nf-core/hmmer/hmmbuild/main.nf +++ b/modules/nf-core/hmmer/hmmbuild/main.nf @@ -4,8 +4,8 @@ process HMMER_HMMBUILD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/hmmer:3.3.2--h87f3376_2': - 'biocontainers/hmmer:3.3.2--h1b792b2_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/07/07c4cbd91c4459dc86b13b5cd799cacba96b27d66c276485550d299c7a4c6f8a/data' : + 'community.wave.seqera.io/library/hmmer:3.4--cb5d2dd2e85974ca' }" input: tuple val(meta), path(alignment) diff --git a/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test b/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test index d7c058255ea..635f5b661f1 100644 --- a/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test +++ b/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test @@ -16,9 +16,9 @@ nextflow_process { process { """ input[0] = [ - [ id: 'PF14720' ], // meta map - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) - ] + [ id: 'PF14720' ], // meta map + file(params.modules_testdata_base_path + 'delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) + ] input[1] = [] """ @@ -46,9 +46,9 @@ nextflow_process { process { """ input[0] = [ - [ id: 'PF14720' ], // meta map - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) - ] + [ id: 'PF14720' ], // meta map + file(params.modules_testdata_base_path + 'delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) + ] input[1] = [] """ diff --git a/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test.snap b/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test.snap index 8cdff17c142..79317b89ebd 100644 --- a/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test.snap +++ b/modules/nf-core/hmmer/hmmbuild/tests/main.nf.test.snap @@ -14,7 +14,7 @@ "PF14720.hmmbuild.txt:md5,d41d8cd98f00b204e9800998ecf8427e" ], "2": [ - "versions.yml:md5,6f4796b714cb0d5981cd12d9e89cb599" + "versions.yml:md5,f8a0bffcbbc58404752849403812905b" ], "hmm": [ [ @@ -28,28 +28,28 @@ "PF14720.hmmbuild.txt:md5,d41d8cd98f00b204e9800998ecf8427e" ], "versions": [ - "versions.yml:md5,6f4796b714cb0d5981cd12d9e89cb599" + "versions.yml:md5,f8a0bffcbbc58404752849403812905b" ] } ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nextflow": "23.04.5" }, - "timestamp": "2024-09-05T21:38:44.751216" + "timestamp": "2024-11-13T12:52:29.794123574" }, "test-hmmer-hmmbuild": { "content": [ "PF14720.hmm.gz", "PF14720.hmmbuild.txt", [ - "versions.yml:md5,6f4796b714cb0d5981cd12d9e89cb599" + "versions.yml:md5,f8a0bffcbbc58404752849403812905b" ] ], "meta": { "nf-test": "0.9.0", - "nextflow": "24.04.4" + "nextflow": "23.04.5" }, - "timestamp": "2024-09-05T21:49:25.772308" + "timestamp": "2024-11-13T12:52:23.95935055" } } \ No newline at end of file diff --git a/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf b/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf index 28016014f94..723f4a2d91a 100644 --- a/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf +++ b/subworkflows/nf-core/fasta_newick_epang_gappa/main.nf @@ -82,10 +82,10 @@ workflow FASTA_NEWICK_EPANG_GAPPA { ch_versions = ch_versions.mix(HMMER_HMMALIGNQUERY.out.versions) // 1.d Mask the alignments (Add '--rf-is-mask' ext.args in config for the process.) - HMMER_MASKREF ( HMMER_HMMALIGNREF.out.sthlm.map { [ it[0], it[1], [], [], [], [], [], [] ] }, [] ) + HMMER_MASKREF ( HMMER_HMMALIGNREF.out.sto.map { [ it[0], it[1], [], [], [], [], [], [] ] }, [] ) ch_versions = ch_versions.mix(HMMER_MASKREF.out.versions) - HMMER_MASKQUERY ( HMMER_HMMALIGNQUERY.out.sthlm.map { [ it[0], it[1], [], [], [], [], [], [] ] }, [] ) + HMMER_MASKQUERY ( HMMER_HMMALIGNQUERY.out.sto.map { [ it[0], it[1], [], [], [], [], [], [] ] }, [] ) ch_versions = ch_versions.mix(HMMER_MASKQUERY.out.versions) // 1.e Reformat alignments to "afa" (aligned fasta) diff --git a/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test.snap b/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test.snap index e6627edbe99..207d28e5013 100644 --- a/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fasta_newick_epang_gappa/tests/main.nf.test.snap @@ -4,201 +4,201 @@ "hmmer.taxonomy.per_query.tsv" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-05T20:45:46.123551197" + "timestamp": "2024-11-14T10:16:44.874521222" }, "mafft.taxonomy.profile.tsv_lines": { "content": "eb4ae24c330c4b4ab768f7d1c26c7215", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:24:06.138041" + "timestamp": "2024-11-14T10:16:59.978336429" + }, + "hmmer.graft.placement.epa_result.newick_lines": { + "content": "8533b159d543f75b92efcfb4fd330280", + "meta": { + "nf-test": "0.9.0", + "nextflow": "23.04.5" + }, + "timestamp": "2024-11-14T10:16:44.866852673" }, "hmmer.taxonomy.profile.tsv": { "content": [ "hmmer.taxonomy.profile.tsv" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-04-05T20:45:46.115530176" - }, - "hmmer.graft.placement.epa_result.newick_lines": { - "content": "8533b159d543f75b92efcfb4fd330280", - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T10:55:06.361779" + "timestamp": "2024-11-14T10:16:44.868720482" }, "hmmer.taxonomy.profile.tsv_lines": { "content": "8533b159d543f75b92efcfb4fd330280", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T10:59:31.223864" + "timestamp": "2024-11-14T10:16:44.871385161" }, "mafft.graft.placement.epa_result.newick_lines": { "content": "eb4ae24c330c4b4ab768f7d1c26c7215", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:24:06.117996" + "timestamp": "2024-11-14T10:16:59.973967772" }, "mafft.taxonomy.per_query.tsv_lines": { "content": "eb4ae24c330c4b4ab768f7d1c26c7215", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:24:06.175662" + "timestamp": "2024-11-14T10:16:59.98411855" }, "nucl_hmmer.versions.yml": { "content": [ "versions.yml" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:42.212896" + "timestamp": "2024-11-14T10:17:41.730837855" }, "hmmer.graft.placement.epa_result.newick": { "content": [ "hmmer.graft.hmmer.epa_result.newick" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-05T20:45:46.105219765" + "timestamp": "2024-11-14T10:16:44.863462591" }, "hmmer.versions.yml": { "content": [ "versions.yml" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:05.782093" + "timestamp": "2024-11-14T10:16:44.880743216" }, - "nucl_hmmer.graft.placement.epa_result.newick": { + "hmmer.epa_result.jplace.gz": { "content": [ - "nucl_hmmer.graft.nucl_hmmer.epa_result.newick" + "hmmer.epa_result.jplace.gz" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:37:46.19414" + "timestamp": "2024-11-14T10:16:44.857734455" }, - "hmmer.epa_result.jplace.gz": { + "nucl_hmmer.graft.placement.epa_result.newick": { "content": [ - "hmmer.epa_result.jplace.gz" + "nucl_hmmer.graft.nucl_hmmer.epa_result.newick" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:56:49.564967" + "timestamp": "2024-11-14T10:17:41.728034651" }, "hmmer.taxonomy.per_query.tsv_lines": { "content": "8533b159d543f75b92efcfb4fd330280", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T10:59:31.236689" + "timestamp": "2024-11-14T10:16:44.878231148" }, "mafft.taxonomy.per_query.tsv": { "content": [ "mafft.taxonomy.per_query.tsv" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-05T20:57:13.505168194" + "timestamp": "2024-11-14T10:16:59.980370338" }, "mafft.graft.placement.epa_result.newick": { "content": [ "mafft.graft.mafft.epa_result.newick" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-05T20:57:13.49856233" + "timestamp": "2024-11-14T10:16:59.972095017" }, "nucl_hmmer.epa_result.jplace.gz": { "content": [ "nucl_hmmer.epa_result.jplace.gz" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:44:49.494246" + "timestamp": "2024-11-14T10:17:41.725684052" }, "nucl_hmmer.versions.yml_lines": { - "content": "664dc00d47aecd41a420dc6ba7ef4eea", + "content": "eafb4184937621216ff03df17c4245a6", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:42.217138" + "timestamp": "2024-11-14T10:17:41.733022413" }, - "mafft.taxonomy.profile.tsv": { - "content": [ - "mafft.taxonomy.profile.tsv" - ], + "hmmer.versions.yml_lines": { + "content": "eafb4184937621216ff03df17c4245a6", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-05T20:57:13.501534227" + "timestamp": "2024-11-14T10:16:44.884598465" }, "mafft.epa_result.jplace.gz": { "content": [ "mafft.epa_result.jplace.gz" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T11:57:06.815658" + "timestamp": "2024-11-14T10:16:59.970209461" }, - "hmmer.versions.yml_lines": { - "content": "664dc00d47aecd41a420dc6ba7ef4eea", + "mafft.taxonomy.profile.tsv": { + "content": [ + "mafft.taxonomy.profile.tsv" + ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:05.849215" + "timestamp": "2024-11-14T10:16:59.975738553" }, "mafft.versions.yml": { "content": [ "versions.yml" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:20.88609" + "timestamp": "2024-11-14T10:16:59.986610634" }, "mafft.versions.yml_lines": { "content": "f5957093def0191f32bb294000fb9242", "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "23.04.5" }, - "timestamp": "2024-04-08T13:37:20.890963" + "timestamp": "2024-11-14T10:16:59.988948939" } } \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 55984e2de9e..2e0e6420c33 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -299,9 +299,6 @@ hmmer/eslalimask: hmmer/eslreformat: - modules/nf-core/hmmer/eslreformat/** - tests/modules/nf-core/hmmer/eslreformat/** -hmmer/hmmalign: - - modules/nf-core/hmmer/hmmalign/** - - tests/modules/nf-core/hmmer/hmmalign/** hmtnote/annotate: - modules/nf-core/hmtnote/annotate/** - tests/modules/nf-core/hmtnote/annotate/** diff --git a/tests/modules/nf-core/hmmer/hmmalign/main.nf b/tests/modules/nf-core/hmmer/hmmalign/main.nf deleted file mode 100644 index 64814641c3d..00000000000 --- a/tests/modules/nf-core/hmmer/hmmalign/main.nf +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { HMMER_HMMALIGN as HMMER_HMMALIGN } from '../../../../../modules/nf-core/hmmer/hmmalign/main.nf' -include { HMMER_HMMALIGN as HMMER_HMMALIGN_PREFIX } from '../../../../../modules/nf-core/hmmer/hmmalign/main.nf' - -workflow test_hmmer_hmmalign { - - input = [ - [ id:'test' ], // meta map - file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz') // Change to params.test_data syntax after the data is included in ./tests/config/test_data.config - ] - - hmm = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz') - - HMMER_HMMALIGN ( input, hmm ) -} - -workflow test_hmmer_hmmalign_prefix { - - input = [ - [ id:'test' ], // meta map - file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/e_coli_k12_16s.fna.gz') // Change to params.test_data syntax after the data is included in ./tests/config/test_data.config - ] - - hmm = file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/hmmer/bac.16S_rRNA.hmm.gz') - - HMMER_HMMALIGN_PREFIX ( input, hmm ) -} diff --git a/tests/modules/nf-core/hmmer/hmmalign/nextflow.config b/tests/modules/nf-core/hmmer/hmmalign/nextflow.config deleted file mode 100644 index b2115af55d9..00000000000 --- a/tests/modules/nf-core/hmmer/hmmalign/nextflow.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: HMMER_HMMALIGN_PREFIX { - ext.prefix = { "${meta.id}.prefix" } - } -} diff --git a/tests/modules/nf-core/hmmer/hmmalign/test.yml b/tests/modules/nf-core/hmmer/hmmalign/test.yml deleted file mode 100644 index 2f483956c98..00000000000 --- a/tests/modules/nf-core/hmmer/hmmalign/test.yml +++ /dev/null @@ -1,16 +0,0 @@ -- name: hmmer hmmalign test_hmmer_hmmalign - command: nextflow run ./tests/modules/nf-core/hmmer/hmmalign -entry test_hmmer_hmmalign -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/hmmer/hmmalign/nextflow.config - tags: - - hmmer - - hmmer/hmmalign - files: - - path: output/hmmer/test.sthlm.gz - md5sum: ddaa8b96291edf4e1a929a224329161b -- name: hmmer hmmalign test_hmmer_hmmalign_prefix - command: nextflow run ./tests/modules/nf-core/hmmer/hmmalign -entry test_hmmer_hmmalign_prefix -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/hmmer/hmmalign/nextflow.config - tags: - - hmmer - - hmmer/hmmalign - files: - - path: output/hmmer/test.prefix.sthlm.gz - md5sum: ddaa8b96291edf4e1a929a224329161b From 920895254d42e874c035d07d783d40da7395c2da Mon Sep 17 00:00:00 2001 From: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:12:33 +0530 Subject: [PATCH 86/87] Fix/biscuit apps (#6979) * init update biscuit apps * update index module + test; use seqera container * update align module + test; use seqera container * update blaster container + test * update container + test * update container + test * update mergecg container + test + rm tags.yml * update pileup container + test * update index container * update qc container + test * update vcf2bed container + test * fix biscuit, samtools cpu determination --- modules/nf-core/biscuit/align/environment.yml | 4 +- modules/nf-core/biscuit/align/main.nf | 33 ++++-- modules/nf-core/biscuit/align/meta.yml | 21 +++- .../nf-core/biscuit/align/tests/main.nf.test | 70 ++++++++++-- .../biscuit/align/tests/main.nf.test.snap | 87 ++++++++++++-- modules/nf-core/biscuit/align/tests/tags.yml | 3 - .../biscuit/biscuitblaster/environment.yml | 4 +- .../nf-core/biscuit/biscuitblaster/main.nf | 32 +++--- .../nf-core/biscuit/biscuitblaster/meta.yml | 24 +++- .../biscuit/biscuitblaster/tests/main.nf.test | 58 ++++++---- .../biscuitblaster/tests/main.nf.test.snap | 53 ++++----- .../biscuit/biscuitblaster/tests/tags.yml | 2 - .../nf-core/biscuit/bsconv/environment.yml | 2 +- modules/nf-core/biscuit/bsconv/main.nf | 19 ++- modules/nf-core/biscuit/bsconv/meta.yml | 26 ++++- .../nf-core/biscuit/bsconv/tests/main.nf.test | 49 +++++--- .../biscuit/bsconv/tests/main.nf.test.snap | 63 ++-------- modules/nf-core/biscuit/bsconv/tests/tags.yml | 2 - .../nf-core/biscuit/epiread/environment.yml | 4 +- modules/nf-core/biscuit/epiread/main.nf | 31 +++-- modules/nf-core/biscuit/epiread/meta.yml | 35 +++++- .../biscuit/epiread/tests/main.nf.test | 92 +++++++++++---- .../biscuit/epiread/tests/main.nf.test.snap | 92 +++++++-------- modules/nf-core/biscuit/index/environment.yml | 2 +- modules/nf-core/biscuit/index/main.nf | 11 +- modules/nf-core/biscuit/index/meta.yml | 18 ++- .../nf-core/biscuit/index/tests/main.nf.test | 17 +-- .../biscuit/index/tests/main.nf.test.snap | 108 +++++++++++------- .../nf-core/biscuit/mergecg/environment.yml | 4 +- modules/nf-core/biscuit/mergecg/main.nf | 21 ++-- modules/nf-core/biscuit/mergecg/meta.yml | 21 +++- .../biscuit/mergecg/tests/main.nf.test | 47 ++++---- .../biscuit/mergecg/tests/main.nf.test.snap | 36 +++--- .../nf-core/biscuit/mergecg/tests/tags.yml | 2 - .../nf-core/biscuit/pileup/environment.yml | 4 +- modules/nf-core/biscuit/pileup/main.nf | 15 +-- modules/nf-core/biscuit/pileup/meta.yml | 19 ++- .../nf-core/biscuit/pileup/tests/main.nf.test | 36 ++++-- .../biscuit/pileup/tests/main.nf.test.snap | 64 +++++------ modules/nf-core/biscuit/qc/environment.yml | 2 +- modules/nf-core/biscuit/qc/main.nf | 13 ++- modules/nf-core/biscuit/qc/meta.yml | 20 +++- modules/nf-core/biscuit/qc/tests/main.nf.test | 21 +++- .../biscuit/qc/tests/main.nf.test.snap | 28 ++--- .../nf-core/biscuit/vcf2bed/environment.yml | 4 +- modules/nf-core/biscuit/vcf2bed/main.nf | 12 +- modules/nf-core/biscuit/vcf2bed/meta.yml | 1 + .../biscuit/vcf2bed/tests/main.nf.test | 14 +-- .../biscuit/vcf2bed/tests/main.nf.test.snap | 24 ++-- 49 files changed, 839 insertions(+), 531 deletions(-) delete mode 100644 modules/nf-core/biscuit/align/tests/tags.yml delete mode 100644 modules/nf-core/biscuit/biscuitblaster/tests/tags.yml delete mode 100644 modules/nf-core/biscuit/bsconv/tests/tags.yml delete mode 100644 modules/nf-core/biscuit/mergecg/tests/tags.yml diff --git a/modules/nf-core/biscuit/align/environment.yml b/modules/nf-core/biscuit/align/environment.yml index b4bab59944c..222c156ed9a 100644 --- a/modules/nf-core/biscuit/align/environment.yml +++ b/modules/nf-core/biscuit/align/environment.yml @@ -2,5 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 - - bioconda::samtools=1.16.1 + - bioconda::biscuit=1.5.0.20240506 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/align/main.nf b/modules/nf-core/biscuit/align/main.nf index 5154748725d..0d43dc05183 100644 --- a/modules/nf-core/biscuit/align/main.nf +++ b/modules/nf-core/biscuit/align/main.nf @@ -4,12 +4,13 @@ process BISCUIT_ALIGN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data': + 'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }" input: tuple val(meta), path(reads) - path index + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: tuple val(meta), path("*.bam"), emit: bam @@ -23,18 +24,34 @@ process BISCUIT_ALIGN { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.9),1) - def samtools_cpus = task.cpus-biscuit_cpus + def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max() + def samtools_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus) """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit align \\ $args \\ -@ $biscuit_cpus \\ - \$INDEX \\ + $index/$fasta \\ $reads \\ - | samtools sort $args2 --threads $samtools_cpus --write-index -o ${prefix}.bam##idx##${prefix}.bam.bai - + | samtools sort $args2 --threads $samtools_cpus --write-index -o ${prefix}.bam -O BAM - + samtools index ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + biscuit: \$( biscuit version |& sed '1!d; s/^.*BISCUIT Version: //' ) + samtools: \$( samtools --version |& sed '1!d; s/^.*samtools //' ) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bam + touch ${prefix}.bam.bai cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/biscuit/align/meta.yml b/modules/nf-core/biscuit/align/meta.yml index 645fc2c98a3..464e435bfa9 100644 --- a/modules/nf-core/biscuit/align/meta.yml +++ b/modules/nf-core/biscuit/align/meta.yml @@ -27,12 +27,24 @@ input: - reads: type: file description: | - List of input fastq files of size 1 and 2 for single-end and paired-end data, + List of input FastQ files of size 1 and 2 for single-end and paired-end data, respectively. - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - bam: - meta: @@ -63,3 +75,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/align/tests/main.nf.test b/modules/nf-core/biscuit/align/tests/main.nf.test index 1dc3eb3faca..84feb7a2249 100644 --- a/modules/nf-core/biscuit/align/tests/main.nf.test +++ b/modules/nf-core/biscuit/align/tests/main.nf.test @@ -12,16 +12,19 @@ nextflow_process { setup { run("BISCUIT_INDEX") { - script "../../index/main.nf" + script "../../../biscuit/index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("Single-End sarscov2 test_methylated_1 [fastq_gz]") { + test("sarscov2 single-end [fastq_gz]") { when { process { @@ -30,7 +33,11 @@ nextflow_process { [ id:'test' ], // meta map [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true) ] ] - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -38,14 +45,17 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert file(process.out.bam[0][1]).name == "test.bam" }, - { assert file(process.out.bai[0][1]).name == "test.bam.bai" }, - { assert snapshot(process.out.versions).match("single-end-versions") } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.bai, + process.out.versions + ).match() + } ) } } - test("Paired-End sarscov2 test_methylated_1 [fastq_gz]") { + test("sarscov2 paired-end [fastq_gz]") { when { process { @@ -55,7 +65,11 @@ nextflow_process { [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) ] ] - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -63,9 +77,41 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert file(process.out.bam[0][1]).name == "test.bam" }, - { assert file(process.out.bai[0][1]).name == "test.bam.bai" }, - { assert snapshot(process.out.versions).match("paired-end-versions") } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.bai, + process.out.versions + ).match() + } + ) + } + } + + test("sarscov2 paired-end [fastq_gz] - stub") { + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz', checkIfExists: true) ] + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() + } ) } } diff --git a/modules/nf-core/biscuit/align/tests/main.nf.test.snap b/modules/nf-core/biscuit/align/tests/main.nf.test.snap index 5776f87c62f..b6aeda38f7b 100644 --- a/modules/nf-core/biscuit/align/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/align/tests/main.nf.test.snap @@ -1,26 +1,93 @@ { - "single-end-versions": { + "sarscov2 single-end [fastq_gz]": { "content": [ + "499055250804bb3674c724bd9adf9d02", [ - "versions.yml:md5,0b2a8c4c438a785a890110a458399bfd" + [ + { + "id": "test" + }, + "test.bam.bai:md5,a748afc3cec6c27906ae80638e2024f5" + ] + ], + [ + "versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-22T20:06:02.295706212" + "timestamp": "2024-11-14T10:03:51.461022384" }, - "paired-end-versions": { + "sarscov2 paired-end [fastq_gz]": { "content": [ + "6b5afc62da5533472e1479950bb5f09a", + [ + [ + { + "id": "test" + }, + "test.bam.bai:md5,ba60b802f583496e330c555bca9f0b97" + ] + ], [ - "versions.yml:md5,0b2a8c4c438a785a890110a458399bfd" + "versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-14T10:04:02.88266119" + }, + "sarscov2 paired-end [fastq_gz] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016" + ], + "bai": [ + [ + { + "id": "test" + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,18c276eafa69dc43fa4d5b83b8392016" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-22T20:06:17.879689395" + "timestamp": "2024-11-13T06:48:19.558887499" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/align/tests/tags.yml b/modules/nf-core/biscuit/align/tests/tags.yml deleted file mode 100644 index d73b8183f7f..00000000000 --- a/modules/nf-core/biscuit/align/tests/tags.yml +++ /dev/null @@ -1,3 +0,0 @@ -biscuit/align: - - modules/nf-core/biscuit/index/** - - modules/nf-core/biscuit/align/** diff --git a/modules/nf-core/biscuit/biscuitblaster/environment.yml b/modules/nf-core/biscuit/biscuitblaster/environment.yml index ba50e31d11c..74a7b2fb908 100644 --- a/modules/nf-core/biscuit/biscuitblaster/environment.yml +++ b/modules/nf-core/biscuit/biscuitblaster/environment.yml @@ -2,6 +2,6 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 + - bioconda::biscuit=1.5.0.20240506 - bioconda::samblaster=0.1.26 - - bioconda::samtools=1.16.1 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/biscuitblaster/main.nf b/modules/nf-core/biscuit/biscuitblaster/main.nf index c4f7e1a52c5..f7876cb2fb5 100644 --- a/modules/nf-core/biscuit/biscuitblaster/main.nf +++ b/modules/nf-core/biscuit/biscuitblaster/main.nf @@ -4,12 +4,13 @@ process BISCUIT_BLASTER { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/22/22f141a92e12f98040054b9a47a51fb4de9c544174bbfa6d251a110f5e26fddc/data': + 'community.wave.seqera.io/library/biscuit_samblaster_samtools:a683d0887e7a91bf' }" input: tuple val(meta), path(reads) - path index + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: tuple val(meta), path("*.bam"), emit: bam @@ -24,23 +25,24 @@ process BISCUIT_BLASTER { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def args3 = task.ext.args3 ?: '' - def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.95),1) - def samtools_cpus = task.cpus-biscuit_cpus + def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max() + def samtools_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus) """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit align \\ -@ $biscuit_cpus \\ $args \\ - \$INDEX \\ - $reads | \\ - samblaster \\ - $args2 | \\ - samtools sort \\ - -@ $samtools_cpus \\ - $args3 \\ - --write-index \\ - -o ${prefix}.bam##idx##${prefix}.bam.bai + $index/$fasta\\ + $reads \\ + | samblaster $args2 \\ + | samtools sort \\ + -@ $samtools_cpus \\ + $args3 \\ + --write-index \\ + -o ${prefix}.bam -O BAM - + + samtools index ${prefix}.bam cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/biscuit/biscuitblaster/meta.yml b/modules/nf-core/biscuit/biscuitblaster/meta.yml index d64cc1c2694..f2bed154053 100644 --- a/modules/nf-core/biscuit/biscuitblaster/meta.yml +++ b/modules/nf-core/biscuit/biscuitblaster/meta.yml @@ -1,6 +1,5 @@ name: biscuit_blaster -description: A fast, compact one-liner to produce duplicate-marked, sorted, and indexed - BAM files using Biscuit +description: A fast, compact one-liner to produce duplicate-marked, sorted, and indexed BAM files using Biscuit keywords: - biscuit - DNA methylation @@ -48,12 +47,24 @@ input: - reads: type: file description: | - List of input fastq files of size 1 and 2 for single-end and paired-end data, + List of input FastQ files of size 1 and 2 for single-end and paired-end data, respectively. - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - bam: - meta: @@ -84,3 +95,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test b/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test index ccea7f5b85e..9b7f7562ed8 100644 --- a/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test +++ b/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test @@ -14,21 +14,27 @@ nextflow_process { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("sarscov2 - single") { + test("sarscov2 single-end [fastq_gz]") { when { process { """ input[0] = [ [ id:'test' ], // meta map [ file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz", checkIfExists: true) ] - ] - - input[1] = BISCUIT_INDEX.out.index + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -36,25 +42,30 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(file(process.out.bai[0][1]).name, - process.out.bam.collect { bam(it[1]).getHeaderMD5() }, - process.out.bam.collect { bam(it[1]).getReadsMD5() }, - process.out.versions).match() } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.bai, + process.out.versions + ).match() + } ) } } - test("sarscov2 - paired-end") { + test("sarscov2 paired-end [fastq_gz]") { when { process { """ input[0] = [ [ id:'test' ], // meta map [ file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz", checkIfExists: true), file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz", checkIfExists: true) ] - ] - - input[1] = BISCUIT_INDEX.out.index + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -62,15 +73,17 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.bai, - process.out.bam.collect { bam(it[1]).getHeaderMD5() }, - process.out.bam.collect { bam(it[1]).getReadsMD5() }, - process.out.versions).match() } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.bai, + process.out.versions + ).match() + } ) } } - test("sarscov2 - paired-end -stub") { + test("sarscov2 paired-end [fastq_gz] - stub") { options "-stub" when { process { @@ -78,9 +91,12 @@ nextflow_process { input[0] = [ [ id:'test' ], // meta map [ file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test.methylated_1.fastq.gz", checkIfExists: true), file(params.modules_testdata_base_path + "genomics/sarscov2/illumina/fastq/test.methylated_2.fastq.gz", checkIfExists: true) ] - ] - - input[1] = BISCUIT_INDEX.out.index + ] + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } diff --git a/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test.snap b/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test.snap index e537de7d8ca..72f3eea613f 100644 --- a/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/biscuitblaster/tests/main.nf.test.snap @@ -1,50 +1,47 @@ { - "sarscov2 - single": { + "sarscov2 single-end [fastq_gz]": { "content": [ - "test.bam.bai", + "499055250804bb3674c724bd9adf9d02", [ - "a3b85097046b61879ab72293c38daea0" - ], - [ - "499055250804bb3674c724bd9adf9d02" + [ + { + "id": "test" + }, + "test.bam.bai:md5,56efb7d64af887266e8490a4afd6171f" + ] ], [ - "versions.yml:md5,3f08154389b908fdfee5d4a328781e96" + "versions.yml:md5,92fe349c3b2cd12866273c14f89d79b9" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-10T11:20:35.533081588" + "timestamp": "2024-11-14T06:39:47.556767238" }, - "sarscov2 - paired-end": { + "sarscov2 paired-end [fastq_gz]": { "content": [ + "6b5afc62da5533472e1479950bb5f09a", [ [ { "id": "test" }, - "test.bam.bai:md5,bc235b43786886957bd5bb5b6623d4dd" + "test.bam.bai:md5,128302694afc1cf9e04b45c41860785f" ] ], [ - "d66c238598e02630bba7595baa2a6e71" - ], - [ - "6b5afc62da5533472e1479950bb5f09a" - ], - [ - "versions.yml:md5,3f08154389b908fdfee5d4a328781e96" + "versions.yml:md5,92fe349c3b2cd12866273c14f89d79b9" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-10T10:57:59.954913657" + "timestamp": "2024-11-14T06:40:01.376002655" }, - "sarscov2 - paired-end -stub": { + "sarscov2 paired-end [fastq_gz] - stub": { "content": [ { "0": [ @@ -64,7 +61,7 @@ ] ], "2": [ - "versions.yml:md5,3f08154389b908fdfee5d4a328781e96" + "versions.yml:md5,92fe349c3b2cd12866273c14f89d79b9" ], "bai": [ [ @@ -83,14 +80,14 @@ ] ], "versions": [ - "versions.yml:md5,3f08154389b908fdfee5d4a328781e96" + "versions.yml:md5,92fe349c3b2cd12866273c14f89d79b9" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-10T10:58:19.26950429" + "timestamp": "2024-11-14T06:40:14.345664344" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/biscuitblaster/tests/tags.yml b/modules/nf-core/biscuit/biscuitblaster/tests/tags.yml deleted file mode 100644 index 13adde05efb..00000000000 --- a/modules/nf-core/biscuit/biscuitblaster/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -biscuit/biscuitblaster: - - "modules/nf-core/biscuit/biscuitblaster/**" diff --git a/modules/nf-core/biscuit/bsconv/environment.yml b/modules/nf-core/biscuit/bsconv/environment.yml index 56b7e967693..123215dc20f 100644 --- a/modules/nf-core/biscuit/bsconv/environment.yml +++ b/modules/nf-core/biscuit/bsconv/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 + - bioconda::biscuit=1.5.0.20240506 diff --git a/modules/nf-core/biscuit/bsconv/main.nf b/modules/nf-core/biscuit/bsconv/main.nf index 881fa0be813..5fb47439d1c 100644 --- a/modules/nf-core/biscuit/bsconv/main.nf +++ b/modules/nf-core/biscuit/bsconv/main.nf @@ -2,18 +2,19 @@ process BISCUIT_BSCONV { tag "$meta.id" label 'process_long' - conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/biscuit:1.1.0.20220707--he272189_1': - 'biocontainers/biscuit:1.1.0.20220707--he272189_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/33/33a9ca30b4154f11253c8d91a75382065dcb8282ba99b74dbee59ed8faceabd7/data': + 'community.wave.seqera.io/library/biscuit:1.5.0.20240506--ca92d9d0a37b5fa8' }" input: - tuple val(meta), path(bam), path(bai) - path(index) + tuple val(meta), path(bam) + tuple val(meta2), path(bai) + tuple val(meta3), path(fasta) + tuple val(meta4), path(index) output: - tuple val(meta), path("*.bam"), emit: bsconv_bam + tuple val(meta), path("*.bam"), emit: bam path "versions.yml" , emit: versions when: @@ -24,11 +25,11 @@ process BISCUIT_BSCONV { def prefix = task.ext.prefix ?: "${meta.id}" if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit bsconv \\ $args \\ - \$INDEX \\ + $index/$fasta \\ $bam \\ ${prefix}.bam @@ -41,8 +42,6 @@ process BISCUIT_BSCONV { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - if ("$bam" == "${prefix}.bam") error "Input and output names are the same, set prefix in module configuration to disambiguate!" - """ touch ${prefix}.bam diff --git a/modules/nf-core/biscuit/bsconv/meta.yml b/modules/nf-core/biscuit/bsconv/meta.yml index 75d9b2b7939..e162e175af0 100644 --- a/modules/nf-core/biscuit/bsconv/meta.yml +++ b/modules/nf-core/biscuit/bsconv/meta.yml @@ -27,15 +27,32 @@ input: - bam: type: file description: BAM file contained mapped reads + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - bai: type: file description: BAM file index - - - index: + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta4: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - - bsconv_bam: + - bam: - meta: type: map description: | @@ -54,3 +71,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/bsconv/tests/main.nf.test b/modules/nf-core/biscuit/bsconv/tests/main.nf.test index 1cbf306a88b..331c3df01f8 100644 --- a/modules/nf-core/biscuit/bsconv/tests/main.nf.test +++ b/modules/nf-core/biscuit/bsconv/tests/main.nf.test @@ -9,29 +9,36 @@ nextflow_process { tag "biscuit/bsconv" tag "biscuit/index" - setup { run("BISCUIT_INDEX") { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("sarscov2-pe - bam") { + test("sarscov2 paired-end [bam]") { when { process { """ input[0] = [ [id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) + ] + input[1] = [ [id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) - ] - - input[1] = BISCUIT_INDEX.out.index + ] + input[2] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[3] = BISCUIT_INDEX.out.index """ } } @@ -39,14 +46,17 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.bsconv_bam).match("bsconv_bam") }, - { assert snapshot(process.out.versions).match("versions") } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } ) } } - test("sarscov2-pe - bam - stub") { + test("sarscov2 paired-end [bam] - stub") { options "-stub" @@ -54,11 +64,16 @@ nextflow_process { process { """ input[0] = [ [id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) + ] + input[1] = [ [id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) - ] - - input[1] = BISCUIT_INDEX.out.index + ] + input[2] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[3] = BISCUIT_INDEX.out.index """ } } @@ -66,7 +81,11 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions + ).match() + } ) } diff --git a/modules/nf-core/biscuit/bsconv/tests/main.nf.test.snap b/modules/nf-core/biscuit/bsconv/tests/main.nf.test.snap index 96dc77c097b..7796ebbb5ad 100644 --- a/modules/nf-core/biscuit/bsconv/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/bsconv/tests/main.nf.test.snap @@ -1,67 +1,28 @@ { - "versions": { + "sarscov2 paired-end [bam]": { "content": [ + "1608a01cabbbaba635e2905b7049f487", [ - "versions.yml:md5,45455cc9522a3235fa482ad065a242b3" + "versions.yml:md5,f8bba061ed5d28794abb4ffc2898aa02" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-07T15:28:04.601734997" + "timestamp": "2024-11-14T08:18:08.129627771" }, - "sarscov2-pe - bam - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - "versions.yml:md5,45455cc9522a3235fa482ad065a242b3" - ], - "bsconv_bam": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,45455cc9522a3235fa482ad065a242b3" - ] - } - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-05-07T15:28:14.729945289" - }, - "bsconv_bam": { + "sarscov2 paired-end [bam] - stub": { "content": [ + "d41d8cd98f00b204e9800998ecf8427e", [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,0d425851bd18963ebf1b6d727a7d02c7" - ] + "versions.yml:md5,f8bba061ed5d28794abb4ffc2898aa02" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-05-07T15:28:04.580771449" + "timestamp": "2024-11-14T08:18:18.658974235" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/bsconv/tests/tags.yml b/modules/nf-core/biscuit/bsconv/tests/tags.yml deleted file mode 100644 index 5b890ac3597..00000000000 --- a/modules/nf-core/biscuit/bsconv/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -biscuit/bsconv: - - "modules/nf-core/biscuit/bsconv/**" diff --git a/modules/nf-core/biscuit/epiread/environment.yml b/modules/nf-core/biscuit/epiread/environment.yml index b4bab59944c..222c156ed9a 100644 --- a/modules/nf-core/biscuit/epiread/environment.yml +++ b/modules/nf-core/biscuit/epiread/environment.yml @@ -2,5 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 - - bioconda::samtools=1.16.1 + - bioconda::biscuit=1.5.0.20240506 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/epiread/main.nf b/modules/nf-core/biscuit/epiread/main.nf index 8eeb675c09c..110177c000c 100644 --- a/modules/nf-core/biscuit/epiread/main.nf +++ b/modules/nf-core/biscuit/epiread/main.nf @@ -4,15 +4,18 @@ process BISCUIT_EPIREAD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data': + 'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }" input: - tuple val(meta), path(bam), path(bai), path(snp_bed) - path(index) + tuple val(meta), path(bam) + tuple val(meta2), path(bai) + tuple val(meta3), path(snp_bed) + tuple val(meta4), path(fasta) + tuple val(meta5), path(index) output: - tuple val(meta), path("*.bed.gz"), emit: epiread_bed + tuple val(meta), path("*.bed.gz"), emit: bed path "versions.yml" , emit: versions when: @@ -22,8 +25,8 @@ process BISCUIT_EPIREAD { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.9),1) - def samtools_cpus = task.cpus-biscuit_cpus + def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max() + def samtools_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus) // As of 2/25/22, epiread does not support reading a gzipped SNP BED file. // This is a bit hacky but allows the user to supply a gzipped OR uncompressed bed file def unzip_snp_bed = snp_bed && (snp_bed.toString() =~ /\.gz$/) ? "bgzip -d ${snp_bed}" : "" @@ -32,7 +35,7 @@ process BISCUIT_EPIREAD { def options_snp_bed = snp_bed ? "-B ${unzipped_snp_bed}" : "" if ("$options_snp_bed" == "${prefix}.bed.gz") error "Input and output names for biscuit epiread are the same, set prefix in module configuration to disambiguate!" """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta $unzip_snp_bed @@ -40,11 +43,10 @@ process BISCUIT_EPIREAD { -@ $biscuit_cpus \\ $args \\ $options_snp_bed \\ - \$INDEX \\ - $bam | \\ - LC_ALL=C sort -k1,1 -k2,2n | \\ - bgzip \\ - -@ $samtools_cpus \\ + $index/$fasta \\ + $bam \\ + | LC_ALL=C sort -k1,1 -k2,2n \\ + | bgzip -@ $samtools_cpus \\ $args2 \\ -c > ${prefix}.bed.gz @@ -57,9 +59,6 @@ process BISCUIT_EPIREAD { stub: def prefix = task.ext.prefix ?: "${meta.id}" - def unzipped_snp_bed = snp_bed ? snp_bed.toString() - ~/\.gz$/: "" - def options_snp_bed = snp_bed ? "-B ${unzipped_snp_bed}" : "" - if ("$options_snp_bed" == "${prefix}.bed.gz") error "Input and output names for biscuit epiread are the same, set prefix in module configuration to disambiguate!" """ echo | gzip > ${prefix}.bed.gz diff --git a/modules/nf-core/biscuit/epiread/meta.yml b/modules/nf-core/biscuit/epiread/meta.yml index 8974f1d952a..b695be1cd8f 100644 --- a/modules/nf-core/biscuit/epiread/meta.yml +++ b/modules/nf-core/biscuit/epiread/meta.yml @@ -27,19 +27,41 @@ input: e.g. [ id:'test', single_end:false ] - bam: type: file - description: Biscuit BAM file + description: BAM file contained mapped reads + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - bai: type: file - description: BAM index + description: BAM file index + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - snp_bed: type: file description: BED file containing SNP information (optional) - - - index: + - - meta4: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta5: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - - epiread_bed: + - bed: - meta: type: map description: | @@ -58,3 +80,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/epiread/tests/main.nf.test b/modules/nf-core/biscuit/epiread/tests/main.nf.test index 5a151008afa..ceb1bff5b6f 100644 --- a/modules/nf-core/biscuit/epiread/tests/main.nf.test +++ b/modules/nf-core/biscuit/epiread/tests/main.nf.test @@ -15,24 +15,36 @@ nextflow_process { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("sarscov2 - test_paired_end_methylated_sorted_bam") { + test("sarscov2 paired-end [bam]") { when { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), - [] //SNP BED file + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) + ] + input[2] = [ + [ id:'test' ], [] //SNP BED file + ] + input[3] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[4] = BISCUIT_INDEX.out.index """ } } @@ -46,18 +58,28 @@ nextflow_process { } - test("sarscov2 - test_paired_end_methylated_sorted_bam - snp") { + test("sarscov2 paired-end [bam] [snp]") { when { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed') + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) + ] + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) + ] + input[2] = [ + [ id:'test' ], + file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[3] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[4] = BISCUIT_INDEX.out.index """ } } @@ -71,18 +93,28 @@ nextflow_process { } - test("sarscov2 - test_paired_end_methylated_sorted_bam - snp - gz") { + test("sarscov2 paired-end [bam] [snp_gz]") { when { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed.gz') + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) + ] + input[2] = [ + [ id:'test' ], + file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed.gz', checkIfExists: true) + ] + input[3] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[4] = BISCUIT_INDEX.out.index """ } } @@ -96,19 +128,29 @@ nextflow_process { } - test("sarscov2 - test_paired_end_methylated_sorted_bam - snp - gz - stub") { + test("sarscov2 paired-end [bam] [snp_gz] - stub") { options '-stub' when { process { """ input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true), - file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed.gz') + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) + ] + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam.bai', checkIfExists: true) + ] + input[2] = [ + [ id:'test' ], + file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test-snp.bed.gz', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[3] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[4] = BISCUIT_INDEX.out.index """ } } diff --git a/modules/nf-core/biscuit/epiread/tests/main.nf.test.snap b/modules/nf-core/biscuit/epiread/tests/main.nf.test.snap index 1a64679d465..19a1e069912 100644 --- a/modules/nf-core/biscuit/epiread/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/epiread/tests/main.nf.test.snap @@ -1,142 +1,134 @@ { - "sarscov2 - test_paired_end_methylated_sorted_bam - snp - gz": { + "sarscov2 paired-end [bam] [snp_gz]": { "content": [ { "0": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,f2c701470965f9a93c45524e9e460509" + "test.bed.gz:md5,709eeae76ae45a08983e8b45e183dad8" ] ], "1": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ], - "epiread_bed": [ + "bed": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,f2c701470965f9a93c45524e9e460509" + "test.bed.gz:md5,709eeae76ae45a08983e8b45e183dad8" ] ], "versions": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:55:24.162952" + "timestamp": "2024-11-14T08:58:54.313858378" }, - "sarscov2 - test_paired_end_methylated_sorted_bam - snp": { + "sarscov2 paired-end [bam]": { "content": [ { "0": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,f2c701470965f9a93c45524e9e460509" + "test.bed.gz:md5,f75d8fe928fe2dc1a3ce6178d8963602" ] ], "1": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ], - "epiread_bed": [ + "bed": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,f2c701470965f9a93c45524e9e460509" + "test.bed.gz:md5,f75d8fe928fe2dc1a3ce6178d8963602" ] ], "versions": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:55:17.32731" + "timestamp": "2024-11-14T08:58:32.745357698" }, - "sarscov2 - test_paired_end_methylated_sorted_bam": { + "sarscov2 paired-end [bam] [snp]": { "content": [ { "0": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,3f60061464bd1c282bce0dc6478f8738" + "test.bed.gz:md5,709eeae76ae45a08983e8b45e183dad8" ] ], "1": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ], - "epiread_bed": [ + "bed": [ [ { - "id": "test", - "single_end": false + "id": "test" }, - "test.bed.gz:md5,3f60061464bd1c282bce0dc6478f8738" + "test.bed.gz:md5,709eeae76ae45a08983e8b45e183dad8" ] ], "versions": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:55:09.919651" + "timestamp": "2024-11-14T08:58:43.662473332" }, - "sarscov2 - test_paired_end_methylated_sorted_bam - snp - gz - stub": { + "sarscov2 paired-end [bam] [snp_gz] - stub": { "content": [ { "0": [ [ { - "id": "test", - "single_end": false + "id": "test" }, "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "1": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ], - "epiread_bed": [ + "bed": [ [ { - "id": "test", - "single_end": false + "id": "test" }, "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "versions": [ - "versions.yml:md5,aba0dae715c3208d621eff05bfff02d3" + "versions.yml:md5,e8b0e104428b24831e25ae3d6844aaae" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:55:29.932067" + "timestamp": "2024-11-14T08:59:04.687765786" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/index/environment.yml b/modules/nf-core/biscuit/index/environment.yml index 56b7e967693..123215dc20f 100644 --- a/modules/nf-core/biscuit/index/environment.yml +++ b/modules/nf-core/biscuit/index/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 + - bioconda::biscuit=1.5.0.20240506 diff --git a/modules/nf-core/biscuit/index/main.nf b/modules/nf-core/biscuit/index/main.nf index 43566fc4b50..fb5ab0d40c5 100644 --- a/modules/nf-core/biscuit/index/main.nf +++ b/modules/nf-core/biscuit/index/main.nf @@ -4,15 +4,15 @@ process BISCUIT_INDEX { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/biscuit:1.1.0.20220707--he272189_1': - 'biocontainers/biscuit:1.1.0.20220707--he272189_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/33/33a9ca30b4154f11253c8d91a75382065dcb8282ba99b74dbee59ed8faceabd7/data': + 'community.wave.seqera.io/library/biscuit:1.5.0.20240506--ca92d9d0a37b5fa8' }" input: - path fasta, stageAs: "BiscuitIndex/*" + tuple val(meta), path(fasta, name:"BiscuitIndex/") output: - path "BiscuitIndex/*.fa*", emit: index, includeInputs: true - path "versions.yml" , emit: versions + tuple val(meta), path("BiscuitIndex"), emit: index + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -34,7 +34,6 @@ process BISCUIT_INDEX { stub: def args = task.ext.args ?: '' """ - touch ${fasta}.bis.amb touch ${fasta}.bis.ann touch ${fasta}.bis.pac diff --git a/modules/nf-core/biscuit/index/meta.yml b/modules/nf-core/biscuit/index/meta.yml index 39a0bcf8d94..cdf51a8b4d6 100644 --- a/modules/nf-core/biscuit/index/meta.yml +++ b/modules/nf-core/biscuit/index/meta.yml @@ -19,15 +19,24 @@ tools: licence: ["MIT"] identifier: biotools:biscuit input: - - - fasta: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: type: file description: Input genome fasta file output: - index: - - BiscuitIndex/*.fa*: + - meta: type: directory - description: Biscuit genome index directory - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index + pattern: "index" + - BiscuitIndex: + type: directory + description: Directory containing biscuit genome index + pattern: "index" - versions: - versions.yml: type: file @@ -37,3 +46,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/index/tests/main.nf.test b/modules/nf-core/biscuit/index/tests/main.nf.test index 0402a262200..3c99b27bb08 100644 --- a/modules/nf-core/biscuit/index/tests/main.nf.test +++ b/modules/nf-core/biscuit/index/tests/main.nf.test @@ -1,4 +1,3 @@ - nextflow_process { name "Test Process BISCUIT_INDEX" @@ -10,13 +9,15 @@ nextflow_process { tag "biscuit" tag "biscuit/index" - test("test-biscuit-index") { + test("sarscov2 genome [fasta]") { when { process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } @@ -29,14 +30,16 @@ nextflow_process { } } - test("test-biscuit-index-stub") { + test("sarscov2 genome [fasta] - stub") { options '-stub' when { process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) - + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } diff --git a/modules/nf-core/biscuit/index/tests/main.nf.test.snap b/modules/nf-core/biscuit/index/tests/main.nf.test.snap index 698fc7e4bd8..715875012bd 100644 --- a/modules/nf-core/biscuit/index/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/index/tests/main.nf.test.snap @@ -1,84 +1,104 @@ { - "test-biscuit-index": { + "sarscov2 genome [fasta] - stub": { "content": [ { "0": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bis.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", - "genome.fasta.bis.ann:md5,c32e11f6c859f166c7525a9c1d583567", - "genome.fasta.bis.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", - "genome.fasta.dau.bwt:md5,a11bc31775f7b7a4f9cd3bc4f981661a", - "genome.fasta.dau.sa:md5,9c9e07fa1c75ef32d764274579c89b08", - "genome.fasta.par.bwt:md5,62eb83cd557a47b59589713d98024fc2", - "genome.fasta.par.sa:md5,55bcd97d7059bf73dc0d221e36e8e901" + { + "id": "test" + }, + [ + "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", + "genome.fasta.bis.amb:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.bis.ann:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.bis.pac:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.dau.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.dau.sa:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.par.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.par.sa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ] ], "1": [ - "versions.yml:md5,067af0790b982d7524b24ba17e1dece7" + "versions.yml:md5,c451c038f5d41cd7237c5b0f07926ad6" ], "index": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bis.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", - "genome.fasta.bis.ann:md5,c32e11f6c859f166c7525a9c1d583567", - "genome.fasta.bis.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", - "genome.fasta.dau.bwt:md5,a11bc31775f7b7a4f9cd3bc4f981661a", - "genome.fasta.dau.sa:md5,9c9e07fa1c75ef32d764274579c89b08", - "genome.fasta.par.bwt:md5,62eb83cd557a47b59589713d98024fc2", - "genome.fasta.par.sa:md5,55bcd97d7059bf73dc0d221e36e8e901" + { + "id": "test" + }, + [ + "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", + "genome.fasta.bis.amb:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.bis.ann:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.bis.pac:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.dau.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.dau.sa:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.par.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", + "genome.fasta.par.sa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ] ], "versions": [ - "versions.yml:md5,067af0790b982d7524b24ba17e1dece7" + "versions.yml:md5,c451c038f5d41cd7237c5b0f07926ad6" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-28T10:33:50.146795" + "timestamp": "2024-11-13T06:48:54.473235719" }, - "test-biscuit-index-stub": { + "sarscov2 genome [fasta]": { "content": [ { "0": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bis.amb:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.bis.ann:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.bis.pac:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.dau.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.dau.sa:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.par.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.par.sa:md5,d41d8cd98f00b204e9800998ecf8427e" + { + "id": "test" + }, + [ + "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", + "genome.fasta.bis.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.bis.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.bis.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", + "genome.fasta.dau.bwt:md5,a11bc31775f7b7a4f9cd3bc4f981661a", + "genome.fasta.dau.sa:md5,9c9e07fa1c75ef32d764274579c89b08", + "genome.fasta.par.bwt:md5,62eb83cd557a47b59589713d98024fc2", + "genome.fasta.par.sa:md5,55bcd97d7059bf73dc0d221e36e8e901" + ] ] ], "1": [ - "versions.yml:md5,067af0790b982d7524b24ba17e1dece7" + "versions.yml:md5,c451c038f5d41cd7237c5b0f07926ad6" ], "index": [ [ - "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", - "genome.fasta.bis.amb:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.bis.ann:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.bis.pac:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.dau.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.dau.sa:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.par.bwt:md5,d41d8cd98f00b204e9800998ecf8427e", - "genome.fasta.par.sa:md5,d41d8cd98f00b204e9800998ecf8427e" + { + "id": "test" + }, + [ + "genome.fasta:md5,6e9fe4042a72f2345f644f239272b7e6", + "genome.fasta.bis.amb:md5,3a68b8b2287e07dd3f5f95f4344ba76e", + "genome.fasta.bis.ann:md5,c32e11f6c859f166c7525a9c1d583567", + "genome.fasta.bis.pac:md5,983e3d2cd6f36e2546e6d25a0da78d66", + "genome.fasta.dau.bwt:md5,a11bc31775f7b7a4f9cd3bc4f981661a", + "genome.fasta.dau.sa:md5,9c9e07fa1c75ef32d764274579c89b08", + "genome.fasta.par.bwt:md5,62eb83cd557a47b59589713d98024fc2", + "genome.fasta.par.sa:md5,55bcd97d7059bf73dc0d221e36e8e901" + ] ] ], "versions": [ - "versions.yml:md5,067af0790b982d7524b24ba17e1dece7" + "versions.yml:md5,c451c038f5d41cd7237c5b0f07926ad6" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T10:49:18.069711" + "timestamp": "2024-11-13T06:48:44.596263127" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/mergecg/environment.yml b/modules/nf-core/biscuit/mergecg/environment.yml index b4bab59944c..222c156ed9a 100644 --- a/modules/nf-core/biscuit/mergecg/environment.yml +++ b/modules/nf-core/biscuit/mergecg/environment.yml @@ -2,5 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 - - bioconda::samtools=1.16.1 + - bioconda::biscuit=1.5.0.20240506 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/mergecg/main.nf b/modules/nf-core/biscuit/mergecg/main.nf index 93094b2a6cd..14efa0b7d81 100644 --- a/modules/nf-core/biscuit/mergecg/main.nf +++ b/modules/nf-core/biscuit/mergecg/main.nf @@ -4,16 +4,17 @@ process BISCUIT_MERGECG { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data': + 'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }" input: tuple val(meta), path(bed) - path index + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: - tuple val(meta), path("*.bed.gz"), emit: mergecg_bed + tuple val(meta), path("*.bed.gz"), emit: bed path "versions.yml" , emit: versions when: @@ -24,16 +25,14 @@ process BISCUIT_MERGECG { def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit mergecg \\ $args \\ - \$INDEX \\ - $bed | \\ - LC_ALL=C sort -k1,1 -k2,2n | \\ - bgzip \\ - $args2 \\ - -c > ${prefix}.bed.gz + $index/$fasta\\ + $bed \\ + | LC_ALL=C sort -k1,1 -k2,2n \\ + | bgzip $args2 -c > ${prefix}.bed.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/biscuit/mergecg/meta.yml b/modules/nf-core/biscuit/mergecg/meta.yml index 2084f43b9d6..29b0889a4a1 100644 --- a/modules/nf-core/biscuit/mergecg/meta.yml +++ b/modules/nf-core/biscuit/mergecg/meta.yml @@ -27,12 +27,24 @@ input: type: file description: | Biscuit BED file (output of biscuit vcf2bed) - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - - mergecg_bed: + - bed: - meta: type: map description: | @@ -51,3 +63,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/mergecg/tests/main.nf.test b/modules/nf-core/biscuit/mergecg/tests/main.nf.test index 0b593f76842..cfa29b719d9 100644 --- a/modules/nf-core/biscuit/mergecg/tests/main.nf.test +++ b/modules/nf-core/biscuit/mergecg/tests/main.nf.test @@ -9,27 +9,34 @@ nextflow_process { tag "biscuit/index" tag "biscuit/mergecg" - test("sars_cov_bed") { - - setup { + setup { run("BISCUIT_INDEX") { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } + + test("sarscov2 cov [bed]") { + when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + "delete_me/biscuit/test-cg.bed.gz", checkIfExists: true) - ] - - input[1] = BISCUIT_INDEX.out.index + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -43,27 +50,21 @@ nextflow_process { } - test("sars_cov_bed -stub") { + test("sarscov2 cov [bed] - stub") { options "-stub" - setup { - run("BISCUIT_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = file(params.modules_testdata_base_path + "genomics/sarscov2/genome/genome.fasta", checkIfExists: true) - """ - } - } - } + when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + "delete_me/biscuit/test-cg.bed.gz", checkIfExists: true) - ] - - input[1] = BISCUIT_INDEX.out.index + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } diff --git a/modules/nf-core/biscuit/mergecg/tests/main.nf.test.snap b/modules/nf-core/biscuit/mergecg/tests/main.nf.test.snap index 148a1f947bd..f003dee7b8d 100644 --- a/modules/nf-core/biscuit/mergecg/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/mergecg/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "sars_cov_bed": { + "sarscov2 cov [bed] - stub": { "content": [ { "0": [ @@ -8,33 +8,33 @@ "id": "test", "single_end": false }, - "test.bed.gz:md5,8136632b0c17c61857a302a57ae302ef" + "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "1": [ - "versions.yml:md5,caa3e8096399d35c725d7e2d430605c9" + "versions.yml:md5,4b2f3877d68071eafa0b0ec3e37c58a3" ], - "mergecg_bed": [ + "bed": [ [ { "id": "test", "single_end": false }, - "test.bed.gz:md5,8136632b0c17c61857a302a57ae302ef" + "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" ] ], "versions": [ - "versions.yml:md5,caa3e8096399d35c725d7e2d430605c9" + "versions.yml:md5,4b2f3877d68071eafa0b0ec3e37c58a3" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-11T17:31:48.698330905" + "timestamp": "2024-11-14T09:09:45.257367761" }, - "sars_cov_bed -stub": { + "sarscov2 cov [bed]": { "content": [ { "0": [ @@ -43,30 +43,30 @@ "id": "test", "single_end": false }, - "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.bed.gz:md5,8136632b0c17c61857a302a57ae302ef" ] ], "1": [ - "versions.yml:md5,caa3e8096399d35c725d7e2d430605c9" + "versions.yml:md5,4b2f3877d68071eafa0b0ec3e37c58a3" ], - "mergecg_bed": [ + "bed": [ [ { "id": "test", "single_end": false }, - "test.bed.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + "test.bed.gz:md5,8136632b0c17c61857a302a57ae302ef" ] ], "versions": [ - "versions.yml:md5,caa3e8096399d35c725d7e2d430605c9" + "versions.yml:md5,4b2f3877d68071eafa0b0ec3e37c58a3" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.2" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-06-12T09:59:25.605969084" + "timestamp": "2024-11-14T09:09:30.544664794" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/mergecg/tests/tags.yml b/modules/nf-core/biscuit/mergecg/tests/tags.yml deleted file mode 100644 index d7140b07550..00000000000 --- a/modules/nf-core/biscuit/mergecg/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -biscuit/mergecg: - - "modules/nf-core/biscuit/mergecg/**" diff --git a/modules/nf-core/biscuit/pileup/environment.yml b/modules/nf-core/biscuit/pileup/environment.yml index b4bab59944c..222c156ed9a 100644 --- a/modules/nf-core/biscuit/pileup/environment.yml +++ b/modules/nf-core/biscuit/pileup/environment.yml @@ -2,5 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 - - bioconda::samtools=1.16.1 + - bioconda::biscuit=1.5.0.20240506 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/pileup/main.nf b/modules/nf-core/biscuit/pileup/main.nf index dbbd6ffa2d5..db51aae2c09 100644 --- a/modules/nf-core/biscuit/pileup/main.nf +++ b/modules/nf-core/biscuit/pileup/main.nf @@ -4,12 +4,13 @@ process BISCUIT_PILEUP { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data': + 'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }" input: tuple val(meta), path(normal_bams), path(normal_bais), path(tumor_bam), path(tumor_bai) - path index + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: tuple val(meta), path("*.vcf.gz"), emit: vcf @@ -22,18 +23,18 @@ process BISCUIT_PILEUP { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def biscuit_cpus = (int) Math.max(Math.floor(task.cpus*0.9),1) - def bgzip_cpus = task.cpus-biscuit_cpus + def biscuit_cpus = [(task.cpus * 0.9) as int, 1].max() + def bgzip_cpus = (task.cpus - biscuit_cpus < 1) ? biscuit_cpus : (task.cpus - biscuit_cpus) if ( tumor_bam != [] && normal_bams.toList().size() > 1 ) error "[BISCUIT_PILEUP] error: Tumor BAM provided with more than one normal BAM" if ( tumor_bam.toList().size() > 1 ) error "[BISCUIT_PILEUP] error: more than one tumor BAM provided" input = ( tumor_bam==[] ) ? "${normal_bams}" : "-S -T ${tumor_bam} -I ${normal_bams}" """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit pileup \\ -@ $biscuit_cpus \\ $args \\ - \$INDEX \\ + $index/$fasta \\ $input \\ | bgzip -@ $bgzip_cpus $args2 > ${prefix}.vcf.gz diff --git a/modules/nf-core/biscuit/pileup/meta.yml b/modules/nf-core/biscuit/pileup/meta.yml index 9f532797e43..0ab31cc549b 100644 --- a/modules/nf-core/biscuit/pileup/meta.yml +++ b/modules/nf-core/biscuit/pileup/meta.yml @@ -47,10 +47,22 @@ input: type: file description: Optional. BAM index file corresponding to provided tumor_bam pattern: "*.{bai}" - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: type: directory - description: Biscuit genome index directory (generated with 'biscuit index') - pattern: "BiscuitIndex" + description: Directory containing biscuit genome index output: - vcf: - meta: @@ -71,3 +83,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/pileup/tests/main.nf.test b/modules/nf-core/biscuit/pileup/tests/main.nf.test index b188103a06f..74ebff4d271 100644 --- a/modules/nf-core/biscuit/pileup/tests/main.nf.test +++ b/modules/nf-core/biscuit/pileup/tests/main.nf.test @@ -15,18 +15,21 @@ nextflow_process { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("homo_sapiens - test_paired_end_sorted_bam") { + test("homo_sapiens - paired-end [bam]") { when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test' ], // meta map [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), @@ -38,9 +41,12 @@ nextflow_process { ], [], // tumor bam [] // tumor bai - ] - - input[1] = BISCUIT_INDEX.out.index + ]) + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -58,7 +64,7 @@ nextflow_process { } - test("homo_sapiens - test_paired_end_sorted_bam - somatic") { + test("homo_sapiens - paired-end [bam] - somatic") { when { process { @@ -70,8 +76,11 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam.bai', checkIfExists: true) ] - - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -89,7 +98,7 @@ nextflow_process { } - test("homo_sapiens - test_paired_end_sorted_bam - somatic - stub") { + test("homo_sapiens - paired-end [bam] - somatic - stub") { options '-stub' when { @@ -102,8 +111,11 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam', checkIfExists: true), file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test2.paired_end.sorted.bam.bai', checkIfExists: true) ] - - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } diff --git a/modules/nf-core/biscuit/pileup/tests/main.nf.test.snap b/modules/nf-core/biscuit/pileup/tests/main.nf.test.snap index ca99df65997..14c40aa1a4d 100644 --- a/modules/nf-core/biscuit/pileup/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/pileup/tests/main.nf.test.snap @@ -1,31 +1,5 @@ { - "homo_sapiens - test_paired_end_sorted_bam - somatic": { - "content": [ - "12357b78693a704403196644b34d69a6", - [ - "versions.yml:md5,d73c753b5bbc7439f06fba6c1794f719" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-08-29T11:43:13.955407" - }, - "homo_sapiens - test_paired_end_sorted_bam": { - "content": [ - "4ae9e1f5d3dbe07aca279680840bbe20", - [ - "versions.yml:md5,d73c753b5bbc7439f06fba6c1794f719" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" - }, - "timestamp": "2024-08-29T11:41:00.666921" - }, - "homo_sapiens - test_paired_end_sorted_bam - somatic - stub": { + "homo_sapiens - paired-end [bam] - somatic - stub": { "content": [ { "0": [ @@ -37,7 +11,7 @@ ] ], "1": [ - "versions.yml:md5,d73c753b5bbc7439f06fba6c1794f719" + "versions.yml:md5,beff27f24fc9327d67f5968cf1cef6cd" ], "vcf": [ [ @@ -48,14 +22,40 @@ ] ], "versions": [ - "versions.yml:md5,d73c753b5bbc7439f06fba6c1794f719" + "versions.yml:md5,beff27f24fc9327d67f5968cf1cef6cd" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-14T09:24:21.352967241" + }, + "homo_sapiens - paired-end [bam] - somatic": { + "content": [ + "5e1157703410c1a6b7cc7eded1436425", + [ + "versions.yml:md5,beff27f24fc9327d67f5968cf1cef6cd" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-14T09:27:58.885274336" + }, + "homo_sapiens - paired-end [bam]": { + "content": [ + "6bea182d0b89d10246cc0ac711f6507", + [ + "versions.yml:md5,beff27f24fc9327d67f5968cf1cef6cd" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:43:19.616012" + "timestamp": "2024-11-14T09:27:47.811858126" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/qc/environment.yml b/modules/nf-core/biscuit/qc/environment.yml index 56b7e967693..123215dc20f 100644 --- a/modules/nf-core/biscuit/qc/environment.yml +++ b/modules/nf-core/biscuit/qc/environment.yml @@ -2,4 +2,4 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 + - bioconda::biscuit=1.5.0.20240506 diff --git a/modules/nf-core/biscuit/qc/main.nf b/modules/nf-core/biscuit/qc/main.nf index 0ac7bd9eeab..4e63292ebd9 100644 --- a/modules/nf-core/biscuit/qc/main.nf +++ b/modules/nf-core/biscuit/qc/main.nf @@ -4,15 +4,16 @@ process BISCUIT_QC { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/biscuit:1.1.0.20220707--he272189_1': - 'biocontainers/biscuit:1.1.0.20220707--he272189_1' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/33/33a9ca30b4154f11253c8d91a75382065dcb8282ba99b74dbee59ed8faceabd7/data': + 'community.wave.seqera.io/library/biscuit:1.5.0.20240506--ca92d9d0a37b5fa8' }" input: tuple val(meta), path(bam) - path(index) + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) output: - tuple val(meta), path("*.txt"), emit: biscuit_qc_reports + tuple val(meta), path("*.txt"), emit: reports path "versions.yml" , emit: versions when: @@ -23,12 +24,12 @@ process BISCUIT_QC { def prefix = task.ext.prefix ?: "${meta.id}" def se = meta.single_end ? "-s" : "" """ - INDEX=`find -L ./ -name "*.bis.amb" | sed 's/\\.bis.amb\$//'` + ln -sf \$(readlink $fasta) $index/$fasta biscuit qc \\ $args \\ $se \\ - \$INDEX \\ + $index/$fasta \\ $bam \\ $prefix diff --git a/modules/nf-core/biscuit/qc/meta.yml b/modules/nf-core/biscuit/qc/meta.yml index ab7500ba823..379f46bbf3e 100644 --- a/modules/nf-core/biscuit/qc/meta.yml +++ b/modules/nf-core/biscuit/qc/meta.yml @@ -27,11 +27,24 @@ input: - bam: type: file description: BAM file produced using Biscuit - - - index: + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: type: file - description: index file + description: Input genome fasta file + - - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - index: + type: directory + description: Directory containing biscuit genome index output: - - biscuit_qc_reports: + - reports: - meta: type: file description: | @@ -65,3 +78,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/qc/tests/main.nf.test b/modules/nf-core/biscuit/qc/tests/main.nf.test index d4b4e57ad47..24d0dc23729 100644 --- a/modules/nf-core/biscuit/qc/tests/main.nf.test +++ b/modules/nf-core/biscuit/qc/tests/main.nf.test @@ -15,13 +15,16 @@ nextflow_process { script "../../index/main.nf" process { """ - input[0] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) """ } } } - test("sarscov2 - test_paired_end_methylated_sorted_bam") { + test("sarscov2 paired-end [bam]") { when { process { @@ -30,7 +33,11 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } @@ -44,7 +51,7 @@ nextflow_process { } - test("sarscov2 - test_paired_end_methylated_sorted_bam - stub") { + test("sarscov2 paired-end [bam] - stub") { options '-stub' when { @@ -54,7 +61,11 @@ nextflow_process { [ id:'test', single_end:false ], // meta map file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.methylated.sorted.bam', checkIfExists: true) ] - input[1] = BISCUIT_INDEX.out.index + input[1] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ]) + input[2] = BISCUIT_INDEX.out.index """ } } diff --git a/modules/nf-core/biscuit/qc/tests/main.nf.test.snap b/modules/nf-core/biscuit/qc/tests/main.nf.test.snap index 51c995d9e5b..4c5deb3fd8d 100644 --- a/modules/nf-core/biscuit/qc/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/qc/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "sarscov2 - test_paired_end_methylated_sorted_bam": { + "sarscov2 paired-end [bam]": { "content": [ { "0": [ @@ -20,9 +20,9 @@ ] ], "1": [ - "versions.yml:md5,c9bca700bf29bd9d02fc254fe070e279" + "versions.yml:md5,15148723e4f43101b9e07a02566dbbd4" ], - "biscuit_qc_reports": [ + "reports": [ [ { "id": "test", @@ -40,17 +40,17 @@ ] ], "versions": [ - "versions.yml:md5,c9bca700bf29bd9d02fc254fe070e279" + "versions.yml:md5,15148723e4f43101b9e07a02566dbbd4" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:27:13.208945" + "timestamp": "2024-11-14T09:49:31.146030396" }, - "sarscov2 - test_paired_end_methylated_sorted_bam - stub": { + "sarscov2 paired-end [bam] - stub": { "content": [ { "0": [ @@ -71,9 +71,9 @@ ] ], "1": [ - "versions.yml:md5,c9bca700bf29bd9d02fc254fe070e279" + "versions.yml:md5,15148723e4f43101b9e07a02566dbbd4" ], - "biscuit_qc_reports": [ + "reports": [ [ { "id": "test", @@ -91,14 +91,14 @@ ] ], "versions": [ - "versions.yml:md5,c9bca700bf29bd9d02fc254fe070e279" + "versions.yml:md5,15148723e4f43101b9e07a02566dbbd4" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:30:49.37928" + "timestamp": "2024-11-14T09:49:41.278929227" } } \ No newline at end of file diff --git a/modules/nf-core/biscuit/vcf2bed/environment.yml b/modules/nf-core/biscuit/vcf2bed/environment.yml index b4bab59944c..222c156ed9a 100644 --- a/modules/nf-core/biscuit/vcf2bed/environment.yml +++ b/modules/nf-core/biscuit/vcf2bed/environment.yml @@ -2,5 +2,5 @@ channels: - conda-forge - bioconda dependencies: - - bioconda::biscuit=1.1.0.20220707 - - bioconda::samtools=1.16.1 + - bioconda::biscuit=1.5.0.20240506 + - bioconda::samtools=1.21 diff --git a/modules/nf-core/biscuit/vcf2bed/main.nf b/modules/nf-core/biscuit/vcf2bed/main.nf index f2ba512ef63..d53c8ee342b 100644 --- a/modules/nf-core/biscuit/vcf2bed/main.nf +++ b/modules/nf-core/biscuit/vcf2bed/main.nf @@ -4,8 +4,8 @@ process BISCUIT_VCF2BED { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0': - 'biocontainers/mulled-v2-d94f582b04a3edcede1215189c0d881506640fd9:6519548ea4f3d6a526c78ad0350c58f867f28574-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/5b/5b542bbe1f99afd494ef07423ea8b52f2b8a081b85f92db2726c283c78da3cf0/data': + 'community.wave.seqera.io/library/biscuit_samtools:84373c8a97fa63b8' }" input: tuple val(meta), path(vcf) @@ -24,11 +24,9 @@ process BISCUIT_VCF2BED { """ biscuit vcf2bed \\ $args \\ - $vcf | \\ - LC_ALL=C sort -k1,1 -k2,2n | \\ - bgzip \\ - $args2 \\ - -c > ${prefix}.bed.gz + $vcf \\ + | LC_ALL=C sort -k1,1 -k2,2n \\ + | bgzip $args2 -c > ${prefix}.bed.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/biscuit/vcf2bed/meta.yml b/modules/nf-core/biscuit/vcf2bed/meta.yml index 76ee1cad11c..b50fa56d44a 100644 --- a/modules/nf-core/biscuit/vcf2bed/meta.yml +++ b/modules/nf-core/biscuit/vcf2bed/meta.yml @@ -48,3 +48,4 @@ authors: - "@njspix" maintainers: - "@njspix" + - "@sateeshperi" diff --git a/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test b/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test index 527f0c0ff4f..b9097a07e02 100644 --- a/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test +++ b/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test @@ -10,16 +10,15 @@ nextflow_process { tag "biscuit" tag "biscuit/vcf2bed" - test("test-biscuit-vcf2bed") { + test("test [vcf]") { when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test.vcf.gz', checkIfExists: true) - ] - + ]) """ } } @@ -32,17 +31,16 @@ nextflow_process { } } - test("test-biscuit-vcf2bed-stub") { + test("test [vcf] - stub") { options '-stub' when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/biscuit/test.vcf.gz', checkIfExists: true) - ] - + ]) """ } } diff --git a/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test.snap b/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test.snap index fd232298b85..816bd1cceaa 100644 --- a/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test.snap +++ b/modules/nf-core/biscuit/vcf2bed/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "test-biscuit-vcf2bed": { + "test [vcf]": { "content": [ { "0": [ @@ -12,7 +12,7 @@ ] ], "1": [ - "versions.yml:md5,8626f51de333380e99cc607aaebb2cce" + "versions.yml:md5,54a906013b2703ac5c5250af2a996259" ], "bed": [ [ @@ -24,17 +24,17 @@ ] ], "versions": [ - "versions.yml:md5,8626f51de333380e99cc607aaebb2cce" + "versions.yml:md5,54a906013b2703ac5c5250af2a996259" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:02:38.571195" + "timestamp": "2024-11-14T09:55:25.366750014" }, - "test-biscuit-vcf2bed-stub": { + "test [vcf] - stub": { "content": [ { "0": [ @@ -47,7 +47,7 @@ ] ], "1": [ - "versions.yml:md5,8626f51de333380e99cc607aaebb2cce" + "versions.yml:md5,54a906013b2703ac5c5250af2a996259" ], "bed": [ [ @@ -59,14 +59,14 @@ ] ], "versions": [ - "versions.yml:md5,8626f51de333380e99cc607aaebb2cce" + "versions.yml:md5,54a906013b2703ac5c5250af2a996259" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.04.4" + "nf-test": "0.9.2", + "nextflow": "24.10.0" }, - "timestamp": "2024-08-29T11:02:43.49219" + "timestamp": "2024-11-14T09:55:34.060320551" } } \ No newline at end of file From 3ef36024bb95d306c63c7bf9014132e62c7b4755 Mon Sep 17 00:00:00 2001 From: Evangelos Karatzas <32259775+vagkaratzas@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:03:39 +0200 Subject: [PATCH 87/87] clipkit - new module (#6993) * clipkit - new module * standard prefix.clipkit output + better meta description for the alignment file --- modules/nf-core/clipkit/environment.yml | 7 ++ modules/nf-core/clipkit/main.nf | 46 +++++++++++++ modules/nf-core/clipkit/meta.yml | 50 ++++++++++++++ modules/nf-core/clipkit/tests/main.nf.test | 66 ++++++++++++++++++ .../nf-core/clipkit/tests/main.nf.test.snap | 68 +++++++++++++++++++ 5 files changed, 237 insertions(+) create mode 100644 modules/nf-core/clipkit/environment.yml create mode 100644 modules/nf-core/clipkit/main.nf create mode 100644 modules/nf-core/clipkit/meta.yml create mode 100644 modules/nf-core/clipkit/tests/main.nf.test create mode 100644 modules/nf-core/clipkit/tests/main.nf.test.snap diff --git a/modules/nf-core/clipkit/environment.yml b/modules/nf-core/clipkit/environment.yml new file mode 100644 index 00000000000..65c451ffb1f --- /dev/null +++ b/modules/nf-core/clipkit/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::clipkit=2.3.0" diff --git a/modules/nf-core/clipkit/main.nf b/modules/nf-core/clipkit/main.nf new file mode 100644 index 00000000000..2a9ebe3f851 --- /dev/null +++ b/modules/nf-core/clipkit/main.nf @@ -0,0 +1,46 @@ +process CLIPKIT { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/clipkit:2.3.0--pyhdfd78af_0': + 'biocontainers/clipkit:2.3.0--pyhdfd78af_0' }" + + input: + tuple val(meta), path(aln) + + output: + tuple val(meta), path("*.clipkit"), emit: clipkit + 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}" + """ + clipkit \\ + $args \\ + $aln \\ + -o ${prefix}.clipkit + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + clipkit: \$(clipkit --version |& sed '1!d ; s/clipkit //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.clipkit + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + clipkit: \$(clipkit --version |& sed '1!d ; s/clipkit //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/clipkit/meta.yml b/modules/nf-core/clipkit/meta.yml new file mode 100644 index 00000000000..5347ad5923a --- /dev/null +++ b/modules/nf-core/clipkit/meta.yml @@ -0,0 +1,50 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "clipkit" +description: ClipKIT is a fast and flexible alignment trimming tool that keeps phylogenetically informative sites and removes those that display characteristics poor phylogenetic signal. +keywords: + - sort + - example + - genomics +tools: + - "clipkit": + description: "Alignment trimming software for phylogenetics." + homepage: "https://jlsteenwyk.com/ClipKIT/" + documentation: "https://jlsteenwyk.com/ClipKIT/" + tool_dev_url: "https://github.com/JLSteenwyk/ClipKIT" + doi: "10.1371/journal.pbio.3001007" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - aln: + type: file + description: Multiple sequence alignment file in various supported formats. + pattern: "*.{fa,fasta,fa,fna,faa,alnfaa,aln,sto,stk,mauve,alignment,clustal}" + +output: + - clipkit: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.clipkit": + type: file + description: Trimmed multiple sequence alignment file + pattern: "*.clipkit" + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@vagkaratzas" +maintainers: + - "@vagkaratzas" diff --git a/modules/nf-core/clipkit/tests/main.nf.test b/modules/nf-core/clipkit/tests/main.nf.test new file mode 100644 index 00000000000..46cc8a00716 --- /dev/null +++ b/modules/nf-core/clipkit/tests/main.nf.test @@ -0,0 +1,66 @@ +nextflow_process { + + name "Test Process CLIPKIT" + script "../main.nf" + process "CLIPKIT" + + tag "modules" + tag "modules_nfcore" + tag "clipkit" + tag "gunzip" + + setup { + run("GUNZIP") { + script "../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id:'PF14720' ], // meta map + file(params.modules_testdata_base_path + 'delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) + ] + """ + } + } + } + + test("PF14720 - aln") { + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("PF14720 - aln - stub") { + + options "-stub" + + when { + process { + """ + input[0] = GUNZIP.out.gunzip + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/clipkit/tests/main.nf.test.snap b/modules/nf-core/clipkit/tests/main.nf.test.snap new file mode 100644 index 00000000000..55f837d9e52 --- /dev/null +++ b/modules/nf-core/clipkit/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "PF14720 - aln - stub": { + "content": [ + { + "0": [ + [ + { + "id": "PF14720" + }, + "PF14720.clipkit:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,1eaf2dc589bc08c1e37cbbddbedfcc80" + ], + "clipkit": [ + [ + { + "id": "PF14720" + }, + "PF14720.clipkit:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,1eaf2dc589bc08c1e37cbbddbedfcc80" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "23.04.5" + }, + "timestamp": "2024-11-14T13:11:21.109400968" + }, + "PF14720 - aln": { + "content": [ + { + "0": [ + [ + { + "id": "PF14720" + }, + "PF14720.clipkit:md5,97e4328b5990f5e5a6241c225ed6d922" + ] + ], + "1": [ + "versions.yml:md5,1eaf2dc589bc08c1e37cbbddbedfcc80" + ], + "clipkit": [ + [ + { + "id": "PF14720" + }, + "PF14720.clipkit:md5,97e4328b5990f5e5a6241c225ed6d922" + ] + ], + "versions": [ + "versions.yml:md5,1eaf2dc589bc08c1e37cbbddbedfcc80" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "23.04.5" + }, + "timestamp": "2024-11-14T13:11:14.278212183" + } +} \ No newline at end of file