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

For #346 #662

Merged
merged 1 commit into from
Dec 1, 2023
Merged
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
11 changes: 10 additions & 1 deletion ontobio/io/gpadparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,17 @@ def parse_line(self, line):

split_line = assocparser.SplitLine(line=line, values=vals, taxon="")

#With/From
for wf in assoc.evidence.with_support_from:
validated = self.validate_curie_ids(wf.elements, split_line)
if validated is None:
return assocparser.ParseResult(line, [], True)

# repair any GO terms in the with/from field that may be obsolete
assoc.evidence.with_support_from = self._unroll_withfrom_and_replair_obsoletes(split_line, 'gpad')
with_support_from = self._unroll_withfrom_and_replair_obsoletes(split_line, 'gpad')
if with_support_from is None:
return assocparser.ParseResult(line, [], True)
assoc.evidence.with_support_from = with_support_from

# repair, if possible any GO terms in the extensions that may be obsolete
if (0 < len(assoc.object_extensions)):
Expand Down
19 changes: 19 additions & 0 deletions tests/test_gpad_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ def test_obsolete_term_repair_withfrom():
Curie(namespace='MGI', identity='1232453')])] == assoc.evidence.with_support_from


obsolete_go_with_from_no_replacement = ["ZFIN",
"ZFIN:ZDB-GENE-980526-362",
"acts_upstream_of_or_within",
"GO:0007155",
"PMID:15494018",
"ECO:0000305",
"GO:0016458|GO:1,GO:4|ZFIN:ZDB-MRPHLNO-010101-1,MGI:1232453",
"",
"20041026",
"ZFIN",
"",
"contributor=GOC:zfin_curators|model-state=production|noctua-model-id=gomodel:ZFIN_ZDB-GENE-980526-362"
]
ont = OntologyFactory().create(ALT_ID_ONT)
config = assocparser.AssocParserConfig(ontology=ont, rule_set=assocparser.RuleSet.ALL)
parser = GpadParser(config=config)
result = parser.parse_line("\t".join(obsolete_go_with_from_no_replacement))
assert result.associations == []

def test_obsolete_term_repair_extensions():

vals = ["ZFIN",
Expand Down
6 changes: 1 addition & 5 deletions tests/test_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def test_go_rule_16():
# GO term same as with/ID
assoc = make_annotation(goid="GO:0044419", evidence="IC", withfrom="GO:0044419").associations[0]

#GO term same as withfrom
test_result = qc.GoRule16().test(assoc, all_rules_config())
assert test_result.result_type == qc.ResultType.WARNING

Expand All @@ -268,10 +267,7 @@ def test_go_rule_16():
parser = GpadParser(obs_config)
gpadLine = "MGI\tMGI:1916040\tlocated_in\tGO:0005634\tPMID:23369715\tECO:0000305\tGO:0016458\t\t20200518\tMGI\t\tcontributor=https://orcid.org/0000-0001-7476-6306|noctua-model-id=gomodel:MGI_MGI_1916040|contributor=https://orcid.org/0000-0003-2689-5511|model-state=production"
result = parser.parse_line(gpadLine)
assoc = result.associations[0]
test_result = qc.GoRule16().test(assoc, obs_config)
assert test_result.result_type == qc.ResultType.WARNING

assert result.associations == []

# No GO term w/ID
assoc = make_annotation(evidence="IC", withfrom="BLAH:12345").associations[0]
Expand Down
Loading