get_properties {PubChemR}R Documentation

Retrieve Compound Properties from PubChem

Description

This function sends a request to PubChem to retrieve compound properties based on the specified parameters. It returns a list or dataframe of properties corresponding to the provided identifiers.

Usage

get_properties(
  properties,
  identifier,
  namespace = "cid",
  searchtype = NULL,
  as_dataframe = FALSE,
  options = NULL
)

Arguments

properties

A character vector specifying the properties to be retrieved.

identifier

A vector of positive integers (e.g. cid, sid, aid) or identifier strings (source, inchikey, formula). In some cases, only a single identifier string (name, smiles, xref; inchi, sdf by POST only).

namespace

Specifies the namespace for the query. For the 'compound' domain, possible values include 'cid', 'name', 'smiles', 'inchi', 'sdf', 'inchikey', 'formula', 'substructure', 'superstructure', 'similarity', 'identity', 'xref', 'listkey', 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure', and 'fastformula'. For other domains, the possible namespaces are domain-specific.

searchtype

Specifies the type of search to be performed. For structure searches, possible values are combinations of 'substructure', 'superstructure', 'similarity', 'identity' with 'smiles', 'inchi', 'sdf', 'cid'. For fast searches, possible values are combinations of 'fastidentity', 'fastsimilarity_2d', 'fastsimilarity_3d', 'fastsubstructure', 'fastsuperstructure' with 'smiles', 'smarts', 'inchi', 'sdf', 'cid', or 'fastformula'.

as_dataframe

If TRUE it return a dataframe.

options

Additional arguments passed to get_json.

Value

If 'as_dataframe' is FALSE, a named list where each element corresponds to the properties retrieved from PubChem. If 'as_dataframe' is TRUE, a dataframe where each row corresponds to the properties retrieved from PubChem. The names of the list elements or row names of the dataframe are based on the provided identifiers.

Examples

get_properties(
  properties = "IsomericSMILES",
  identifier = "aspirin",
  namespace = "name"
)

[Package PubChemR version 1.2 Index]