Title: | Advanced Method Optimization for Spectra-Generating Sampling and Analysis Instrumentation |
Version: | 1.0.0 |
Description: | A graphical user interface to apply an advanced method optimization algorithm to various sampling and analysis instruments. This includes generating experimental designs, uploading and viewing data, and performing various analyses to determine the optimal method. Details of the techniques used in this package are published in Gamble, Granger, & Mannion (2024) <doi:10.1021/acs.analchem.3c05763>. |
Depends: | magrittr (≥ 2.0.3) |
License: | GPL (≥ 3) |
Imports: | shiny (≥ 1.7.5.1), shinyFeedback (≥ 0.4.0), shinyalert (≥ 3.0.0), htmltools (≥ 0.5.8.1), FrF2 (≥ 2.3.3), DT (≥ 0.30), ggplot2 (≥ 3.4.4), stats (≥ 4.3.2), dplyr (≥ 1.1.3), shinyjs (≥ 2.1.0), tibble (≥ 3.2.1), glue (≥ 1.6.2), rlang (≥ 1.1.2), DoE.wrapper (≥ 0.12), gtools (≥ 3.9.5), zip (≥ 2.3.0), zoo (≥ 1.8.12), purrr (≥ 1.0.2), shinyBS (≥ 0.61.1) |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-09-25 13:09:40 UTC; k9638 |
Author: | Benjamin Luke [aut], Stephanie Gamble [aut, cre], Battelle Savannah River Alliance [cph] |
Maintainer: | Stephanie Gamble <stephanie.gamble@srnl.doe.gov> |
Repository: | CRAN |
Date/Publication: | 2024-09-30 09:50:07 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling 'rhs(lhs)'.
Method optimization GUI
Description
'MethodOpt()' runs the GUI.
Usage
MethodOpt()
Details
No arguments are needed to initiate the GUI. 'MethodOpt()' is split into three main tabs.
Value
No return value, opens and runs the GUI
Fractional factorial design
The first step in method optimization is to build an experimental design. Hence, the first tab of the GUI is dedicated to designing a fractional factorial experimental design. Parameters are input with their corresponding low and high values. Pressing "Generate FFD" will yield the experimental design. The user will run experiments according to each method.
ANOVA
The second step in method optimization is to run an ANOVA test. This is carried out under the "Analysis" tab. Raw experimental screening data is uploaded, and the spectra can be viewed. In subtabs, the spectra peaks must be identified (either by an uploaded retention time file or by a built-in identification algorithm), objectives must be selected, and the initial experimental design must be uploaded; then the ANOVA test may be run. Statistically significant parameters are indicated.
Box-Behnken design
The third step is to generate a three-level Box-Behnken experimental design with the significant parameters. Low, middle, and high values are input with their corresponding parameters. The design can be generated by pressing "Generate BBD."
Optimization
The final step is to run the optimization with the results of the Box-Behnken design. Similarly to the second step, raw data is uploaded in the "Analysis" tab. Spectra peaks must be identified, objectives must be selected, and the experimental design must be uploaded; then the optimal values can be calculated.
Examples
# Please see the vignette for the MethodOpt package for a full example of how
# to use the GUI launched by MethodOpt::MethodOpt().
Computes ANOVA test
Description
Runs an ANOVA test for any variables that were selected by the user.
Usage
anovaben(objectives, data, ffd, obj_results, alpha)
Arguments
objectives |
User selected objectives. |
data |
Peak information (all times, heights, etc.). |
ffd |
Fractional factorial design |
obj_results |
Calculated objectives. |
alpha |
Alpha value. |
Value
list containing the results of ANOVA on the data from the FFD (including p-values and which parameters are significant), the suggested changes to add a level for a BBD, suggested values for the BBD, row indices for the results, and the data frame of the FFD with objective results included
Computes areas of peaks
Description
Computes the areas beneath the specified maxima.
Usage
area(data, hts, tms)
Arguments
data |
dataframe of time versus intensity. |
hts |
heights of peaks in chronological order. |
tms |
time locations of peaks in chronological order. |
Value
area for each peak
Baseline correction
Description
Generates the baseline of the spectra, interpolates between points, and subtracts from the intensity to generate corrected baseline.
Usage
blc(frame, noise = 10^5, subtract = NULL)
Arguments
frame |
data frame of time versus intensity. |
noise |
strength of the baseline subtraction. |
subtract |
how much intensity to initially subtract. |
Value
data frame of of data that has been baseline corrected
Generate a Gaussian fit
Description
Generate a Gaussian fit with given parameters.
Usage
gauss(a, b, c, t)
Arguments
a |
amplitute. |
b |
phase shift. |
c |
standard deviation. |
t |
time at which to fit. |
Value
value of Gaussian function
Optimization algorithm
Description
Calculate the optimal parameter values for given objectives.
Usage
opt(objectives, bbd, results, lim_fac, valid_range_data)
Arguments
objectives |
objectives input by user. |
bbd |
Box-Behnken design. |
results |
objective results. |
lim_fac |
limiting factors. |
valid_range_data |
ranges of validity corresponding to the limiting factors. |
Value
a list containing the parameters which cannot be set to the unbounded solution, the maximum value of the objectives, and the unbounded parameter solutions
Peak searching algorithm without retention times
Description
Returns the maxima, the times they occur at, the index location of the maxima, and the next viable peaks with times after the first 'keep'.
Usage
peaks(
data,
begin_search = NULL,
end_search = NULL,
keep = 11,
precision = 15,
factor = 10,
bl_noise = 0
)
Arguments
data |
time versus intensity dataframe. |
begin_search |
time at which to start the search for the peaks. |
end_search |
time at which to stop the search for the peaks. |
keep |
a whole number indicating how many peaks to search for and return. |
precision |
an integer indicating the size of the window for searching for local maxima. |
factor |
constant of proportionality indicating the cutoff peak height (i.e., peaks greater than 'factor' times height are not returned as viable peaks). |
bl_noise |
constant level at which response should be considered as noise. |
Value
list containing spectra maxima,the times they occur at, the index location of the maxima, and the the same info for the next viable peaks with times after the first 'keep'.
peak calculations with retention times
Description
Locate the maxima of the peaks corresponding to the retention times.
Usage
peaks_rts(raw_data, retention_times, rt_index, bl_noise = 0)
Arguments
raw_data |
time versus intensity dataframe. |
retention_times |
retention time file. |
rt_index |
which method to evaluate for. |
bl_noise |
constant level at which response should be considered as noise. |
Value
list containing the peaks' heights, times where they occur, the full data TIC, full time index, and the peaks' widths
Calculate widths
Description
Calculate the widths (standard deviation) for each identified peak.
Usage
widths(data, hts, tms)
Arguments
data |
time versus intensity dataframe. |
hts |
heights of peaks. |
tms |
times of peaks. |
Value
width for each peak