Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stub to the modules template #2277

Merged
merged 3 commits into from May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,8 @@

### Template

- Added stub in modules template ([#2277])(https://github.com/nf-core/tools/pull/2277)

### Linting

- Warn if container access is denied ([#2270](https://github.com/nf-core/tools/pull/2270))
Expand Down
22 changes: 22 additions & 0 deletions nf_core/module-template/modules/main.nf
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
"""
}