From cede72a367150268ecd1f8470b26ef6fb4e65466 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 12:08:44 -0400 Subject: [PATCH 01/10] feat: khmer/uniquekmers module w/ stubs --- modules/CCBR/khmer/uniquekmers/main.nf | 48 +++++++++++++++++++ modules/CCBR/khmer/uniquekmers/meta.yml | 42 ++++++++++++++++ tests/modules/CCBR/khmer/uniquekmers/main.nf | 12 +++++ .../CCBR/khmer/uniquekmers/nextflow.config | 5 ++ tests/modules/CCBR/khmer/uniquekmers/test.yml | 10 ++++ 5 files changed, 117 insertions(+) create mode 100644 modules/CCBR/khmer/uniquekmers/main.nf create mode 100644 modules/CCBR/khmer/uniquekmers/meta.yml create mode 100644 tests/modules/CCBR/khmer/uniquekmers/main.nf create mode 100644 tests/modules/CCBR/khmer/uniquekmers/nextflow.config create mode 100644 tests/modules/CCBR/khmer/uniquekmers/test.yml diff --git a/modules/CCBR/khmer/uniquekmers/main.nf b/modules/CCBR/khmer/uniquekmers/main.nf new file mode 100644 index 0000000..fca4d5c --- /dev/null +++ b/modules/CCBR/khmer/uniquekmers/main.nf @@ -0,0 +1,48 @@ +process KHMER_UNIQUEKMERS { + tag "$fasta" + label 'process_low' + + conda "bioconda::khmer=3.0.0a3" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/khmer:3.0.0a3--py37haa7609a_2' : + 'biocontainers/khmer:3.0.0a3--py37haa7609a_2' }" + + input: + path fasta + val kmer_size + + output: + path "report.txt" , emit: report + path "kmers.txt" , emit: kmers + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + """ + unique-kmers.py \\ + -k $kmer_size \\ + -R report.txt \\ + $args \\ + $fasta + + grep ^number report.txt | sed 's/^.*:.[[:blank:]]//g' > kmers.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + khmer: \$( unique-kmers.py --version 2>&1 | grep ^khmer | sed 's/^khmer //;s/ .*\$//' ) + END_VERSIONS + """ + + stub: + """ + touch report.txt khmers.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + khmer: \$( unique-kmers.py --version 2>&1 | grep ^khmer | sed 's/^khmer //;s/ .*\$//' ) + END_VERSIONS + """ +} diff --git a/modules/CCBR/khmer/uniquekmers/meta.yml b/modules/CCBR/khmer/uniquekmers/meta.yml new file mode 100644 index 0000000..5ffb451 --- /dev/null +++ b/modules/CCBR/khmer/uniquekmers/meta.yml @@ -0,0 +1,42 @@ +name: "khmer_uniquekmers" +description: In-memory nucleotide sequence k-mer counting, filtering, graph traversal and more. Adapted from nf-core/modules khmer/uniquekhmers. +keywords: + - khmer + - k-mer + - effective genome size + +tools: + - "khmer": + description: khmer k-mer counting library + homepage: https://github.com/dib-lab/khmer + documentation: https://khmer.readthedocs.io/en/latest/ + tool_dev_url: https://github.com/dib-lab/khmer + doi: "10.12688/f1000research.6924.1" + licence: ["BSD License"] + +input: + - fasta: + type: file + description: fasta file + pattern: "*.{fa,fasta}" + - kmer_size: + type: value + description: k-mer size to use + pattern: "[0-9]+" + +output: + - report: + type: file + description: Text file containing unique-kmers.py execution report + pattern: "report.txt" + - kmers: + type: file + description: Text file containing number of kmers + pattern: "kmers.txt" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@kelly-sovacool" diff --git a/tests/modules/CCBR/khmer/uniquekmers/main.nf b/tests/modules/CCBR/khmer/uniquekmers/main.nf new file mode 100644 index 0000000..4dae054 --- /dev/null +++ b/tests/modules/CCBR/khmer/uniquekmers/main.nf @@ -0,0 +1,12 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { KHMER_UNIQUEKMERS } from '../../../../../modules/nf-core/khmer/uniquekmers/main.nf' + +workflow test_khmer_uniquekmers { + + input = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + KHMER_UNIQUEKMERS ( input, 50 ) +} diff --git a/tests/modules/CCBR/khmer/uniquekmers/nextflow.config b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config new file mode 100644 index 0000000..8730f1c --- /dev/null +++ b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/modules/CCBR/khmer/uniquekmers/test.yml b/tests/modules/CCBR/khmer/uniquekmers/test.yml new file mode 100644 index 0000000..ff5b12c --- /dev/null +++ b/tests/modules/CCBR/khmer/uniquekmers/test.yml @@ -0,0 +1,10 @@ +- name: khmer uniquekmers test_khmer_uniquekmers + command: nextflow run ./tests/modules/nf-core/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/khmer/uniquekmers/nextflow.config + tags: + - khmer + - khmer/uniquekmers + files: + - path: output/khmer/kmers.txt + md5sum: 496ebf23653a01c7a42d743e47c19f65 + - path: output/khmer/report.txt + md5sum: ee489abd3b244dea3640649e1790d55e From aba489a356b45149952923dd17700557d05fcce6 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 12:19:02 -0400 Subject: [PATCH 02/10] docs: link to original khmer module --- CHANGELOG.md | 3 ++- README.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e3630c..b94fd13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## development version - new modules: - - cutadapt - bwa/index - bwa/mem + - cutadapt + - khmer/uniquekmers diff --git a/README.md b/README.md index b007c64..cb9b173 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,6 @@ Want to **contribute** to this project? Check out the [contributing guidelines]( Many of the modules and subworkflows in this project reuse and adapt code from [nf-core/modules](https://github.com/nf-core/modules). In those cases, credit is noted in the `meta.yml` file of the module/subworkflow and also listed here: +- [bwa](modules/CCBR/bwa) adapts the [nf-core bwa module](https://github.com/nf-core/chipseq/tree/51eba00b32885c4d0bec60db3cb0a45eb61e34c5/modules/nf-core/modules/bwa) - [cutadapt](modules/CCBR/cutadapt) adapts the [nf-core cutadapt module](https://github.com/nf-core/modules/tree/master/modules/nf-core/cutadapt) -- [bwa_mem](modules/CCBR/bwa/mem) adapts the [nf-core bwa mem module](https://github.com/nf-core/chipseq/tree/51eba00b32885c4d0bec60db3cb0a45eb61e34c5/modules/nf-core/modules/bwa/mem) -- [bwa_index](modules/CCBR/bwa/index) adapts the [nf-core bwa index module](https://github.com/nf-core/chipseq/tree/51eba00b32885c4d0bec60db3cb0a45eb61e34c5/modules/nf-core/modules/bwa/index) +- [khmer](modules/CCBR/khmer) adapts the [nf-core khmer module](https://github.com/nf-core/modules/tree/b48a1efc8e067502e1a9bafbac788c1e0abdfc6a/modules/nf-core/khmer) From 8a7ba9bfc875f8845f379f60e8718f6c04571072 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 12:24:22 -0400 Subject: [PATCH 03/10] test: add khmer to tests/config/pytest_modules.yml --- tests/config/pytest_modules.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index f079ab3..cd8d2ca 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -9,3 +9,7 @@ bwa/mem: cutadapt: - modules/CCBR/cutadapt/** - tests/modules/CCBR/cutadapt/** + +khmer: + - modules/CCBR/khmer/** + - tests/CCBR/khmer/** From aec48bb7122c177f5fec9f48f1d11ab751fe3898 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 12:58:58 -0400 Subject: [PATCH 04/10] fix: repo name --- tests/modules/CCBR/khmer/uniquekmers/main.nf | 2 +- tests/modules/CCBR/khmer/uniquekmers/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/CCBR/khmer/uniquekmers/main.nf b/tests/modules/CCBR/khmer/uniquekmers/main.nf index 4dae054..0a47792 100644 --- a/tests/modules/CCBR/khmer/uniquekmers/main.nf +++ b/tests/modules/CCBR/khmer/uniquekmers/main.nf @@ -2,7 +2,7 @@ nextflow.enable.dsl = 2 -include { KHMER_UNIQUEKMERS } from '../../../../../modules/nf-core/khmer/uniquekmers/main.nf' +include { KHMER_UNIQUEKMERS } from '../../../../../modules/CCBR/khmer/uniquekmers/main.nf' workflow test_khmer_uniquekmers { diff --git a/tests/modules/CCBR/khmer/uniquekmers/test.yml b/tests/modules/CCBR/khmer/uniquekmers/test.yml index ff5b12c..6f5216a 100644 --- a/tests/modules/CCBR/khmer/uniquekmers/test.yml +++ b/tests/modules/CCBR/khmer/uniquekmers/test.yml @@ -1,5 +1,5 @@ - name: khmer uniquekmers test_khmer_uniquekmers - command: nextflow run ./tests/modules/nf-core/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/khmer/uniquekmers/nextflow.config + command: nextflow run ./tests/modules/CCBR/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/khmer/uniquekmers/nextflow.config tags: - khmer - khmer/uniquekmers From ed2a90f230cb2a9a8094d6a1133269176aaf4ad1 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 12:59:13 -0400 Subject: [PATCH 05/10] fix: khmer needs quay.io registry --- tests/modules/CCBR/khmer/uniquekmers/nextflow.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/modules/CCBR/khmer/uniquekmers/nextflow.config b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config index 8730f1c..f617d41 100644 --- a/tests/modules/CCBR/khmer/uniquekmers/nextflow.config +++ b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config @@ -3,3 +3,5 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } } + +docker.registry = 'quay.io' From 3e6cc92fa14ef8512dd1436c5a7eee350e0f7b72 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 14:06:28 -0400 Subject: [PATCH 06/10] fix: switch to ccbr custom container --- modules/CCBR/khmer/uniquekmers/main.nf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/CCBR/khmer/uniquekmers/main.nf b/modules/CCBR/khmer/uniquekmers/main.nf index fca4d5c..f8b53e5 100644 --- a/modules/CCBR/khmer/uniquekmers/main.nf +++ b/modules/CCBR/khmer/uniquekmers/main.nf @@ -2,10 +2,7 @@ process KHMER_UNIQUEKMERS { tag "$fasta" label 'process_low' - conda "bioconda::khmer=3.0.0a3" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/khmer:3.0.0a3--py37haa7609a_2' : - 'biocontainers/khmer:3.0.0a3--py37haa7609a_2' }" + container 'nciccbr/ccbr_khmer_3.0.0:v1' input: path fasta From b5b4ba5c89b8a6d5fe117183d198616352fa465a Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 14:12:50 -0400 Subject: [PATCH 07/10] fix: stub output --- modules/CCBR/khmer/uniquekmers/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/CCBR/khmer/uniquekmers/main.nf b/modules/CCBR/khmer/uniquekmers/main.nf index f8b53e5..4413625 100644 --- a/modules/CCBR/khmer/uniquekmers/main.nf +++ b/modules/CCBR/khmer/uniquekmers/main.nf @@ -35,7 +35,7 @@ process KHMER_UNIQUEKMERS { stub: """ - touch report.txt khmers.txt + touch report.txt kmers.txt cat <<-END_VERSIONS > versions.yml "${task.process}": From bfc80f78d485951ae256157119adf7250e462536 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 10 Oct 2023 14:56:00 -0400 Subject: [PATCH 08/10] test: update khmer tests PROFILE=docker nf-core modules create-test-yml khmer/uniquekmers --run-tests --force --no-prompts --- tests/modules/CCBR/khmer/uniquekmers/nextflow.config | 2 -- tests/modules/CCBR/khmer/uniquekmers/test.yml | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/modules/CCBR/khmer/uniquekmers/nextflow.config b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config index f617d41..8730f1c 100644 --- a/tests/modules/CCBR/khmer/uniquekmers/nextflow.config +++ b/tests/modules/CCBR/khmer/uniquekmers/nextflow.config @@ -3,5 +3,3 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } } - -docker.registry = 'quay.io' diff --git a/tests/modules/CCBR/khmer/uniquekmers/test.yml b/tests/modules/CCBR/khmer/uniquekmers/test.yml index 6f5216a..c4f6ada 100644 --- a/tests/modules/CCBR/khmer/uniquekmers/test.yml +++ b/tests/modules/CCBR/khmer/uniquekmers/test.yml @@ -1,5 +1,5 @@ - name: khmer uniquekmers test_khmer_uniquekmers - command: nextflow run ./tests/modules/CCBR/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config -c ./tests/modules/CCBR/khmer/uniquekmers/nextflow.config + command: nextflow run ./tests/modules/CCBR/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config tags: - khmer - khmer/uniquekmers @@ -8,3 +8,4 @@ md5sum: 496ebf23653a01c7a42d743e47c19f65 - path: output/khmer/report.txt md5sum: ee489abd3b244dea3640649e1790d55e + - path: output/khmer/versions.yml From 6b923865d40f4b03aa252e213d8048fe1cbdba61 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 11 Oct 2023 09:19:53 -0400 Subject: [PATCH 09/10] fix: must specify exact module in config --- tests/config/pytest_modules.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index cd8d2ca..aa7c8c8 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -10,6 +10,6 @@ cutadapt: - modules/CCBR/cutadapt/** - tests/modules/CCBR/cutadapt/** -khmer: - - modules/CCBR/khmer/** - - tests/CCBR/khmer/** +khmer/uniquekmers: + - modules/CCBR/khmer/uniquekmers/** + - tests/CCBR/khmer/uniquekmers/** From 89f8468b3633b364aaa62d4b1f958d22e681644d Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Wed, 11 Oct 2023 13:27:12 -0400 Subject: [PATCH 10/10] fix: khmer meta yaml - lint error from nf-core tools --- modules/CCBR/khmer/uniquekmers/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/CCBR/khmer/uniquekmers/meta.yml b/modules/CCBR/khmer/uniquekmers/meta.yml index 5ffb451..3615902 100644 --- a/modules/CCBR/khmer/uniquekmers/meta.yml +++ b/modules/CCBR/khmer/uniquekmers/meta.yml @@ -20,7 +20,7 @@ input: description: fasta file pattern: "*.{fa,fasta}" - kmer_size: - type: value + type: integer description: k-mer size to use pattern: "[0-9]+"