Skip to content

Commit

Permalink
use encoded_by for MGI id
Browse files Browse the repository at this point in the history
  • Loading branch information
sierra-moxon committed Dec 21, 2023
1 parent f9582cb commit 665c312
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/gopreprocess/file_processors/gpi_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ def get_protein_xrefs(self) -> (dict, dict):
for xid in row.get("xrefs"):
if xid.startswith("UniProtKB:"):
xref_ids[row.get("id")] = xid
for parent in row.get("parents"):
if parent.startswith("MGI:MGI:"):
parent_xref_ids[row.get("id")] = parent
if row.get("id") == "PR:Q9DAL9":
print(row)
if row.get("encoded_by").startswith("MGI:"):
parent_xref_ids[row.get("id")] = row.get("encoded_by")

qc_filename = "xref_pr.txt"
with open(qc_filename, "w") as file:
Expand Down
8 changes: 4 additions & 4 deletions src/gopreprocess/goa_annotation_creation_controller.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Protein 2 GO AnnotationConverter class."""
import copy
import datetime
from typing import Any, Union
from typing import Any, Union, Tuple

import pystow
from ontobio.model.association import Curie, GoAssociation
Expand Down Expand Up @@ -64,7 +64,7 @@ def generate_annotation(

def get_source_annotations(
isoform: bool, taxon: str
) -> tuple[dict, dict, Any, Any, dict] | tuple[dict, dict, Any, None, dict]:
) -> tuple[dict, Any, Any, Any, Any] | tuple[dict, dict, Any, None, None]:
"""
Get the source annotations from the protein 2 GO GAF file.
Expand Down Expand Up @@ -95,9 +95,9 @@ def get_source_annotations(
)
gp_isoform = GafProcessor(filepath=p2go_isoform_file)
source_isoform_annotations = gp_isoform.parse_p2g_gaf()
return xrefs, protein_xrefs, source_annotations, source_isoform_annotations
return xrefs, protein_xrefs, source_annotations, source_isoform_annotations, parent_xrefs
else:
return xrefs, xrefs, source_annotations, None, parent_xrefs
return xrefs, xrefs, source_annotations, None, None


def dump_annotations(annotations, isoform):
Expand Down

0 comments on commit 665c312

Please sign in to comment.