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 91b6b29..d0f936f 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) diff --git a/modules/CCBR/khmer/uniquekmers/main.nf b/modules/CCBR/khmer/uniquekmers/main.nf new file mode 100644 index 0000000..4413625 --- /dev/null +++ b/modules/CCBR/khmer/uniquekmers/main.nf @@ -0,0 +1,45 @@ +process KHMER_UNIQUEKMERS { + tag "$fasta" + label 'process_low' + + container 'nciccbr/ccbr_khmer_3.0.0:v1' + + 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 kmers.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..3615902 --- /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: integer + 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/config/pytest_modules.yml b/tests/config/pytest_modules.yml index f079ab3..aa7c8c8 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/uniquekmers: + - modules/CCBR/khmer/uniquekmers/** + - tests/CCBR/khmer/uniquekmers/** diff --git a/tests/modules/CCBR/khmer/uniquekmers/main.nf b/tests/modules/CCBR/khmer/uniquekmers/main.nf new file mode 100644 index 0000000..0a47792 --- /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/CCBR/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..c4f6ada --- /dev/null +++ b/tests/modules/CCBR/khmer/uniquekmers/test.yml @@ -0,0 +1,11 @@ +- name: khmer uniquekmers test_khmer_uniquekmers + command: nextflow run ./tests/modules/CCBR/khmer/uniquekmers -entry test_khmer_uniquekmers -c ./tests/config/nextflow.config + tags: + - khmer + - khmer/uniquekmers + files: + - path: output/khmer/kmers.txt + md5sum: 496ebf23653a01c7a42d743e47c19f65 + - path: output/khmer/report.txt + md5sum: ee489abd3b244dea3640649e1790d55e + - path: output/khmer/versions.yml