Description Usage Arguments Details Value Examples
This function is to control the flow of actions when batch processing a directory. It establishes the save and recover policies of previously analysed data so that the same data is not reanalyzed twice if new data is added to a directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | maldi_batch(
path = NULL,
pivot = "[0-9]_[A-Z]+[0-9]+",
layout_file = NULL,
confirm_layout_file = TRUE,
manual = FALSE,
review = TRUE,
FUN_spect = maldi_average_by_well,
MoreArgs_spect = list(pivot = "[0-9]_[A-Z]+[0-9]+"),
FUN_peaks = maldi_find_peaks_by_well,
MoreArgs_peaks = list(pivot = "[0-9]_[A-Z]+[0-9]+"),
FUN_draw = maldi_draw_peaks_by_well,
MoreArgs_draw = list(),
FUN_import_layout = summerr::import_layout_from_excel,
MoreArgs_layout = list(),
MoreArgs_device = list(width = 21.5/2.54, height = 30.5/2.54, paper = "a4"),
stored_peaks.generic = "maldi_peaks.rds",
stored_spect.generic = "maldi_specs.rds",
stamp = "%y%m%d"
)
|
path |
Directory with mass spectra to analyze, store and import results; may contain the plate layout(s). |
pivot |
A regular expression describing the name of a single folder in each tree up to which "groups" and from which "replicates" are established. See Details. |
layout_file, confirm_layout_file, FUN_import_layout, MoreArgs_layout |
Path to a file that
contains metadata associated with each well/group. |
manual |
Do you want to assign peaks manually in the first place or automatically? (If ) |
review |
Do you want to review again all automatically assigned peaks? (Requires RStudio.) |
FUN_spect, MoreArgs_spect |
The function to be applied for pre-processing
the mass spectra using |
FUN_peaks, MoreArgs_peaks |
The function to be applied for peak detection
using |
FUN_draw, MoreArgs_draw |
Arguments passed to |
MoreArgs_device |
Arguments passed to |
stored_peaks.generic |
Default name for peak backup file. |
stored_spect.generic |
Default name for spectra backup file. |
stamp |
A datestamp (default) and/or timestamp constructed according to this specification (POSIXct) is added to pre-existing files in path. |
The batch process is split into different stages starting from the selected
path
as main directory:
import and pre-processing of the spectra,
automated (or manual) peak picking for each spectrum,
depending if manual = FALSE
(or TRUE
),
review of automated peak picking if review = TRUE
.
These tasks are performed by group and the results are stored in the folder
enclosing all data of the same group. This is the parent to the folders that
match pivot
(the well folders). See import_layout_from_paths.maldi.
If such a folder contains already analyses saved as stored_peaks.generic
or stored_spect.generic
, these analyses can be imported for the next stage;
if not, the original files are renamed with a timestamp and new files added.
...
FUN_spect
, FUN_peaks
and layout_import_FUN
is can be of
type character or closure.
In case FUN_spect
or FUN_peaks
use a function that must determine,
e.g. which spectra are repeated measurements from a single well, which is
typically accomplished in the default functions using import_layout_from_paths.maldi,
the pivot
regex may need to be updated in the corresponding MoreArgs_...
arguments as well. A warning is emitted if it is not.
If layout_file
is NULL
, the results will not be joined with an
external file that holds associated metadata. (Skip this section.)
External plate layouts can be provided via layout_file
either (1) as an
absolute path to a single file somwhere in the file system or (2) a file in
expressed relative to the selected path
, e.g. "global_layout.xls".
The query is made via file.exists
.
In such cases, the file is used for all groups. In case (3) when such a file
does not exist, the file is looked for locally in each group directory, where
it must be present each time under the same name, e.g., as "layout.xls".
If (4) this is neither the case and confirm_layout_file = TRUE
, you
will finally be prompted to select a layout file. You can force this behavior
by setting layout_file = ""
.
If confirm_layout_file = TRUE
, you will also be asked if the file
identified according to one of the rules (1-3) above should be taken or not.
To successfully merge your layout with the data, common column names must exist between your layout file and the result of import_layout_from_paths.maldi, which extends the generic import_layout_from_paths by explicitly extracting a well number as column "well".
If you choose a graphical approach to define the plate layout, consider using import_layout_from_excel, which will convert the plate into a (long) table with a column "well" and "content".
If you provide such a (long) table directly, provide
readxl::read_excel
or another appropriate function as argument layout_import_FUN
.
A list of two lists, named $spectra
and $peaks
, which
themselves contain one element (of spectra lists or data.frames) for each group.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
maldi_batch(
MoreArgs_spect = list(pivot = "[0-9]_[A-Z]+[0-9]+",
final_trim_range = c(2420, 2445)),
MoreArgs_peaks = list(pivot = "[0-9]_[A-Z]+[0-9]+",
mass_list = c(mC = 2425, hmC = 2441, fC = 2439),
tolerance_assignment = 0.5,
SNR = 3),
MoreArgs_draw = list(ncol = 2, nrow = 6),
MoreArgs_layout = list(meta_row = c(concentration = "1"),
meta_col = character())
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.