getPCIDs.CIDtype: Retrieve various CID types from CID via PubChem

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ChemicalCuration.R

Description

Retrieves the various types of related CIDs from a query CID from PubChem using PUG REST. See details.

Usage

1
getPCIDs.CIDtype(query, type="parent", from = "cid", to = "cids", timeout=30)

Arguments

query

Input CID (as string) to search

from

Type of input ID (default "cid" should be kept for this function to work as expected).

to

Type of output desired (default "cids" should be kept for this function to work as expected).

timeout

The timeout, in seconds.

Details

For this function to work as expected, only one search entry should be used. The URL can accept comma separated CIDs, but this is currently ignored downstream. Thanks to Paul Thiessen and Evan Bolton from PubChem team for assistance.

PubChem have a lot of related CIDs, for instance for this record: https://pubchem.ncbi.nlm.nih.gov/compound/1234#section=Related-Compounds. This function enables you to retrieve CIDs by these different types: original, parent, component, similar_2d, similar_3d, same_stereo, same_isotopes, same_connectivity, same_tautomer, same_parent, same_parent _stereo, same_parent _isotopes, same_parent _connectivity, same_parent _tautomer (if more options are available but not implemented here, this will fail the input tests, pls post an issue). If you have a mixture, "component" gives you the components of the mixture. If you have an individual component, "component" gives you all the mixtures containing this component. If the CID is a "parent", it is the neutralized form.

Value

A list containing the related CIDs of the desired type

Author(s)

Emma Schymanski <emma.schymanski@uni.lu>

References

PubChem search: http://pubchem.ncbi.nlm.nih.gov/

PubChem PUG REST: https://pubchemdocs.ncbi.nlm.nih.gov/pug-rest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# The original returns the input
getPCIDs.CIDtype("3053",type="original")
# Find the parent CID (neutral version) for a salt
getPCIDs.CIDtype("167781",type="parent")
# If the parent is not available, go to "component" and get the bits
getPCIDs.CIDtype("104265",type="parent")
# [1] NA
getPCIDs.CIDtype("104265",type="component")
# [1] 13360  1004
# For deprecated records, only "original" works
getPCIDs.CIDtype("4644",type="parent")
# [1] NA
getPCIDs.CIDtype("4644",type="original")
# [1] 4644
getPCIDs.CIDtype("4644",type="component")
# [1] NA

schymane/RChemMass documentation built on Jan. 25, 2021, 5:45 a.m.