webchem R Package

repository·master·Indexed 41 days ago

https://github.com/ropensci/webchem

An R package providing a unified interface to retrieve chemical information from web-based APIs and databases, including PubChem, ChEBI, ChemSpider, and ChEMBL. It supports both active web service connections and offline local querying for specific databases to improve speed and reproducibility.

Tokens
677
Snippets
2
Records
7
Agent score
49%

What's inside webchem

  1. Install the webchem R package

    master

    You can install webchem from CRAN for the stable version, or from GitHub for the development version.

    Install stable version from CRAN

    install.packages("webchem")

    Install development version from GitHub

    install.packages("devtools")
    library("devtools")
    install_github("ropensci/webchem")
    install.packages("webchem")
  2. Understand webchem function naming conventions

    master

    Functions in webchem that interact with specific web APIs follow a predictable naming pattern based on their purpose:

    1. API Interaction: prefix_suffix()

      • The prefix identifies the source API.
      • The suffix identifies the functionality.
      • Example: cs_compinfo uses ChemSpider (cs) to retrieve compound information (compinfo).
    2. Identifier Retrieval: get_identifier()

      • Used when the primary goal is to retrieve database-specific IDs.
      • Example: get_csid() retrieves ChemSpider IDs.
  3. Use offline access for reproducibility

    master

    For databases marked with a checkmark in the 'Offline' column (e.g., ChEMBL, FooDB, EU Pesticides), webchem can download the database for local querying.

    Benefits of offline access:

    • Faster queries.
    • Works without an internet connection.
    • Ensures results are consistent and reproducible for analyses.
  4. Install webchem

    master

    You can install the stable version of webchem from CRAN or the development version from GitHub.

    Install from CRAN (stable version)

    install.packages("webchem")

    Install from GitHub (development version)

    install.packages("devtools")
    library("devtools")
    install_github("ropensci/webchem")
    install.packages("webchem")
  5. Reference of supported chemical databases

    master

    The following databases are accessible via webchem. Note that some support offline access (local querying), which is faster and more reproducible, while others require active web service connections.

    DatabaseWebserviceOffline
    BCPC Compendium of Pesticide Common Names✅❌
    ChEBI✅❌
    ChEMBL✅✅
    Chemical Identifier Resolver (CIR)✅❌
    Chemical Translation Service (CTS)✅❌
    ChemSpider (requires API token)✅❌
    ETOX✅❌
    EU Pesticides❌✅
    Flavornet✅❌
    FooDB❌✅
    NIST (gas chromatography retention indices)✅❌
    OPSIN✅❌
    PubChem✅❌
    U.S. EPA Substance Registry Service (SRS)✅❌
    Wikidata✅❌