diff --git a/ontobio/io/qc.py b/ontobio/io/qc.py index 808b9039..14cd685d 100644 --- a/ontobio/io/qc.py +++ b/ontobio/io/qc.py @@ -687,35 +687,6 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP return self._result(True) -class GoRule57(GoRule): - - def __init__(self): - super().__init__("GORULE:0000057", "Group specific filter rules should be applied to annotations", FailMode.HARD, tags=["context-import"]) - - def test(self, annotation: association.GoAssociation, config: assocparser.AssocParserConfig, group=None) -> TestResult: - # Check group_metadata is present - if config.group_metadata is None: - return self._result(True) - - evidence_codes = config.group_metadata.get("filter_out", {}).get("evidence", []) - if str(annotation.evidence.type) in evidence_codes: - return self._result(False) - - evidences_references = config.group_metadata.get("filter_out", {}).get("evidence_reference", []) - for er in evidences_references: - evidence_code = er["evidence"] - reference = er["reference"] - if str(annotation.evidence.type) == evidence_code and [str(ref) for ref in annotation.evidence.has_supporting_reference] == [reference]: - return self._result(False) - - properties = config.group_metadata.get("filter_out", {}).get("annotation_properties", []) - for p in properties: - if p in annotation.properties.keys(): - return self._result(False) - - return self._result(True) - - class GoRule58(RepairRule): def __init__(self): @@ -947,7 +918,6 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP "GoRule50": GoRule50(), #"GoRule51": GoRule51(), Do not run test "GoRule55": GoRule55(), - "GoRule57": GoRule57(), "GoRule58": GoRule58(), "GoRule61": GoRule61(), # GoRule13 at the bottom in order to make all other rules clean up an annotation before reaching 13 diff --git a/tests/test_qc.py b/tests/test_qc.py index 2d0b270f..54d05db8 100644 --- a/tests/test_qc.py +++ b/tests/test_qc.py @@ -1,7 +1,6 @@ import pytest import datetime import yaml -import json from ontobio.model import association from ontobio.model.association import Curie @@ -12,7 +11,7 @@ from ontobio.io import gafparser from ontobio.io.gafparser import GafParser from ontobio.io import gpadparser -from ontobio import ontol, ontol_factory, ecomap +from ontobio import ontol_factory, ecomap import copy @@ -629,44 +628,6 @@ def test_gorule55(): assert test_result.result_type == qc.ResultType.WARNING -def test_gorule57(): - assoc = make_annotation(db="HELLO", db_id="123", qualifier="contributes_to", goid="GO:0003674", evidence=iea_eco, taxon="taxon:2", from_gaf=False).associations[0] - # Look at evidence_code, reference, annotation_properties - config = assocparser.AssocParserConfig( - group_metadata={ - "id": "mgi", - "label": "Mouse Genome Informatics", - "filter_out": { - "evidence": [iea_eco], - "evidence_reference": [ - { - "evidence": ikr_eco, - "reference": "PMID:21873635" - } - ], - "annotation_properties": ["noctua-model-id"] - } - }, - rule_set=assocparser.RuleSet.ALL - ) - test_result = qc.GoRule57().test(assoc, config) - assert test_result.result_type == qc.ResultType.ERROR - - assoc.evidence.type = Curie.from_str(ikr_eco) - assoc.evidence.has_supporting_reference = [Curie.from_str("PMID:21873635")] - test_result = qc.GoRule57().test(assoc, config) - assert test_result.result_type == qc.ResultType.ERROR - - assoc.evidence.type = Curie.from_str("ECO:some_garbage") - assoc.evidence.has_supporting_reference = [Curie.from_str("PMID:some_garbage")] - assoc.properties = {"noctua-model-id": "some_garbage"} - test_result = qc.GoRule57().test(assoc, config) - assert test_result.result_type == qc.ResultType.ERROR - - assoc.properties = {} - test_result = qc.GoRule57().test(assoc, config) - assert test_result.result_type == qc.ResultType.PASS - def test_gorule58(): with open("tests/resources/extensions-constraints.yaml") as exs_cons: @@ -778,7 +739,7 @@ def test_all_rules(): assoc = gafparser.to_association(a).associations[0] test_results = qc.test_go_rules(assoc, config).all_results - assert len(test_results.keys()) == 24 + assert len(test_results.keys()) == 23 assert test_results[qc.GoRules.GoRule26.value].result_type == qc.ResultType.PASS assert test_results[qc.GoRules.GoRule29.value].result_type == qc.ResultType.PASS