Skip to content

Commit

Permalink
Merge pull request #684 from biolink/pipeline-issue-383
Browse files Browse the repository at this point in the history
fixes pipeline issue 383 - gpad 1.2 should have `!gpa-version` in the header, not `!gpad-version` in the header
  • Loading branch information
sierra-moxon authored Jul 29, 2024
2 parents 0b9336a + c9094b3 commit d2b7967
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions ontobio/io/assocwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,14 @@ def __init__(self, file=None, version=None):
click.echo("Writing GPAD version: {}".format(version))
if version in [GPAD_1_2, GPAD_2_0]:
self.version = version
if version == GPAD_1_2:
self._write("!gpa-version: {}\n".format(self.version))
else:
self._write("!gpad-version: {}\n".format(self.version))
else:
self.version = GPAD_1_2
self._write("!gpa-version: {}\n".format(self.version))

self._write("!gpad-version: {}\n".format(self.version))
click.echo("Writing GPAD version: {}".format(self.version))
self._write("!generated-by: {}\n".format("GO Central"))
self._write("!date-generated: {}\n".format(str(datetime.datetime.now().strftime("%Y-%m-%dT%H:%M"))))
self.ecomap = ecomap.EcoMap()
Expand All @@ -149,10 +152,10 @@ class GafWriter(AssocWriter):
This converts an association dictionary object as produced in GafParser or
GpadParser into a GAF line.
The GAF Writer now assumes that it is writing out GAF version 2.1 style
The GAF Writer now assumes that it is writing out GAF version 2.2 style
annotations. The version can be set when creating a new GafWriter to 2.2
with `version=2.2`. If any version other than 2.1 or 2.2, GafWriter will
default to 2.1.
default to 2.2.
The only difference in 2.1 and 2.2 are how qualifiers (column 4) are handled.
GAF 2.1 allows empty or only `NOT` qualifier values, and only allows
Expand All @@ -167,7 +170,7 @@ class GafWriter(AssocWriter):
written out, or if the qualifier is empty and 2.2 is being written.
"""

def __init__(self, file=None, source=None, version="2.1"):
def __init__(self, file=None, source=None, version="2.2"):
self.file = file
if version in ["2.1", "2.2"]:
self.version = version
Expand Down
2 changes: 1 addition & 1 deletion tests/test_gpad_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_gpad_iba_writing():
outlines = out.getvalue().split("\n")

print(outlines)
assert outlines[0] == "!gpad-version: 1.2"
assert outlines[0] == "!gpa-version: 1.2"
assert outlines[1] == "!generated-by: GO Central"
assert outlines[2].startswith("!date-generated:")
assert outlines[3] == "WB\tWBGene00022144\tpart_of\tGO:0005886\tPMID:21873635\tECO:0000318\tPANTHER:PTN000073732|RGD:3252\t\t20180308\tGO_Central\t\t"
Expand Down

0 comments on commit d2b7967

Please sign in to comment.