Skip to content

Commit

Permalink
Merge pull request #3460 from mirpedrol/edam-ontology-fixes
Browse files Browse the repository at this point in the history
Linting: EDAM ontology fixes
  • Loading branch information
mirpedrol authored Feb 20, 2025
2 parents b43cb98 + 3da314b commit d4f99fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- Add linting for ifEmpty(null) ([#3411](https://github.com/nf-core/tools/pull/3411))
- fix: linting with comments after the input directive ([#3458](https://github.com/nf-core/tools/pull/3458))
- EDAM ontology fixes ([#3460](https://github.com/nf-core/tools/pull/3460))

### Modules

Expand Down
4 changes: 2 additions & 2 deletions nf_core/module-template/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ input:
pattern: {{ '"*.{bam,cram,sam}"' if not_empty_template else "" }}
ontologies:
{% if not_empty_template -%}
- edam: "http://edamontology.org/format_25722" # BAM
- edam: "http://edamontology.org/format_2572" # BAM
- edam: "http://edamontology.org/format_2573" # CRAM
- edam: "http://edamontology.org/format_3462" # SAM
{% else -%}
Expand Down Expand Up @@ -112,7 +112,7 @@ output:
pattern: {{ '"*.{bam,cram,sam}"' if not_empty_template else "" }}
ontologies:
{% if not_empty_template -%}
- edam: "http://edamontology.org/format_25722" # BAM
- edam: "http://edamontology.org/format_2572" # BAM
- edam: "http://edamontology.org/format_2573" # CRAM
- edam: "http://edamontology.org/format_3462" # SAM
{% else -%}
Expand Down
5 changes: 4 additions & 1 deletion nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ def update_meta_yml_file(self, mod):
if "ontologies" in corrected_meta_yml["input"][i][j][element_name]:
for ontology in corrected_meta_yml["input"][i][j][element_name]["ontologies"]:
current_ontologies_i.append(ontology["edam"])
elif corrected_meta_yml["input"][i][j][element_name]["type"] == "file":
corrected_meta_yml["input"][i][j][element_name]["ontologies"] = []
log.debug(f"expected ontologies for input: {expected_ontologies_i}")
log.debug(f"current ontologies for input: {current_ontologies_i}")
for ontology, ext in expected_ontologies_i:
Expand All @@ -404,7 +406,6 @@ def update_meta_yml_file(self, mod):
corrected_meta_yml["input"][i][j][element_name]["ontologies"][-1].yaml_add_eol_comment(
f"{edam_formats[ext][1]}", "edam"
)
print(f"added comment {edam_formats[ext][1]}")
if "output" in meta_yml:
for i, channel in enumerate(corrected_meta_yml["output"]):
ch_name = list(channel.keys())[0]
Expand All @@ -420,6 +421,8 @@ def update_meta_yml_file(self, mod):
if "ontologies" in corrected_meta_yml["output"][i][ch_name][j][element_name]:
for ontology in corrected_meta_yml["output"][i][ch_name][j][element_name]["ontologies"]:
current_ontologies_o.append(ontology["edam"])
elif corrected_meta_yml["output"][i][ch_name][j][element_name]["type"] == "file":
corrected_meta_yml["output"][i][ch_name][j][element_name]["ontologies"] = []
log.debug(f"expected ontologies for output: {expected_ontologies_o}")
log.debug(f"current ontologies for output: {current_ontologies_o}")
for ontology, ext in expected_ontologies_o:
Expand Down

0 comments on commit d4f99fc

Please sign in to comment.