Skip to content

Commit

Permalink
explicitly set ruleset on Gaf and GPAD parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
sierra-moxon committed Mar 20, 2024
1 parent 04e78b4 commit 8e65a88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 11 additions & 3 deletions bin/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ def make_gpads(dataset, gaf_path, products, ontology_graph, noctua_gpad_file, pa

# If there's a noctua gpad file, process it
if noctua_gpad_file:
click.echo("Making noctua gpad products...{}".format(noctua_gpad_file))
# Process noctua gpad file
process_noctua_gpad_file(noctua_gpad_file, gpadwriter, ontology_graph)

Expand All @@ -385,7 +386,9 @@ def process_noctua_gpad_file(noctua_gpad_file, gpadwriter, ontology_graph):
with open(noctua_gpad_file) as nf:
lines = sum(1 for line in nf)
nf.seek(0) # Reset file pointer to the beginning after counting lines
gpadparser = GpadParser(config=assocparser.AssocParserConfig(ontology=ontology_graph, paint=False))
gpadparser = GpadParser(config=assocparser.AssocParserConfig(ontology=ontology_graph,
paint=False,
rule_set="all"))
click.echo("Making noctua gpad products...")
with click.progressbar(iterable=gpadparser.association_generator(file=nf), length=lines) as associations:
for association in associations:
Expand All @@ -405,7 +408,9 @@ def process_gaf_file(gaf_path, gpadwriter, ontology_graph, paint_gaf_src):
with open(gaf_path) as gf:
lines = sum(1 for line in gf)
gf.seek(0) # Reset file pointer to the beginning after counting lines
gafparser = GafParser(config=assocparser.AssocParserConfig(ontology=ontology_graph, paint=True))
gafparser = GafParser(config=assocparser.AssocParserConfig(ontology=ontology_graph,
paint=True,
rule_set="all"))
click.echo("Merging in source gaf to gpad product...")
with click.progressbar(iterable=gafparser.association_generator(file=gf), length=lines) as associations:
for association in associations:
Expand All @@ -415,7 +420,9 @@ def process_gaf_file(gaf_path, gpadwriter, ontology_graph, paint_gaf_src):
with open(paint_gaf_src) as pgf:
lines = sum(1 for line in pgf)
pgf.seek(0)
gafparser = GafParser(config=assocparser.AssocParserConfig(ontology=ontology_graph, paint=True))
gafparser = GafParser(config=assocparser.AssocParserConfig(ontology=ontology_graph,
paint=True,
rule_set="all"))
click.echo("Merging in paint gaf to gpad product...")
with click.progressbar(iterable=gafparser.association_generator(file=pgf), length=lines) as associations:
for association in associations:
Expand Down Expand Up @@ -649,6 +656,7 @@ def produce(ctx, group, metadata_dir, gpad, ttl, target, ontology, exclude, base
# Set paint to True when the group is "paint".
# This will prevent filtering of IBA (GO_RULE:26) when paint is being treated as a top level group,
# like for paint_other.
click.echo("source_gaf: {}".format(source_gaf))
valid_gaf = produce_gaf(dataset, source_gaf, ontology_graph,
paint=(group == "paint"),
group=group,
Expand Down
5 changes: 4 additions & 1 deletion ontobio/io/assocparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ def association_generator(self, file, skipheader=False, outfile=None) -> Dict:
file = self._ensure_file(file)
for line in file:
parsed_result = self.parse_line(line)
self.report.report_parsed_result(parsed_result, outfile, self.config.filtered_evidence_file, self.config.filter_out_evidence)
self.report.report_parsed_result(parsed_result,
outfile,
self.config.filtered_evidence_file,
self.config.filter_out_evidence)
for association in parsed_result.associations:
# yield association if we don't care if it's a header or if it's definitely a real gaf line
if not skipheader or not isinstance(association, dict):
Expand Down
1 change: 0 additions & 1 deletion ontobio/io/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,6 @@ def test(self, annotation: association.GoAssociation, config: assocparser.AssocP
evidence = str(annotation.evidence.type)
withfrom = annotation.evidence.with_support_from


if evidence in [iss_eco, isa_eco, iso_eco] and (withfrom is None or len(withfrom) == 0):
return self._result(False)

Expand Down

0 comments on commit 8e65a88

Please sign in to comment.