Interactive Application to Plot and Evaluate CW Isotropic EPR Spectra
Source:R/plot_eval_ExpSim_app.R
plot_eval_ExpSim_app.Rd
Launch this app in order to quickly check recorded EPR spectra with their instrumental parameters.
Additionally, you may try to interactively simulate the isotropic continuous wave (CW) EPR spectra
using the simple user interface based on the R Shiny and several
functions from the package (see Details
).
Details
Based on the acquisition EPR spectrum origin
, in user interface, one can load a spectrum
and its instrumental/experimental parameters by the readEPR_Exp_Specs
as well as
by the readEPR_params_tabs
functions. An EPR is immediately depicted in the interactive
{plotly}
format by plot_EPR_Specs2D_interact
. The magnetic flux density \(B\)
of such EPR spectrum can be changed from mT
to G
and to g
-values. Moreover,
if the compound/radical structure is already known one can easily show its structure by entering
its corresponding SMILES
code, using the draw_molecule_by_rcdk
.
Uploaded ASCII
data (spectrum + parameters) are applied to interactively simulate
the corresponding experimental spectrum by the eval_sim_EPR_iso
and to visualize
it by the present_EPR_Sim_Spec
. Additionally, one can also print and download
the corresponding data frame/table in several formats (.csv
,.pdf
or .xls(x)
)
and thus use the data not only in R
environment but also in other programs.
Examples
if (FALSE) { # \dontrun{
## run the app just by the following
## command in R console:
plot_eval_ExpSim_app()
#
## this is an examples of the raw
## shiny R code to run the app,
## code example from the `SERVER` part:
server <- function(input, output,session) {
## redefinition of `norm.vec.add`
norm_vec <- reactiveValues(val = NULL)
observe({
if (isTRUE(input$normVec)){
norm_vec$val <- as.numeric(unlist(strsplit(input$vecNorm,",")))
} else {
norm_vec$val <- NULL
}
})
#
## Load experimental spectrum data frame
expr_data <- reactive({
#
req(input$ASCIIfile)
#
spectr.data <-
readEPR_Exp_Specs(
path_to_ASC = input$ASCIIfile$datapath,
col.names = switch(
3-origin.cond(orig = input$origin),
c("index","B_G", "dIepr_over_dB"),
c("B_G", "dIepr_over_dB"),
c("B_mT","dIepr_over_dB")
),
x.unit = switch(
3-origin.cond(orig = input$origin),
"G",
"G",
"mT"
),
qValue = input$qValue,
origin = input$origin,
norm.vec.add = norm_vec$val
)
spectr.data
})
#
# -------------------- INTERACTIVE SPECTRUM ---------------------
#
output$plot <- plotly::renderPlotly({
#
## add g-Value condition:
if (isTRUE(input$gval)) {
expr_data_g <- expr_data() %>%
dplyr::mutate(g_Value =
eval_gFactor(
nu.val = input$MWnuGHz,
B.val = .data$B_mT
))
}
...})
}
} # }