post_mass: Post a monoisotopic mass and its range to obtain a query ID

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

View source: R/FILTERING-post_mass.R

Description

Functionality to POST an atomic mass and its range 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
post_mass(
  mass,
  range,
  dataSources = NULL,
  orderBy = "recordId",
  orderDirection = "ascending",
  apikey,
  coerce = FALSE,
  simplify = FALSE
)

Arguments

mass

A (double) number corresponding to the atomic mass (Da or g/mol) you are inquiring. Has to be within the range of [1,11000].

range

The range for the above mass, also as (double) number. Has to be within the range of [0.0001,100].

dataSources

Optional: A character vector specifying which data source to use. Use chemspiderapi::get_datasources() for a complete list of data sources. If none are specified (the default), will search all data sources, which can take substantially longer time to complete.

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

"Submit mass as a double between 1 and 11000 Atomic Mass Units, and a range between 0.0001 and 100 via POST. For example, if you specify a mass of 40 and a range of 5, all monoisotopic masses between 35 and 45 are searched.

[...] If dataSources is not specified, all known sources are searched. This will take longer.

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."

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/mass

Examples

1
2
3
4
5
6
7
8
## Not run: 
## Post the approximate atomic mass of caffeine and a sensible range
mass <- 194
range <- 0.002
apikey <- "a valid 32-character ChemSpider apikey"
post_mass(mass = mass, range = range, apikey = apikey)

## End(Not run)

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