Description Usage Arguments Details Value Functions Assumptions See Also Examples
Peakpicking using Bruker mass spectrometry imaging software generally
produces a folder filled with many peaklists — one for each spectrum.
combine_peaklists
reads all such peaklist files in a given folder,
summarises and writes the relevant information to two tables.
The load_*
functions are for reading the tables created by
combine_peaklists
.
1 2 3 4 5 6 | load_peaklist(o.name, o.path = ".")
load_speclist(o.name, o.path = ".")
combine_peaklists(i.path, i.name = "peaklists", o.path = ".",
o.name = NULL)
|
o.name |
Name identifying the dataset of interest. If left as
|
o.path |
Path to where output files should be written. |
i.path |
Path to dataset of interest. This will usually be a folder with
a subfolder ( |
i.name |
Name of the subfolder in |
Typically, Bruker raw data will be stored all in a single folder (often with
the ".d" extension), with a folder name that identifies the relevant
information about the run. The only compulsory argument to
combine_peaklists
is a filepath to that folder, i.path
under
arguments. Typically the peaklist files themselves will be in a subfolder of
this folder, often called "peaklists" (can be specified via i.name
).
This is the only information with which combine_peaklists
is concerned
— any other files in said folder are ignored. The output files will by
default be named using the folder name provided in i.path
, but this
can be overridden by supplying o.name
. These output files are by
default created in the current working directory but this can be changed via
o.path
.
combine_peaklists
creates and writes relevant information to two
tables: a peak-list, and a spectrum-list:
Peak-list: A table in which each row corresponds to a peak. Consists
of all original peaklists concatenated together with one additional
column, Acq
, identifying the spectrum from which a peak
originated.
Spectrum-list: A table in which each row corresponds to a spectrum. Columns contain information relevant at a spectrum level, specifically this table contains five columns total:
fname
: The original peaklist filename.
R
: The region numbers of the corresponding spectra.
X
: The X-coordinates of the corresponding spectra.
Y
: The Y-coordinates of the corresponding spectra.
Acq
: An integer identifier used to cross-reference to
the peak-list table.
Note that Acq
will correspond to the order of acquisition of the
spectra if the spectra where acquired in increasing order of first region
number, second Y-coordinate and third X-coordinate, in that order of
priority. This order or acquisition is a common default on Bruker Flex
instruments.
On successful completion returns the number of empty spectra found — peaklist files with a header but no peaks. If no peaklist files are found at all returns -1 and a warning.
load_peaklist
: Reads Peak-list Produced by
combine_peaklists
.
load_speclist
: Reads Spectrum-list Produced by
combine_peaklists
.
combine_peaklists
assumes that the data is in a particular format –
that produced by Bruker software peakpicking at the time of writing this
vignette, specifically that:
Each spectrum is represented by a single peaklist text-file containing any peaks detected in that spectrum.
All peaklist files (for any given run) are stored in the same folder.
The filename of each peaklist file contains a match to the perl
regular expression R(?P<r>\d{2,3})X(?P<x>\d{3,4})Y(?P<y>\d{3,4})
in which the named capture groups 'r', 'x', and 'y', correspond to the
region number, x-coordinate, and y-coordinate of the corresponding
spectrum.
The contents of each peaklist file is formatted such that it can be
correctly read with the use utils::read.table(. , header = TRUE)
.
TODO: Update this to be more specific and instead use base::scan
,
and remove the load_*
functions instead replacing them with
suggestions for direct use of a function such as utils::read.csv
.
Note that combine_peaklists
checks for duplicate spectra (peaklist
files with the same region number, X-coordinate, and Y-coordinate) and will
throw an error if it finds any.
1 | combine_peaklists("A1")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.