emzed.chemistry.pubchem module¶
- class emzed.chemistry.pubchem.PubChemAccessor[source]¶
Bases:
object
- get_count(search_term=None)[source]¶
Count number of compuouds for given search term.
- Parameters:
search_term – In case search term is not provided we search for compounds which are from KEGG, HMDB or Biocyc and carry no charge. For more complicated searches, like restricting the search term only for some fields, the term can be constructed manually by using the search form at https://www.ncbi.nlm.nih.gov/pccompound/advanced
- Returns:
integer number
- get_identifiers(start=0, end=1000000, search_term=None, source=None)[source]¶
Get compuoud identifiers for given search term. These can be used later for retrieving details of compounds.
- Parameters:
start – fetch results starting and given index
end – fetch results up to given index
search_term – In case search term is not provided we search for compounds which comd from KEGG, HMDB or Biocyc and carry no charge. For more complicated searches, like restricting the search term only for some fields, the term can be constructed manually by using the search form at https://www.ncbi.nlm.nih.gov/pccompound/advanced
source – in case the user does not provie a search term on can restrict fetching user ids from specified source, like ‘HMDB’ only.
- Returns:
list of strings
- get_summary_data(ids)[source]¶
Fetches data for given compound ids.
- Parameters:
ids – list of compound ids. you can use get_identifiers to dermine identifiers by searching for terms and meta data first.
- Returns:
dictionary mapping each id to a dictionary with keys ‘cid’, ‘molecularweight’, ‘molecularformula’, ‘iupacname’, ‘inchi’, ‘inchikey’, ‘canonicalsmiles’ and ‘synonymlist’.
- register_pubchem_api_key(email_address, api_key, *, overwrite=False)[source]¶
The api key is required if you want to donwload larger amounts of data or if you make more than 3 requests per second.
You have to create a user accout at https://www.ncbi.nlm.nih.gov
To create the key, go to the “Settings” page of your NCBI account. (Hint: after signing in, simply click on your NCBI username in the upper right corner of any NCBI page.)
You’ll see a new “API Key Management” area. Click the “Create an API Key” button, and copy the resulting key.
- Parameters:
email_address – your valid email address.
api_key – valid API key
overwrite – overwrite existing data.