Comments (5)
@wmmxk Have you solved this?
from chembl_webresource_client.
It turned out my code got stuck when fetching descriptor for one molecule. So I put my code in a try except statement. Now it is OK.
pbar = tqdm(enumerate(InchiKeys,1), total = len(InchiKeys))
descriptor_all = {}
molecule = new_client.molecule
for i, InchiKey in pbar:
try:
SMILE = molecule.get(InchiKey)['molecule_structures']['canonical_smiles']
chemical = utils.smiles2ctab(SMILE)
log_p = json.loads(utils.logP(chemical))[0]
descriptors = json.loads(utils.descriptors(chemical))[0]
descriptors["log_p"] = log_p
descriptor_all[InchiKey] = descriptors
except:
bad_keys.append(InchiKey)
from chembl_webresource_client.
thank you @wmmxk , using try except blocks worked for me as well :)
from chembl_webresource_client.
Hi @wmmxk, @hkmztrk, sorry it took me a while to get back to you, but I am in charge of other projects and I have not been able to work on the webs services lately, yes, the issue here is you are getting 404 when there are no molecules in the database with that inchi key, so the try/except is the right way to go. However, take into account that our smiles2ctab/logP/etc service is based on top of rdkit, but we are not sure sure wether it could fail for a given complex molecule. so if you want to know for sure wether the inchi key is in our database the try/except should only surround the molecule.get
pbar = tqdm(enumerate(inchi_keys,1), total = len(inchi_keys))
descriptor_all = {}
molecule = new_client.molecule
for i, inchi_key in pbar:
try:
smiles_i = molecule.get(inchi_key)['molecule_structures']['canonical_smiles']
except:
# Inchi key was not found in ChEMBL
bad_keys.append(inchi_key)
try:
molecule_ctab_i = utils.smiles2ctab(smiles_i)
log_p = json.loads(utils.logP(molecule_ctab_i))[0]
descriptors = json.loads(utils.descriptors(molecule_ctab_i))[0]
descriptors["log_p"] = log_p
descriptor_all[inchi_key] = descriptors
except:
# smiles2ctab, logP or something else failed
pass
from chembl_webresource_client.
Hi @juanfmx2 . No worries. I totally understand a programmer is usually working on a few projects. Yes, I agree I need to test the particular molecule which fails my code. Initially, I thought it is because the website does not allow too many visit from one IP in a very short time.
from chembl_webresource_client.
Related Issues (20)
- .filter for different names in "document_journal" column HOT 1
- Query hangs after reaching specific entry HOT 1
- Error for url https://www.ebi.ac.uk/chembl/api/data/activity.json, server response: <!doctype html> HOT 6
- Mechanism results do not match what is on the website HOT 3
- Isomeric SMILES string
- Problem with unichem.structure HOT 4
- Http Application error HOT 5
- Querying by inchi
- new_client is failing to import from chembl_webresource_client HOT 1
- Assay offsets and limit HOT 2
- How do I retrieve the Unichem Cross references as a dictionary/list for a CHEMBL compound?
- Fail to import new_client due to API problem HOT 5
- Fixed
- Space between words of the query
- HttpApplicationError HOT 8
- confidence score
- Error for url
- ChEMBL webresourse client issue
- status 500 with chembl_webresource_client.new_client
- Problem of parallelized big data mining via batch chunks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chembl_webresource_client.