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 #2210 #679

Merged
merged 1 commit into from
Jul 19, 2024
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
2 changes: 1 addition & 1 deletion ontobio/io/assocparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def _validate_id(self, id, line: SplitLine, allowed_ids=None, context=None):
type_name_regex_patterns = self.config.db_type_name_regex_id_syntax[id_prefix]
identity_matches_pattern = False
for regex in type_name_regex_patterns.values():
if regex.match(right):
if regex.fullmatch(right):
identity_matches_pattern = True
break
if identity_matches_pattern == False:
Expand Down
18 changes: 18 additions & 0 deletions tests/test_gafparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,24 @@ def test_id_syntax():
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:PMID:18422602"

p = GafParser(config=assocparser.AssocParserConfig(
ontology=OntologyFactory().create(ONT), db_type_name_regex_id_syntax=database_id_syntax_lookups))
assoc_result = p.parse_line("PomBase\tSPBC1289.03c\tspi1\t\tGO:0005515\tPMID:0.\tIPI\tPomBase:SPAC25A8.01c\tF\tRan GTPase Spi1\t\tprotein\ttaxon:4896\t20080718\tPomBase\t")
assert len(assoc_result.associations) == 1
assert assoc_result.skipped == False
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:0."

p = GafParser(config=assocparser.AssocParserConfig(
ontology=OntologyFactory().create(ONT), db_type_name_regex_id_syntax=database_id_syntax_lookups))
assoc_result = p.parse_line("PomBase\tSPBC1289.03c\tspi1\t\tGO:0005515\tPMID:x18422602\tIPI\tPomBase:SPAC25A8.01c\tF\tRan GTPase Spi1\t\tprotein\ttaxon:4896\t20080718\tPomBase\t")
assert len(assoc_result.associations) == 1
assert assoc_result.skipped == False
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:x18422602"

p = GafParser(config=assocparser.AssocParserConfig(
ontology=OntologyFactory().create(ONT), db_type_name_regex_id_syntax=database_id_syntax_lookups))
Expand Down
48 changes: 47 additions & 1 deletion tests/test_gpad_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,53 @@ def test_id_syntax():
assert result.skipped == False
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:PMID:15494018"
assert messages["gorule-0000027"][0]["obj"] == "PMID:PMID:15494018"

vals = ["PomBase",
"SPAC25A8.01c",
"acts_upstream_of_or_within",
"GO:0007155",
"PMID:9.",
"ECO:0000305",
"GO:0005913",
"",
"20041026",
"ZFIN",
"",
"PomBase"
]

p = GpadParser(config=config)
result = p.parse_line("\t".join(vals))
assert len(result.associations) == 1
assert result.skipped == False
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:9."


vals = ["PomBase",
"SPAC25A8.01c",
"acts_upstream_of_or_within",
"GO:0007155",
"PMID:a1549418",
"ECO:0000305",
"GO:0005913",
"",
"20041026",
"ZFIN",
"",
"PomBase"
]

p = GpadParser(config=config)
result = p.parse_line("\t".join(vals))
assert len(result.associations) == 1
assert result.skipped == False
messages = p.report.to_report_json()["messages"]
assert len(messages["gorule-0000027"]) == 1
assert messages["gorule-0000027"][0]["obj"] == "PMID:a1549418"


vals = ["PomBase",
"SPAC25A8.01c",
Expand Down
Loading