Skip to content

Commit

Permalink
add EDAM comments and suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Feb 7, 2025
1 parent bde7a3b commit d2631b1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
18 changes: 9 additions & 9 deletions nf_core/components/components_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,13 @@ def get_biotools_id(data: dict, tool_name: str) -> str:
log.warning(f"Could not find a bio.tools ID for '{tool_name}'")
return ""

type DictWithListAndStr = Dict[str, Tuple[List[str], str]]

type DictWithStrAndTuple = Dict[str, Tuple[List[str], List[str]]]


def get_channel_info_from_biotools(
data: dict, tool_name: str
) -> Optional[Tuple[DictWithListAndStr, DictWithListAndStr]] :
) -> Optional[Tuple[DictWithStrAndTuple, DictWithStrAndTuple]]:
"""
Try to find input and output channels and the respective EDAM ontology terms
Expand All @@ -210,24 +213,21 @@ def get_channel_info_from_biotools(
inputs = {}
outputs = {}

def _iterate_input_output(type) -> DictWithListAndStr:
def _iterate_input_output(type) -> DictWithStrAndTuple:
type_info = {}
if type in funct:
for element in funct[type]:
if "data" in element:
element_name = "_".join(element["data"]["term"].lower().split(" "))
uris = [element["data"]["uri"]]
terms = ""
terms = [""]
if "format" in element:
for format in element["format"]:
# Append the EDAM URI
uris.append(format["uri"])
# Append the EDAM term, getting the first word in case of complicated strings. i.e. "FASTA format"
terms = terms + format["term"].lower().split(" ")[0] + ","
type_info[element_name] = (
uris,
terms[:-1], # Remove the last comma
)
terms.append(format["term"].lower().split(" ")[0])
type_info[element_name] = (uris, terms)
return type_info

# Iterate through the tools in the response to find the tool name
Expand Down
3 changes: 3 additions & 0 deletions nf_core/module-template/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ channels:
- conda-forge
- bioconda
dependencies:
# TODO nf-core: List required Conda package(s).
# Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
# For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
- "{{ bioconda if bioconda else 'YOUR-TOOL-HERE' }}"
13 changes: 5 additions & 8 deletions nf_core/module-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ process {{ component_name_underscore|upper }} {
label '{{ process_label }}'

{% if not_empty_template -%}
// TODO nf-core: List required Conda package(s).
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
{% endif -%}
conda "${moduleDir}/environment.yml"
Expand All @@ -34,7 +31,7 @@ process {{ component_name_underscore|upper }} {

input:
{%- if inputs %}
// TODO nf-core: Update the information obtained form bio.tools and make sure that it is correct
// TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct
{%- for input_name, ontologies in inputs.items() %}
{{ 'tuple val(meta), path(' + input_name + ')' if has_meta else 'path ' + input_name }}
{%- endfor %}
Expand All @@ -54,9 +51,9 @@ process {{ component_name_underscore|upper }} {

output:
{%- if outputs %}
// TODO nf-core: Update the information obtained form bio.tools and make sure that it is correct
// TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct
{%- for output_name, ontologies in outputs.items() %}
{{ 'tuple val(meta), path("*{' + ontologies[1] + '}")' if has_meta else 'path ' + output_name }}, emit: {{ output_name }}
{{ 'tuple val(meta), path("*{' + ontologies[1]|join(',') + '}")' if has_meta else 'path ' + output_name }}, emit: {{ output_name }}
{%- endfor %}
{%- else %}
{% if not_empty_template -%}
Expand Down Expand Up @@ -96,7 +93,7 @@ process {{ component_name_underscore|upper }} {
{%- if has_meta %}
{%- if inputs %}
{%- for input_name, ontologies in inputs.items() %}
{%- set extensions = ontologies[1].split(',') %}
{%- set extensions = ontologies[1] %}
{%- for ext in extensions %}
-o ${prefix}.{{ ext }} \\
{%- endfor %}
Expand Down Expand Up @@ -135,7 +132,7 @@ process {{ component_name_underscore|upper }} {
{% if not_empty_template -%}
{%- if inputs %}
{%- for input_name, ontologies in inputs.items() %}
{%- set extensions = ontologies[1].split(',') %}
{%- set extensions = ontologies[1] %}
{%- for ext in extensions %}
touch ${prefix}.{{ ext }}
{%- endfor %}
Expand Down
20 changes: 10 additions & 10 deletions nf_core/module-template/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ input:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
e.g. `[ id:'sample1' ]`
{% endif %}
- {{ input_name }}:
# TODO nf-core: Update the information obtained form bio.tools and make sure that it is correct
# TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct
type: file
description: {{ input_name }} file
pattern: {{ "\"*.{" + ontologies[1] + "}\"" }}
pattern: {{ "\"*.{" + ontologies[1]|join(",") + "}\"" }}
ontologies:
{% for ontology in ontologies[0] -%}
- edam: "{{ ontology }}"
- edam: "{{ ontology }}" # {{ ontologies[1][loop.index0] }}
{% endfor -%}
{% endfor -%}
{% else -%}
Expand All @@ -51,7 +51,7 @@ input:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
e.g. `[ id:'sample1' ]`
{% endif %}
{% if not_empty_template -%}
## TODO nf-core: Delete / customise this example input
Expand Down Expand Up @@ -82,16 +82,16 @@ output:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
e.g. `[ id:'sample1' ]`
{%- endif %}
- {{ output_name }}:
# TODO nf-core: Update the information obtained form bio.tools and make sure that it is correct
# TODO nf-core: Update the information obtained from bio.tools and make sure that it is correct
type: file
description: {{ output_name }} file
pattern: {{ "\"*.{" + ontologies[1] + "}\"" }}
pattern: {{ "\"*.{" + ontologies[1]|join(",") + "}\"" }}
ontologies:
{%- for ontology in ontologies[0] %}
- edam: "{{ ontology }}"
- edam: "{{ ontology }}" # {{ ontologies[1][loop.index0] }}
{%- endfor %}
{% endfor -%}
{% else -%}
Expand All @@ -101,7 +101,7 @@ output:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
e.g. `[ id:'sample1' ]`
{%- endif %}
{% if not_empty_template -%}
## TODO nf-core: Delete / customise this example output
Expand Down
4 changes: 2 additions & 2 deletions tests/components/test_components_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def test_get_biotools_ch_info(self):
"http://edamontology.org/format_2182",
"http://edamontology.org/format_2573",
],
"fastq-like,sam",
["fastq-like", "sam"],
)
}
assert outputs == {
"sequence_report": (
["http://edamontology.org/data_2955", "http://edamontology.org/format_2331"],
"html",
["html"],
)
}

Expand Down

0 comments on commit d2631b1

Please sign in to comment.