BiodbCompounddbConn-class {biodb} | R Documentation |
This interface is inherited by all compound databases. It declares method headers specific to compound databases.
annotateMzValues(
x,
mz.tol,
ms.mode,
mz.tol.unit = c("plain", "ppm"),
mass.field = "monoisotopic.mass",
max.results = 3,
mz.col = "mz",
fields = NULL,
prefix = NULL,
insert.input.values = TRUE,
fieldsLimit = 0
)
:
Annotates a mass spectrum with the database. For each matching entry the entry field values will be set inside columns appended to the data frame. Names of these columns will use a common prefix in order to distinguish them from other data from the input data frame.
x: Either a data frame or a numeric vector containing the M/Z values.
mz.col: The name of the column where to find M/Z values in case x is a data frame.
ms.mode: The MS mode. Set it to either 'neg' or 'pos'.
mz.tol: The tolerance on the M/Z values.
mz.tol.unit: The type of the M/Z tolerance. Set it to either to 'ppm' or 'plain'.
mass.field: The mass field to use for matching M/Z values. One of: 'monoisotopic.mass', 'molecular.mass', 'average.mass', 'nominal.mass'.
fields: A character vector containing the additional entry fields you would like to get for each matched entry. Each field will be output in a different column.
insert.input.values: Insert input values at the beginning of the result data frame.
prefix: A prefix that will be inserted before the name of each added column in the output. By default it will be set to the name of the database followed by a dot.
fieldsLimit: The maximum of values to output for fields with multiple values. Set it to 0 to get all values.
max.results: If set, it is used to limit the number of matches found for each M/Z value. To get all the matches, set this parameter to NA_integer_. Default value is 3.
Returned value: A data frame containing the input values, and annotation columns appended at the end. The first annotation column contains the IDs of the matched entries. The following columns contain the fields you have requested through the 'fields' parameter.
searchCompound(
name = NULL,
mass = NULL,
mass.field = NULL,
mass.tol = 0.01,
mass.tol.unit = "plain",
max.results = 0
)
:
This method is deprecated. Use searchForEntries() instead.
Searches for compounds by name and/or by mass. At least one of name or mass must be set.
name: The name of a compound to search for.
description: A character vector of words or expressions to search for inside description field. The words will be searched in order. A match will be made only if all words are inside the description field.
mass: The searched mass.
mass.field: For searching by mass, you must indicate a mass field to use ('monoisotopic.mass', 'molecular.mass', 'average.mass' or 'nominal.mass').
mass.tol: The tolerance value on the molecular mass.
mass.tol.unit: The type of mass tolerance. Either 'plain' or 'ppm'.
max.results: The maximum number of matches to return.
Returned value: A character vector of entry IDs.
Super class BiodbConn
.
# Create an instance with default settings: mybiodb <- biodb::newInst() # Get a compound CSV file database chebi.tsv <- system.file("extdata", "chebi_extract.tsv", package='biodb') # Get the connector of a compound database conn <- mybiodb$getFactory()$createConn('comp.csv.file', url=chebi.tsv) # Search for compounds ids <- conn$searchCompound(name='prion protein', max.results=10) # Terminate instance. mybiodb$terminate()