Skip to content

Commit

Permalink
Avoid importing source/ec module
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed Jun 7, 2024
1 parent 289ebad commit d91b81e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/indra_cogex/client/enrichment/mla.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def get_metabolomics_sets(
-------
: A dictionary of EC codes to set of ChEBI identifiers
"""
from indra_cogex.sources.ec import strip_ec_code
# Create local helper function instead of importing this from the sources/ec module
# to avoid importing the whole ec module
def _strip_ec_code(raw_code: str) -> str:
"""Strips off trailing dashes from ec codes"""
# Continue to strip off '.-' until name does not end with '.-'
while raw_code.endswith(".-"):
raw_code = raw_code[:-2]
return raw_code

rv = defaultdict(set)

evidence_line = minimum_evidence_helper(minimum_evidence_count)
Expand Down Expand Up @@ -111,7 +119,7 @@ def get_metabolomics_sets(
hgnc_id = hgnc_curie.replace("hgnc:", "", 1)
chebi_ids = {chebi_curie.split(":", 1)[1] for chebi_curie in chebi_curies}
for raw_ec_code in hgnc_to_enzymes.get(hgnc_id, []):
ec_code = strip_ec_code(raw_ec_code)
ec_code = _strip_ec_code(raw_ec_code)
ec_name = bio_ontology.get_name("ECCODE", ec_code)
rv[ec_code, ec_name].update(chebi_ids)
rv = dict(rv)
Expand Down

0 comments on commit d91b81e

Please sign in to comment.