Skip to content

Commit

Permalink
Merge pull request #546 from biolink/issue-544-rule-set-bugfix
Browse files Browse the repository at this point in the history
Issue 544 rule set bugfix
  • Loading branch information
dougli1sqrd committed Apr 14, 2021
2 parents 7d0d4b1 + 0abfb2a commit 64dc644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ontobio/io/assocparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# TODO: Refactor - move some stuff out into generic parser object

# from _typeshed import NoneType
import re
import requests
import tempfile
Expand All @@ -21,7 +22,7 @@
from dataclasses import dataclass

from collections import namedtuple, defaultdict
from typing import ClassVar, Iterable, Optional, List, Dict, Set, Union, Any
from typing import Callable, ClassVar, Collection, Iterable, Optional, List, Dict, Set, TypeVar, Union, Any

from ontobio import ontol
from ontobio import ecomap
Expand Down Expand Up @@ -204,7 +205,6 @@ def should_run_rule(self, rule: int) -> bool:
return rule in self.rules



class AssocParserConfig():
"""
Configuration for an association parser
Expand Down Expand Up @@ -262,11 +262,14 @@ def __init__(self,
self.group_idspace = None if group_idspace is None else set(group_idspace)
self.rule_contexts = rule_contexts
# We'll say that the default None should run no rules, so let's set the rule_set to []
# print("Rule Set is {}".format(rule_set))
if rule_set == None:
self.rule_set = RuleSet([])
elif rule_set == RuleSet.ALL:
# None here means all rules
self.rule_set = RuleSet(None)
else:
self.rule_set = RuleSet(rule_set)


# This is a dictionary from ruleid: `gorule-0000001` to title strings
Expand Down Expand Up @@ -308,7 +311,6 @@ def __str__(self):
attribute_values = ["{att}={val}".format(att=att, val=dict([(k, v) for k, v in value.items()][:8]) if isinstance(value, dict) else value) for att, value in vars(self).items()]
return "AssocParserConfig({})".format(",".join(attribute_values))


class Report(object):
"""
A report object that is generated as a result of a parse
Expand Down
1 change: 1 addition & 0 deletions ontobio/io/gafparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def parse_line(self, line):
assoc = self.upgrade_empty_qualifier(assoc)

## Run GO Rules, save split values into individual variables
# print("Config is {}".format(self.config.__dict__.keys()))
go_rule_results = qc.test_go_rules(assoc, self.config, group=self.group)
for rule, result in go_rule_results.all_results.items():
if result.result_type == qc.ResultType.WARNING:
Expand Down

0 comments on commit 64dc644

Please sign in to comment.