Skip to content

Commit

Permalink
Merge pull request #636 from biolink/go-site-1519-gorule-0000006-excl…
Browse files Browse the repository at this point in the history
…ude-annot-source-goc

For geneontology/go-site#1519 - exclude annotations with source = GOC
  • Loading branch information
mugitty authored May 19, 2023
2 parents fb25bfd + 9a1e90b commit f89735c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ontobio/io/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP
if config.ontology is None:
return self._result(True)

go_namespace = [predval for predval in config.ontology.get_graph().nodes.get(str(annotation.object.id), {}).get("meta", {}).get("basicPropertyValues", []) if predval["pred"]=="OIO:hasOBONamespace"]
evidence = str(annotation.evidence.type)
assigned_by = annotation.provided_by
#Annotations with code IEP and HEP assigned by GOC are not restricted to Biological Process terms
if evidence in [iep_eco, hep_eco] and assigned_by == "GOC":
return self._result(True)
go_namespace = [predval for predval in config.ontology.get_graph().nodes.get(str(annotation.object.id), {}).get("meta", {}).get("basicPropertyValues", []) if predval["pred"]=="OIO:hasOBONamespace"]
fails = evidence in [iep_eco, hep_eco] and "biological_process" not in [o["val"] for o in go_namespace]
return self._result(not fails)

Expand Down
12 changes: 12 additions & 0 deletions tests/test_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
ontology = ontol_factory.OntologyFactory().create("tests/resources/goslim_generic.json")
ecomapping = ecomap.EcoMap()
iea_eco = ecomapping.coderef_to_ecoclass("IEA")
hep_eco = ecomapping.coderef_to_ecoclass("HEP")
ic_eco = ecomapping.coderef_to_ecoclass("IC")
ikr_eco = ecomapping.coderef_to_ecoclass("IKR")
iba_eco = ecomapping.coderef_to_ecoclass("IBA")
Expand Down Expand Up @@ -104,7 +105,18 @@ def test_go_rule_06():
assoc.evidence.type = Curie.from_str(iea_eco)
test_result = qc.GoRule06().test(assoc, all_rules_config(ontology=ontology))
assert test_result.result_type == qc.ResultType.PASS

assoc.evidence.type = Curie.from_str(hep_eco)
assoc.provided_by = "GOC"
assoc.aspect = "F"
assoc.object.id = Curie.from_str("GO:0003674");
test_result = qc.GoRule06().test(assoc, all_rules_config(ontology=ontology))
assert test_result.result_type == qc.ResultType.PASS

assoc.provided_by = "WB"
test_result = qc.GoRule06().test(assoc, all_rules_config(ontology=ontology))
assert test_result.result_type == qc.ResultType.ERROR

def test_go_rule_07():

assoc = make_annotation(goid="GO:0003824", evidence="IPI").associations[0]
Expand Down

0 comments on commit f89735c

Please sign in to comment.