Skip to content

Commit

Permalink
add return of file instead of stream
Browse files Browse the repository at this point in the history
  • Loading branch information
sierra-moxon committed Feb 9, 2024
1 parent c676a1c commit 2779fde
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions bin/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,19 +340,19 @@ def make_products(dataset, gaf_path, products, ontology_graph):
@tools.gzips
def make_gpads(dataset, gaf_path, products, ontology_graph, noctua_gpad_file):

gpad_file_path = os.path.join(os.path.split(gaf_path)[0], f"{dataset}_gpad.gpad")

product_files = {
"gpad": open(os.path.join(os.path.split(gaf_path)[0], "{}_gpad.gpad".format(dataset)), "wb")
}

if not products["gpad"]:
# Bail if we have no products
return []

# logger.info("AssocParserConfig used: {}".format(config))

validated_gpad_path = product_files["gpad"]
outfile = open(validated_gpad_path, "w")
gpadwriter = GpadWriter(file=outfile, version="GPAD_2_0")
with open(gpad_file_path, "w") as outfile:
gpadwriter = GpadWriter(file=outfile, version="GPAD_2_0")

print("noctua-gpad-file: {}".format(noctua_gpad_file))
if noctua_gpad_file is not None:
Expand Down Expand Up @@ -386,10 +386,8 @@ def make_gpads(dataset, gaf_path, products, ontology_graph, noctua_gpad_file):
gpadwriter.write_assoc(association)

# After we run through associations
for f in product_files.values():
f.close()
return [gpad_file_path] if products["gpad"] else []

return [product_files["gpad"].name for prod in sorted(product_files.keys()) if products[prod]]

@tools.gzips
def produce_gpi(dataset, target_dir, gaf_path, ontology_graph):
Expand Down

0 comments on commit 2779fde

Please sign in to comment.