Skip to content

Commit

Permalink
Merge pull request #548 from ptth222/ontology-source-check-fix
Browse files Browse the repository at this point in the history
Fix rule and check.
  • Loading branch information
terazus authored Mar 11, 2024
2 parents 01dffc7 + 9a5fb86 commit 16ccc00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion isatools/isatab/validate/rules/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def execute(self, validator_params: dict) -> None:
try:
response = self.rule(*params)
if self.identifier == '3008':
validator_params['term_source_refs'] = response[0]
validator_params['term_source_refs'] = response
if self.identifier == '4001':
validator_params['configs'] = response
self.executed = True
Expand Down
16 changes: 9 additions & 7 deletions isatools/isatab/validate/rules/rules_30xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,22 @@ def check_single_field(cell_value, source, acc, config_field, filename):
:param filename: Filename of the table
:return: True if OK, False if not OK
"""
return_value = True
if ((cell_has_value(cell_value) and not cell_has_value(source) and cell_has_value(acc))
or not cell_has_value(cell_value)):
msg = "Missing Term Source REF in annotation or missing Term Source Name"
spl = ("Incomplete values for ontology headers, for the field '{}' in the file '{}'. Check that all the "
"label/accession/source are provided.").format(config_field.header, filename)
validator.add_warning(message=msg, supplemental=spl, code=3008)
log.warning("(W) {}".format(spl))
if source not in tsrs:
spl = ("Term Source REF, for the field '{}' in the file '{}' does not refer to a declared "
"Ontology Source.").format(config_field.header, filename)
validator.add_warning(message="Term Source REF reference broken", supplemental=spl, code=3011)
log.warning("(W) {}".format(spl))
return False
return True
return_value = False
if cell_has_value(source) and source not in tsrs:
spl = ("Term Source REF, for the field '{}' in the file '{}' does not refer to a declared "
"Ontology Source.").format(cfield.header, filename)
validator.add_warning(message="Term Source REF reference broken", supplemental=spl, code=3011)
log.warning("(W) {}".format(spl))
return_value = False
return return_value

result = True
nfields = len(table.columns)
Expand Down

0 comments on commit 16ccc00

Please sign in to comment.