Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uniprot sourcename fix #108

Merged
merged 11 commits into from
Feb 8, 2024
Prev Previous commit
Next Next commit
Add uniprot constants.
bsantan committed Feb 7, 2024
commit 51f3a6cb366ff0914e4524713e4f875e75e7bc99
2 changes: 2 additions & 0 deletions kg_microbe/transform_utils/constants.py
Original file line number Diff line number Diff line change
@@ -234,3 +234,5 @@
ORGANISM_TO_ENZYME_EDGE = "biolink:expresses"
ENZYME_CATEGORY = "biolink:Enzyme"
CHEMICAL_TO_ENZYME_EDGE = "biolink:binds_to"
UNIPROT_GENOME_FEATURES = "uniprot_genome_features"
UNIPROT_PREFIX = "Uniprot"
15 changes: 9 additions & 6 deletions kg_microbe/transform_utils/uniprot/uniprot.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,10 @@
from kg_microbe.transform_utils.constants import (
ORGANISM_TO_ENZYME_EDGE,
CHEMICAL_TO_ENZYME_EDGE,
ENZYME_CATEGORY
ENZYME_CATEGORY,
UNIPROT_GENOME_FEATURES,
UNIPROT_PREFIX,
NCBITAXON_PREFIX
)

class UniprotTransform(Transform):
@@ -34,7 +37,7 @@ def __init__(self, input_dir: Optional[Path] = None, output_dir: Optional[Path]

self.__enz_data = {}

source_name = "uniprot_genome_features"
source_name = UNIPROT_GENOME_FEATURES
super().__init__(source_name, input_dir, output_dir)


@@ -148,9 +151,9 @@ def write_to_df(self,uniprot_values, edge_writer, node_writer):
if organism_id:

edges_data_to_write = [
'NCBITaxon:'+str(organism_id),
NCBITAXON_PREFIX+str(organism_id),
ORGANISM_TO_ENZYME_EDGE,
'Uniprot'+':'+self.__enz_data['id'],
UNIPROT_PREFIX+':'+self.__enz_data['id'],
'',
self.source_name
]
@@ -163,7 +166,7 @@ def write_to_df(self,uniprot_values, edge_writer, node_writer):
edges_data_to_write = [
chem,
CHEMICAL_TO_ENZYME_EDGE,
'Uniprot'+':'+self.__enz_data['id'],
UNIPROT_PREFIX+':'+self.__enz_data['id'],
'',
self.source_name
]
@@ -172,7 +175,7 @@ def write_to_df(self,uniprot_values, edge_writer, node_writer):


nodes_data_to_write = [
'Uniprot'+':'+self.__enz_data['id'], ENZYME_CATEGORY,self.__enz_data['name'],'','',self.source_name,''
UNIPROT_PREFIX+':'+self.__enz_data['id'], ENZYME_CATEGORY,self.__enz_data['name'],'','',self.source_name,''
]

node_writer.writerow(nodes_data_to_write)