Comments (8)
Hi,
Yes, of course this is supported. For molecules:
from chembl_webresource_client.new_client import new_client
molecule = new_client.molecule
molecule.set_format('json')
res = molecule.search('viagra')
For targets:
from chembl_webresource_client.new_client import new_client
target = new_client.target
target.set_format('json')
res = target.search('lipoxygenase')
For more advanced examples, please take a look at tests file: https://github.com/chembl/chembl_webresource_client/blob/master/chembl_webresource_client/tests.py
from chembl_webresource_client.
Thank you ! I've been looking at the REST API and trying to figure out how to filter based on the molecule_synonyms/molecule_synonym
from chembl_webresource_client.
You can do that as well:
target = new_client.target
gene_name = 'GABRB2'
targets_for_gene = target.filter(target_components__target_component_synonyms__component_synonym__icontains=gene_name)
or shorter:
shortcut = target.filter(target_synonym__icontains=gene_name)
The difference is that the 'search' method uses solr index so it's faster. When you are using 'filter' you have to know exactly where you want to search and it can be slower.
from chembl_webresource_client.
Much rather use the solr index. Out of curiosity though, how would you search for molecule synonyms using a filter ?
from chembl_webresource_client.
Since a single molecule may have multiple synonyms (one to many relation) and there is no separate endpoint for synonyms this is not possible to do directly apply such a filter on the molecule entity. This is (one of the reasons) why we exposed another endpoint called 'drug': https://www.ebi.ac.uk/chembl/api/data/drug.json. But please note it only contains approved drugs (max_phase=4).
Example of searching for synonym using URL:
https://www.ebi.ac.uk/chembl/api/data/drug.json?synonyms__icontains=prazosin
and the client:
drug = new_client.drug
res = drug.filter(synonyms__icontains="prazosin")
For a general synonym search across all ChEMBL molecules, the solr based 'search' method is the only option though.
from chembl_webresource_client.
Hi,
I'm closing this issue now but feel free to reopen if you have some more questions about this topic. For other questions, please create a new issue.
from chembl_webresource_client.
from chembl_webresource_client.
I just downloaded the conda package from here. When I run:
target.filter(target_components__target_component_synonyms__component_synonym__icontains=gene_name)
or
target.filter(target_synonym__icontains=gene_name)
I get
TypeError: 'NoneType' object cannot be interpreted as an integer
I can run in once and then it breaks there after.
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.