Skip to content

Commit

Permalink
Merge pull request #52 from geneontology/feb_updates
Browse files Browse the repository at this point in the history
tweak evidence code filtering in p2g
  • Loading branch information
sierra-moxon authored Mar 18, 2024
2 parents ac89c94 + f7e5224 commit b3f6d46
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/gopreprocess/file_processors/gaf_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def get_experimental_eco_codes(ecomap) -> List[str]:
return experimental_evidence_codes


def get_p2g_experimental_eco_codes(ecomap) -> List[str]:
"""
Retrieves a list of experimental evidence codes from the given EcoMap.
:param ecomap: The EcoMap object containing the evidence code mappings.
:type ecomap: EcoMap
:return: A list of experimental evidence codes.
:rtype: List[str]
"""
experimental_evidence_codes = []
for code, _, eco_id in ecomap.derived_mappings():
if code in ["IBA"]:
experimental_evidence_codes.append(eco_id)
return experimental_evidence_codes


def configure_parser() -> GafParser:
"""
Configures and returns a GafParser object.
Expand Down Expand Up @@ -139,12 +156,7 @@ def parse_p2g_gaf(self):
:return: None.
"""
p = configure_parser()
ecomap = EcoMap()
experimental_evidence_codes = []
for code, _, eco_id in ecomap.derived_mappings():
# remove PANTHER annotations
if code in ["IBA"]:
experimental_evidence_codes.append(eco_id)
experimental_evidence_codes = get_p2g_experimental_eco_codes(EcoMap())
with open(self.filepath, "r") as file:
for line in file:
annotation = p.parse_line(line)
Expand All @@ -161,8 +173,6 @@ def parse_p2g_gaf(self):
)
):
continue
if self.source is None and (source_assoc.provided_by == self.taxon_to_provider[self.target_taxon] or source_assoc.provided_by == "GO_Central"):
continue
if str(source_assoc.evidence.type) in experimental_evidence_codes:
continue # no IBAs
if str(source_assoc.object.id) in ["GO:0005575", "GO:0008150", "GO:0003674"]:
Expand Down

0 comments on commit b3f6d46

Please sign in to comment.