"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
    "Databases"(required)list of databases to use
    "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
    "Databases"(required)list of databases to use
    "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
    "Fields"Alllist of fields to return
  • Compound Thumbnail

    Request:

    "CompoundThumbnail" get an image of the compound

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

    Request:

    "Convert" translate between identifier types

    Parameters:
  • "Query"(required)search query
    "InputFormat"(required)input format
    "OutputFormat"(required)output format
  • List of Data Sources

    Request:

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

    Validate an InChIKey

    Request:

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

    Parameters:
  • "InChIKey"(required)InChIKey string to validate
  • Compound Molecule

    Request:

    "CompoundMOL" get the molecule of a compound

    Parameters:
  • "ID"(required)ChemSpider ID
  • Parameter Details

    Possible forms for "Query" in the request "Search" include:
  • stringsimple string
    {"InChI",string}International Chemical Identifier
    {"InChIKey",string}International Chemical Identifier key
    {"Name",string}compund name
    {"SMILES",string}SMILES string
  • 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 fields in the request "CompoundInformation" include :
  • "AverageMass"average mass
    "CommonName"common name
    "DataSourceCount"data source count
    "Formula"formula
    "InChI"International Chemical Identifier
    "InChIKey"International Chemical Identifier key
    "MOL2D"2D MDL MOL file
    "MOL3D"3D MDL MOL file
    "MolecularWeight"molecular weight
    "MonoisotopicMass"monoisotopic mass
    "NominalMass"nominal mass
    "PubMedCount"PubMed count
    "ReferenceCount"reference count
    "RSCCount"RSC count
    "SMILES"SMILES string
    "StdInChI"standard InChI
    "StdInChIKey"standard InChI key
  • Supported input formats in the request "Convert" include:
  • "InChI"International Chemical Identifier
    "InChIKey"International Chemical Identifier key
    "SMILES"SMILES string
  • Supported output formats in the request "Convert" include:
  • "InChI"International Chemical Identifier
    "InChIKey"International Chemical Identifier key
    "MOL"MDL MOL file
    "SMILES"SMILES string
  • Examples

    Basic Examples  (1)

    Create a new connection by launching an authentication dialog:

    Get a sample of available databases:

    Search for a structure by name or keyword:

    Search for a compound ID by InChI:

    Search for a compound ID by SMILES:

    Search by chemical formula:

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

    Get full information about a compound:

    Get specific fields about a compound's information:

    Get an image of a compound:

    Convert from InChI to SMILES:

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

    Check if an InChIKey is valid:

    Get the molecule of a compound:

    Get a 2D and 3D plots of the molecule:

    Introduced in 2016
     (10.4)