A key is a variable that is used to identify features within an
object. These features can refer to spectra in a Spectra object,
peptide-spectrum matches in a PSM object, or PSMs, peptides of
proteins in a SummarizedExperiment or QFeatures object. They
do not need to be unique.
The goal of a key is to identify matching features across data
types, such as for example to match de MS spectra to the PSMs and
peptides. These different data types can be stored together in an
MsExperiment object, and matched through one or multiple keys.
There are two general functions to work with keys across objects:
addKey(object, vars, key, force, sep) will add a key named
key to an object based on user-defined variables vars.
filterKey(object, value, key, keep) will subset object
based on a value in key.
getKey(object, key, drop) will return the values of variable
key in object.
# S4 method for class 'SummarizedExperiment'
addKey(object, vars = NULL, key = ".KEY", force = FALSE, sep = ".")
# S4 method for class 'Spectra'
addKey(object, vars = NULL, key = ".KEY", force = FALSE, sep = ".")
# S4 method for class 'PSM'
addKey(object, vars = NULL, key = ".KEY", force = FALSE, sep = ".")
# S4 method for class 'QFeatures'
addKey(object, vars = NULL, key = ".KEY", force = FALSE, sep = ".")
# S4 method for class 'Spectra'
filterKey(object, value, key = ".KEY")
# S4 method for class 'PSM'
filterKey(object, value, key = ".KEY")
# S4 method for class 'SummarizedExperiment'
filterKey(object, value, key = ".KEY")
# S4 method for class 'QFeatures'
filterKey(object, value, key = ".KEY", keep = FALSE)
# S4 method for class 'MsExperiment'
filterKey(
object,
value,
key = ".KEY",
data = c("spectra", "qdata"),
otherdata = NULL,
keep = FALSE
)
# S4 method for class 'PSM'
getKey(object, key = ".KEY")
# S4 method for class 'Spectra'
getKey(object, key = ".KEY")
# S4 method for class 'SummarizedExperiment'
getKey(object, key = ".KEY")
# S4 method for class 'QFeatures'
getKey(object, key = ".KEY", drop = TRUE)An instance of class SummarizedExperiment,
QFeatures, PSM or Spectra.
character() referencing the variables to use to
create the key. These are to be found in the object's
rowData (for SummarizedExperiment and QFeatures objects)
or spectraData (for Spectra objects) or in the object
itself (for PSM objects). Throws an error if the variables
aren't found. Default is NULL.
character(1) defining the key's name. Default is
".KEY".
logical(1) that defines is an existing key should
be overwritten. Default is FALSE and an error is thrown if
the key is already present.
character(1) specifying the separator when multiple
variables are pasted together to generate the key. Default is
".".
character() containing the value of key of the
feature(s) of interest.
logical(1) that defines whether to keep assays that
didn't contain the key of interest. If TRUE, these are
returned as empty assays (i.e. with zero
rows/features). Default is FALSE`; only assays containing
matching keys are returned.
character() defining what data type to subset by
key. Default are "spectra" and "qdata". Note that these
data are ignored if their slot is NULL.
character() listing the name(s) of the
additional data types in otherData(.) to run filterKey()
on.
logical(1) defining whether to drop assays that
don't have the key variable. Default is TRUE.