post_element: Post elements to obtain a query ID

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/FILTERING-post_element.R

Description

Functionality to post up to 15 elements to include and up to 100 elements to exclude to obtain a queryId for use in chemspiderapi::get_queryId_status() and chemspiderapi::get_queryId_results().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
post_element(
  includeElements,
  excludeElements,
  includeAll = FALSE,
  complexity = "any",
  isotopic = "any",
  orderBy = "recordId",
  orderDirection = "ascending",
  apikey,
  coerce = FALSE,
  simplify = FALSE
)

Arguments

includeElements

A character vector of elements to include; maximum length 15.

excludeElements

A character vector of elements to exclude; maximum length 100.

includeAll

logical: Only look for records containing ALL elements of includeElement?

complexity

See Details.

isotopic

See Details.

orderBy

A character vector indicating by which parameter to order. Defaults to recordId; see Details for options.

orderDirection

A character vector indicating in which direction to order; either ascending (default) or descending.

apikey

A 32-character string with a valid key for ChemSpider's API services.

coerce

logical: should the list be coerced to a data.frame? Defaults to FALSE.

simplify

logical: should the results be simplified to a vector? Defaults to FALSE.

Details

Says ChemSpider:

"Optionally, you can also submit orderBy and orderDirection to specify the sort order for the results. If you do not specify a value for orderBy, results are sorted by [recordId] by default."

Valid values for orderBy are recordId, massDefect, molecularWeight, referenceCount, dataSourceCount, pubMedCount, rscCount.

Valid values for orderDirection are ascending, descending.

The default behavior is to consider records which contain any of the elements listed in includeElements. Setting includeAll to TRUE will only consider records which contain all the elements listed in the includeElements.

Valid values for complexity are "any", "single", or "multiple" whereby a compound with a complexity of multiple has more than one disconnected system in it or a metal atom or ion.

Valid values for isotopic are "any", "labeled", or "unlabeled"."

Value

Returns the queryId string as (named) character vector.

Author(s)

Raoul Wolf (https://github.com/RaoulWolf/)

See Also

https://developer.rsc.org/compounds-v1/apis/post/filter/element

Examples

1
2
3
4
5
6
7
8
## Not run: 
## Post the elements for caffeine and exclude certain elements
includeElements <- c("C", "H", "N", "O")
excludeElements <- c("K", "Na", "Fe", "Cl", "F")
apikey <- "a valid 32-character ChemSpider apikey"
post_element(includeElements = includeElements, excludeElements = excludeElements, apikey = apikey)

## End(Not run)

NIVANorge/chemspiderapi documentation built on Jan. 10, 2021, 10:12 a.m.