# \donttest{
# Isomeric SMILES of the compounds
props <- get_properties(
properties = c("MolecularWeight", "MolecularFormula", "InChI"),
identifier = c("aspirin", "ibuprofen", "caffeine"),
namespace = "name"
)
# Properties for a selected compound
instance(props, "aspirin")
retrieve(props, .which = "aspirin", .slot = NULL)
retrieve(instance(props, "aspirin"), .slot = NULL)
# Combine properties of all compounds into a single data frame (or list)
retrieve(props, .combine.all = TRUE)
# Return selected properties
retrieve(props, .combine.all = TRUE,
.slot = c("MolecularWeight", "MolecularFormula"))
# Return properties for the compounds in a range of CIDs
props <- get_properties(
properties = c("mass", "molecular"),
identifier = 2244:2255,
namespace = "cid",
propertyMatch = list(
type = "contain"
)
)
retrieve(props, .combine.all = TRUE, .to.data.frame = TRUE)
# Return all available properties of the requested compounds
props <- get_properties(
properties = NULL,
identifier = 2244:2245,
namespace = "cid",
propertyMatch = list(
type = "all"
)
)
retrieve(props, .combine.all = TRUE)
# }
#### EXAMPLES FOR property_map() ####
# List all available properties:
property_map(type = "all")
# Exact match:
property_map("InChI", type = "match")
property_map("InChi", type = "match",
.ignore.case = TRUE) # Returns no match. Ignores '.ignore.case'
# Match at the start/end:
property_map("molecular", type = "start", .ignore.case = TRUE)
property_map("mass", type = "end", .ignore.case = TRUE)
# Partial match with multiple search patterns:
property_map(c("molecular", "mass", "inchi"),
type = "contain", .ignore.case = TRUE)
Run the code above in your browser using DataLab