PubChem is a typical compound database. Here, we will explain how to search PubChem data in Python.
If you want to search by compound name and get the CID or IUPAC name of the record obtained as a search result, you can use the get_compounds
method.
import pubchempy as pcp
glycine_pubchem = pcp.get_compounds('glycine', 'name')
result = {}
for record in glycine_pubchem:
result[record.cid] = record.iupac_name
print(result)
In the above example, the CID is stored in the key of the dictionary result
and the IUPA name is stored as the value.
If you want to get information such as molecular weight and Canonical SMILES, you can use the get_properties
method.
import pubchempy as pcp
target_properties = ['MolecularFormula', 'MolecularWeight', 'CanonicalSMILES']
result = pcp.get_prpperties(target_properties, 'glycine', 'name')
print(result)
In the above example, the physical property information you want to get is passed to the get_properties
method as a list.
Here's how to access PubChem data in Python.
With PubChemPy
, you can easily use the information stored in PubChem.
It's an essential tool for chemoinformatics, so make sure you have it ready for use.
How can chemoinformatics help pharmaceutical companies? What kind of knowledge do you need?
Recommended Posts