rspec_to_pyspec | R Documentation |
The rspec_to_pyspec()
and pyspec_to_rspec()
functions allow to convert
R Spectra()
objects into matchms
Python Spectrum
objects. These functions are designed for
advanced users or developers who want/need to integrate Python/matchms
functionality into R using reticulate. All other users should use the
dedicated R functions within this package that take care of running the
Python code in the correct Python environment.
Parameter mapping
allows to define which spectra variables (metadata)
should be copied between the R and Python spectra. Only provided spectra
variables will be copied to R respectively Python. mapping
also defines
the mapping between the Spectra
's spectra variables and the Spectrum
metadata. The names of the character vector mapping
are the R spectra
variables and the values the corresponding names in the Python's Spectrum
metadata. See the output of the spectraVariableMapping()
function for the
default variables and the mapping of the names.
The spectraVariableMapping()
function provides a default mapping of some
core Spectra
variables based on this definition in matchms.
The function returns a named vector that can be directly used as parameter
mapping
in the rspec_to_pyspec()
and pyspec_to_rspec()
functions.
## S4 method for signature 'missing'
spectraVariableMapping(object, ...)
rspec_to_pyspec(
x,
mapping = spectraVariableMapping(),
reference = import("matchms"),
BPPARAM = SerialParam(),
.check = TRUE
)
pyspec_to_rspec(
x,
mapping = spectraVariableMapping(),
BPPARAM = SerialParam(),
.check = TRUE
)
object |
ignored. |
... |
ignored. |
x |
For |
mapping |
Named |
reference |
Optional reference to Python environment |
BPPARAM |
Optional parallel processing setup. |
.check |
Optionally disable input parameter checking. Input parameter checking should only disabled for very good reasons. |
For rspec_to_pyspec()
: Python array of Spectrum objects, same
length than x
. For pyspec_to_rspec()
: Spectra()
with the converted
spectra. For spectraVariableMapping()
: named character
vector with
names being Spectra
variable names and values the corresponding names
in matchms
.
Michael Witting, Johannes Rainer
## List the default spectra variables and their mapping.
spectraVariableMapping()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.