jacobwindsor / pubchem-ranker

Ranks compounds by number of BioAssays or BioSystems in PubChem
MIT License
2 stars 1 forks source link

Increase speed of the ranker #1

Open jacobwindsor opened 8 years ago

jacobwindsor commented 8 years ago

Currently the ranker (DataManipulators/Counter.py) runs one query to PubChem for each compound in the dataset. Obviously this is incredibly slow and laborious but could be made faster with one query.

A request to https://pubchem.ncbi.nlm.nih.gov/sdq/sdqagent.cgi takes an SQL query string encoded in JSON as the query.

Example JSON:

{"select": "*", "collection": "biosystem", "where": {"cid": 1234}, "start": 1, "limit": 10}

Could use SQLs GROUP statement to group by CIDs and query for all of the CIDs in the dataset at once to get the counts. This is easily possible with bioassays since each bioassay has only one CID. However, the biosystems have multiple CIDs so cannot group by CIDs. Maybe there is an alternative solution though...