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

GoRule 57 update and test for issue #473 #474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ontobio/io/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP
if annotation.evidence.type in evidence_codes:
return self._result(False)

provided_bys = config.group_metadata.get("filter_for", {}).get("provided_by", [])
if provided_bys and str(annotation.provided_by) not in provided_bys:
return self._result(False)

evidences_references = config.group_metadata.get("filter_out", {}).get("evidence_reference", [])
for er in evidences_references:
evidence_code = er["evidence"]
Expand Down
14 changes: 14 additions & 0 deletions tests/test_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,9 @@ def test_gorule57():
}
],
"annotation_properties": ["noctua-model-id"]
},
"filter_for": {
"provided_by": ["MGI"]
}
})
test_result = qc.GoRule57().test(assoc, config)
Expand All @@ -658,6 +661,17 @@ def test_gorule57():
test_result = qc.GoRule57().test(assoc, config)
assert test_result.result_type == qc.ResultType.PASS

assoc.provided_by = "UniProt"
test_result = qc.GoRule57().test(assoc, config)
assert test_result.result_type == qc.ResultType.ERROR

# Ensure null "filter_for" doesn't break anything
assoc.provided_by = "MGI"
config.group_metadata.pop("filter_for")
test_result = qc.GoRule57().test(assoc, config)
assert test_result.result_type == qc.ResultType.PASS


def test_gorule58():
a = ["blah"] * 16

Expand Down