Skip to content

Commit

Permalink
remove some dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
amva13 committed Jan 11, 2025
1 parent 15af205 commit 10b0412
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 66 deletions.
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ datasets<2.20.0
evaluate==0.4.2
fuzzywuzzy>=0.18.0,<1.0
huggingface_hub>=0.20.3,<1.0
moleculeace==3.0.0
mygene>=3.2.2,<4.0.0
numpy>=1.26.4,<2.0.0
openpyxl>=3.0.10,<4.0.0
pandas>=2.1.4,<3.0.0
Expand Down
60 changes: 0 additions & 60 deletions tdc/test/test_model_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import unittest
import shutil
import pytest
import mygene
import numpy as np

# temporary solution for relative imports in case TDC is not installed
Expand All @@ -21,64 +19,6 @@
import requests


def get_ensembl_id(gene_symbols):
mg = mygene.MyGeneInfo()
return mg.querymany(gene_symbols,
scopes='symbol',
fields='ensembl.gene',
species='human')


def get_target_from_chembl(chembl_id):
# Query ChEMBL API for target information
chembl_url = f"https://www.ebi.ac.uk/chembl/api/data/{chembl_id}.json"
response = requests.get(chembl_url)

if response.status_code == 200:
data = response.json()
# Extract UniProt ID from the ChEMBL target info
for component in data.get('target_components', []):
for xref in component.get('target_component_xrefs', []):
if xref['xref_src_db'] == 'UniProt':
return xref['xref_id']
else:
raise ValueError(f"ChEMBL ID {chembl_id} not found or invalid.")
return None


def get_ensembl_from_uniprot(uniprot_id):
# Query UniProt API to get Ensembl ID from UniProt ID
uniprot_url = f"https://rest.uniprot.org/uniprotkb/{uniprot_id}.json"
response = requests.get(uniprot_url)

if response.status_code == 200:
data = response.json()
# Extract Ensembl Gene ID from the cross-references
for xref in data.get('dbReferences', []):
if xref['type'] == 'Ensembl':
return xref['id']
else:
raise ValueError(f"UniProt ID {uniprot_id} not found or invalid.")
return None


def get_ensembl_id_from_chembl_id(chembl_id):
try:
# Step 1: Get UniProt ID from ChEMBL
uniprot_id = get_target_from_chembl(chembl_id)
if not uniprot_id:
return f"No UniProt ID found for ChEMBL ID {chembl_id}"

# Step 2: Get Ensembl ID from UniProt
ensembl_id = get_ensembl_from_uniprot(uniprot_id)
if not ensembl_id:
return f"No Ensembl ID found for UniProt ID {uniprot_id}"

return f"Ensembl ID for ChEMBL ID {chembl_id}: {ensembl_id}"
except Exception as e:
return str(e)


def quant_layers(model):
layer_nums = []
for name, parameter in model.named_parameters():
Expand Down
3 changes: 0 additions & 3 deletions tdc/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,3 @@
retrieve_benchmark_names,
)
from .query import uniprot2seq, cid2smiles

from ..feature_generators.data_feature_generator import DataFeatureGenerator
from ..feature_generators.protein_feature_generator import ProteinFeatureGenerator
2 changes: 1 addition & 1 deletion tdc/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
#
__version__ = "1.1.4" # pragma: no cover
__version__ = "1.1.5" # pragma: no cover

0 comments on commit 10b0412

Please sign in to comment.