msDat {PepSAVIms} | R Documentation |
Constructor for class msDat
Description
Creates a data structure encapsulating the mass spectrometry intensity readings as well as identifying information
Usage
msDat(mass_spec, mtoz, charge, ms_inten = NULL)
Arguments
mass_spec |
Either a For example, suppose that a collection of mass spectrometry intensity
observations has provided data for 50 fractions across 20,000
mass-to-charge values. Then the input for |
mtoz |
A vector of either length 1 or length equal to the number of mass-to-charge values for which mass spectrometry data was collected, and which helps identify the mass-to-charge values for this data in one of several ways. One way to provide the information is to provide a numeric vector where
each entry provides the mass-to-charge value for a corresponding row of
mass spectrometry data. Then the A second way is to provide a single number which specifies the column
index in the A third way is provide a single character string which provides the
column name in the |
charge |
The information for the |
ms_inten |
Either |
Details
Since the mass spectrometry data could conceivably be available to
the researcher in a variety forms, this function attempts to provide a
uniform data structure for encapsulating this information. It is the
fundamental data structure containing the mass spectrometry data used
internally by the filterMS
and rankEN
routines. The
external interface for msDat
is provided to the user so that
specifying the mass spectrometry information can be made in a distinct
step from performing statistical analyses, which it is hoped makes
interfaces for the downstream analysis routines simpler and more
intuitive to use.
Value
Returns an object of class msDat
. This class is a list
with elements described below. The class is equipped with a print
and extractMS
function.
ms
A
matrix
containing mass spectrometry intensity readings. Each column provides the mass spectrometry values for a given fraction, and each row provides the mass spectrometry values for a given mass-to-charge ratio value across the fractions.mtoz
A vector with length equal to the number of mass-to-charge values provided in the mass spectrometry data, such that the
k
-th entry in the vector provides the mass-to-charge value for thek
-th row of mass spectrometry datachg
A vector with length equal to the number of mass-to-charge values provided in the mass spectrometry data, such that the
k
-th entry in the vector provides the charge information for thek
-th row of mass spectrometry data
Examples
# Load mass spectrometry data
data(mass_spec)
# Convert mass_spec from a data.frame to an msDat object
ms <- msDat(mass_spec = mass_spec,
mtoz = "m/z",
charge = "Charge",
ms_inten = c(paste0("_", 11:43), "_47"))
# Dimension of the data
dim(ms)
# Print the first few rows and columns
ms[1:5, 1:2]
# Let's change the fraction names to something more concise
colnames(ms) <- c(paste0("frac", 11:43), "frac47")
# Print the first few rows and columns with the new fraction names
ms[1:5, 1:8]
# Suppose there are some m/z levels that we wish to remove
ms <- ms[-c(2, 4), ]
# Print the first few rows and columns after removing rows 2 and 4
ms[1:5, 1:8]
# Suppose that there was an instrumentation error and that we need to change
# some values
ms[1, paste0("frac", 12:17)] <- c(55, 57, 62, 66, 71, 79)
# Print the first few rows and columns after changing some of the values in
# the first row
ms[1:5, 1:10]