| Title: | Mass-Spectra Prediction Using the FIORA Model |
| Version: | 0.3.4 |
| Date: | 2025-11-03 |
| Description: | Provides a wrapper for the python module 'FIORA' as well as a 'shiny'-App to facilitate data processing and visualization. 'FIORA' allows to predict Mass-Spectra based on the SMILES code of chemical compounds. It is described in the Nature Communications article by Nowatzky (2025) <doi:10.1038/s41467-025-57422-4>. |
| License: | MIT + file LICENSE |
| Imports: | bslib, config, golem, InterpretMSSpectrum, rcdk, shiny, shinyjs, waiter |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| URL: | https://github.com/janlisec/fioRa |
| BugReports: | https://github.com/janlisec/fioRa/issues |
| Suggests: | reticulate, spelling, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Language: | en-US |
| Depends: | R (≥ 3.5) |
| LazyData: | true |
| NeedsCompilation: | no |
| Packaged: | 2025-11-06 10:12:22 UTC; jlisec |
| Author: | Jan Lisec [aut, cre] |
| Maintainer: | Jan Lisec <jan.lisec@bam.de> |
| Repository: | CRAN |
| Date/Publication: | 2025-11-11 09:50:08 UTC |
Install the python module 'fiora' into a conda environment.
Description
This function will check and perform the installation of three components in the following order: reticulate, miniconda and fiora. It will ensure that a working conda environment 'fiora' is available. This is a prerequisite for both, run_app and run_script.
Usage
install_fiora()
Value
A list providing the current OS and path information on the current python executable and the fiora script.
Examples
## Not run:
# this will install packages and software on your machine
install_fiora()
## End(Not run)
Run the Shiny Application.
Description
Will open a Shiny App in the local browser.
Usage
run_app(
onStart = NULL,
options = list(),
enableBookmarking = NULL,
uiPattern = "/",
...
)
Arguments
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
uiPattern |
A regular expression that will be applied to each |
... |
arguments to pass to golem_opts. See '?golem::get_golem_options' for more details. |
Value
A shinyApp object. Will open a Shiny App in the local browser.
Predict MS^2 fragment spectra from SMILES code.
Description
A wrapper around the python script 'fiora-predict' using the fiora open source model to generate a MS^2 spectra for a compound with known SMILES code.
Usage
run_script(
x = data.frame(Name = "Example_0", SMILES = "CC1=CC(=O)OC2=CC(OS(O)(=O)=O)=CC=C12",
Precursor_type = "[M-H]-", CE = 17, Instrument_type = "HCD"),
min_prob = 0.001,
annotation = FALSE,
fiora_script = NULL,
fmt = c("list", "df")
)
Arguments
x |
A data frame containing columns Name (compound names), SMILES (SMILES code of the compounds, Precursor_type (currently "[M-H]-" or "[M+H]+"), CE (Collision energy) and Instrument_type (i.e. HCD). |
min_prob |
Minimum peak probability to be recorded in the spectrum. |
annotation |
Return SMILES for fragments if TRUE. |
fiora_script |
Path to python script fiora-predict. |
fmt |
Set fmt to 'df' to simplify the return value to a data frame (named list otherwise). |
Details
This wrapper will generate a fiora ready input file (csv-format) based on the user parameters which is stored as a temp file. It will ensure that the current version of the fiora package is installed in a respective python environment. It will use 'system2()' to run the python script 'fiora-predict' and import its result back into R using the internal function 'read_fiora()'. You can try different installed version of 'fiora' by providing the path the the script explicitly.
Value
A list with the fiora results for the specified compound(s).
Examples
## Not run:
# !!! running this example will install the python module `fiora`
td <- fioRa::test_data
x <- setNames(data.frame(
t(sapply(td[2:11], function(x) { strsplit(x, ",")[[1]] }))),
strsplit(td[1], ",")[[1]]
)
foo <- run_script(x = x)
foo[[1]][["spec"]]
# modify parameters
run_script(x = x[1,,drop=FALSE], min_prob = 0.05)
# use a different fiora environment/model
s_pth <- "c:/Users/jlisec/AppData/Local/r-miniconda/envs/fiora-0.1.0/Scripts/fiora-predict"
foo2 <- run_script(x = x, fiora_script = s_pth)
foo2[[1]][["spec"]]
for (i in 1:length(foo)) {
cat("\n")
print(names(foo)[i])#'
print(foo[[i]][["spec"]])
print(foo2[[i]][["spec"]])
}
## End(Not run)
The example set of test compounds provided with FIORA.
Description
The example set of test compounds provided with FIORA.
Usage
data(test_data)
Format
A character vector of length = 12 containing the readLines equivalent of a fiora input file in csv format, with header, 10 example compounds, defined via their SMILES, and an empty final line (or vector element respectively).
Source
https://github.com/BAMeScience/fiora/blob/main/examples/example_input.csv