Skip to content

Commit

Permalink
Merge pull request #2277 from nvnieuwk/add-stub-to-modules-template
Browse files Browse the repository at this point in the history
Add stub to the modules template
  • Loading branch information
nvnieuwk authored May 5, 2023
2 parents ffc0256 + 4d495fb commit 41b4dfc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Remove `cleanup = true` from `test_full.config` in pipeline template
- Fix usage docs for specifying `params.yaml`
- Added stub in modules template ([#2277])(https://github.com/nf-core/tools/pull/2277) [Contributed by @nvnieuwk]

### Linting

Expand Down
22 changes: 22 additions & 0 deletions nf_core/module-template/modules/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,26 @@ process {{ component_name_underscore|upper }} {
{{ tool }}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
{% if has_meta -%}
def prefix = task.ext.prefix ?: "${meta.id}"
{%- endif %}
{% if not_empty_template -%}
// TODO nf-core: A stub section should mimic the execution of the original module as best as possible
// Have a look at the following examples:
// Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63
// Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54
{%- endif %}
"""
{% if not_empty_template -%}
touch ${prefix}.bam
{%- endif %}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
{{ tool }}: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
END_VERSIONS
"""
}

0 comments on commit 41b4dfc

Please sign in to comment.