"ChemSpider" (Service Connection)

Connect to the ChemSpider API using the Wolfram Language to query extensive data on chemical structures and their properties.

Connecting & Authenticating

ServiceConnect["ChemSpider"] creates a connection to the ChemSpider API. If a previously saved connection can be found, it will be used; otherwise, a new authentication request will be launched.

Requests

ServiceExecute["ChemSpider","request",params] sends a request to the ChemSpider API, using parameters params. The following give possible requests.

Search Compounds

Request:

"Search" search by chemical identifier (name, SMILES, InChI, or InChIKey), molecular formula, or mass

Parameters (search by identifier):
  • "Query"(required)search query
  • "SortBy"Nonefields to order by
    "StartIndex"1start index
    MaxItems10number of elements to return
  • Parameters (search by formula):
  • "Formula"(required)formula to search by
    "StartIndex"1start index
    MaxItems10number of elements to return
  • Parameters (search by mass):
  • "Mass"(required)mass value to search by
    "Range"(required)range of mass used for the search
    "StartIndex"1start index
    MaxItems10number of elements to return
  • Compound Information

    Request:

    "CompoundInformation" get record details (CSID, StdInChIKey, StdInChI, SMILES) by ID

    Parameters:
  • "ID"(required)ChemSpider ID
  • Compound Thumbnail

    Request:

    "CompoundThumbnail" get an image of the compound

    Parameters:
  • "ID"(required)ChemSpider ID
  • Find Corresponding Chemical Identifiers

    Request:

    "GetIdentifier" translate between identifier types

    Parameters:
  • "MOL"NoneMOL string or list of strings to convert
  • "InChI"NoneInChI string or list of strings to convert
    "InChIKey"NoneInChIKey string or list of strings to convert
    "ID"NoneChemSpider ID or list of IDs to convert
    "Identifier"(required)output identifier ("MOL", "InChI", "InChIKey", "ID")
    "Options""ExactMatch"only valid when converting "MOL" to "ID"
  • List of Data Sources

    Request:

    "Databases" get a list of all data sources used in ChemSpider

    More Compound Information

    Request:

    "ExtendedCompoundInformation" get extended record details by ID

    Parameters:
  • "ID"(required)ChemSpider ID
  • List of All Spectra Information

    Request:

    "AllSpectraInformation" retrieve information for all Open Access spectra in database

    Compound Spectra

    Request:

    "CompoundSpectraInformation" retrieve information about spectra associated with a particular compound

    Parameters:
  • "ID"(required)ChemSpider ID
  • Spectrum Information

    Request:

    "SpectrumInformation" retrieve information about the particular spectrum

    Parameters:
  • "SpectrumID"(required)spectrum ID
  • Validate an InChIKey

    Request:

    "InChIKeyQ" check if the specified argument is a valid InChIKey

    Parameters:
  • "InChIKey"(required)InChIKey string to validate
  • Parameter Details

    Possible values for "SortBy" in the request "Search" include:
  • "ID"identifier
    "MolecularWeight"molecular weight
    "ReferenceCount"reference count
    "DataSourceCount"data source count
    "PubMedCount"PubMed count
    "RSCCount"RSC count
  • Possible values for "Options" in the request "GetIdentifier" include:
  • "ExactMatch"exact match
    "AllTautomers"all tautomers
    "SameSkeletonAndH"same skeleton including H
    "SameSkeleton"same skeleton excluding H
    "AllIsomers"all isomers
  • Examples

    Basic Examples  (4)

    Create a new connection by launching an authentication dialog:

    In[1]:=
    Click for copyable input
    Out[1]=

    Search for a structure by name or keyword:

    In[2]:=
    Click for copyable input
    Out[2]=

    Search by chemical formula:

    In[3]:=
    Click for copyable input
    Out[3]=

    Search for compounds with a molecular mass within a given range:

    In[4]:=
    Click for copyable input
    Out[4]=

    Get basic or extended information about compounds:

    In[1]:=
    Click for copyable input
    Out[1]=
    In[2]:=
    Click for copyable input
    Out[2]=

    Get a structure diagram for a given compound ID:

    In[3]:=
    Click for copyable input
    Out[3]=

    Get information about available spectra in ChemSpider:

    In[1]:=
    Click for copyable input
    Out[1]=

    Get detailed information about a particular spectrum:

    In[2]:=
    Click for copyable input
    Out[2]=

    Translate between InChI and ChemSpider ID:

    In[1]:=
    Click for copyable input
    In[2]:=
    Click for copyable input
    Out[2]=
    In[3]:=
    Click for copyable input
    Out[3]=
    In[4]:=
    Click for copyable input
    Out[4]=

    For a given InChI code, get the corresponding MOL file:

    In[5]:=
    Click for copyable input
    Out[5]=

    Use the retrieved MOL string for further computations:

    In[6]:=
    Click for copyable input
    Out[6]=

    Count all heavy atoms:

    In[7]:=
    Click for copyable input
    Out[7]=