Skip to content

Commit

Permalink
Merge pull request #635 from biolink/go-site-895-fix-list-bug
Browse files Browse the repository at this point in the history
For geneontology/go-site#895 fix list bug
  • Loading branch information
mugitty committed May 16, 2023
2 parents 47cc50a + 864bcd1 commit 046207d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
12 changes: 6 additions & 6 deletions ontobio/io/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,12 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP
db = annotation.subject.id.namespace
objecttype = annotation.subject.type
goterm = str(annotation.object.id)
namespace = config.ontology.obo_namespace(goterm)
if namespace == "cellular_component":
if goterm in self.make_protein_complex_descendents_if_not_present(config.ontology):
fails = (db == "ComplexPortal" or (objecttype.namespace == "GO" and objecttype.identity == "0032991"))
return self._result(not fails)
namespace = config.ontology.obo_namespace(goterm)

if namespace == "cellular_component" and goterm in self.make_protein_complex_descendents_if_not_present(config.ontology):
for ot in objecttype:
if db == "ComplexPortal" or (ot.namespace == "GO" and ot.identity == "0032991"):
return self._result(False)
return self._result(True)


Expand Down
9 changes: 6 additions & 3 deletions tests/test_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,18 +439,18 @@ def test_gorule39():

# test descendant of GO:0032991
assoc = make_annotation(db="bla", goid="GO:0005840").associations[0]
assoc.subject.type = association.map_gp_type_label_to_curie("protein_complex")
assoc.subject.type = [association.map_gp_type_label_to_curie("protein_complex")]
test_result = qc.GoRule39().test(assoc, config)
assert test_result.result_type == qc.ResultType.ERROR

# test protein complex
assoc = make_annotation(db="bla", goid="GO:0032991").associations[0]
assoc.subject.type=association.map_gp_type_label_to_curie("protein_complex")
assoc.subject.type= [association.map_gp_type_label_to_curie("protein_complex")]
test_result = qc.GoRule39().test(assoc, config)
assert test_result.result_type == qc.ResultType.ERROR

assoc.subject.id = association.Curie("FB", "1234")
assoc.subject.type = association.Curie("CHEBI", "33695")
assoc.subject.type = [association.Curie("CHEBI", "33695")]
assoc.object.id = association.Curie("GO", "0032991")
test_result = qc.GoRule39().test(assoc, config)
assert test_result.result_type == qc.ResultType.PASS
Expand All @@ -459,6 +459,9 @@ def test_gorule39():
assoc.object.id = association.Curie("GO", "0000023")
test_result = qc.GoRule39().test(assoc, config)
assert test_result.result_type == qc.ResultType.PASS

#test actual GAF file


def test_gorule42():
assoc = make_annotation(qualifier="NOT", evidence="IKR").associations[0]
Expand Down

0 comments on commit 046207d

Please sign in to comment.