Analyses class and methods for handling Raman spectroscopy data
Source:R/class_Analyses_RamanAnalyses.R
RamanAnalyses.Rd
The RamanAnalyses class is used to store a list of Raman spectra.
Usage
RamanAnalyses(files = NULL)
# S3 method for class 'RamanAnalyses'
validate_object(x)
# S3 method for class 'RamanAnalyses'
get_analysis_names(x)
# S3 method for class 'RamanAnalyses'
get_replicate_names(x)
# S3 method for class 'RamanAnalyses'
set_replicate_names(x, value)
# S3 method for class 'RamanAnalyses'
get_blank_names(x)
# S3 method for class 'RamanAnalyses'
set_blank_names(x, value)
# S3 method for class 'RamanAnalyses'
get_concentrations(x)
# S3 method for class 'RamanAnalyses'
set_concentrations(x, value)
# S3 method for class 'RamanAnalyses'
info(x)
# S3 method for class 'RamanAnalyses'
add(x, value)
# S3 method for class 'RamanAnalyses'
remove(x, value)
# S3 method for class 'RamanAnalyses'
x[i]
# S3 method for class 'RamanAnalyses'
get_spectra(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
useRawData = FALSE
)
# S3 method for class 'RamanAnalyses'
get_spectra_matrix(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
useRawData = FALSE
)
# S3 method for class 'RamanAnalyses'
plot_spectra(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
useRawData = FALSE,
xLab = NULL,
yLab = NULL,
title = NULL,
colorBy = "analyses",
interactive = TRUE,
renderEngine = "webgl"
)
# S3 method for class 'RamanAnalyses'
plot_spectra_3d(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
useRawData = FALSE,
legendNames = TRUE,
colorBy = "analyses",
xLab = NULL,
yLab = NULL,
zLab = NULL,
renderEngine = "webgl"
)
# S3 method for class 'RamanAnalyses'
plot_spectra_baseline(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
xLab = NULL,
yLab = NULL,
title = NULL,
colorBy = "analyses",
interactive = TRUE,
renderEngine = "webgl"
)
# S3 method for class 'RamanAnalyses'
plot_chromatograms(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
shift = NULL,
minIntensity = NULL,
useRawData = FALSE,
xLab = NULL,
yLab = NULL,
title = NULL,
colorBy = "analyses",
interactive = TRUE,
renderEngine = "webgl"
)
# S3 method for class 'RamanAnalyses'
get_chromatograms_peaks(x, analyses = NULL, targets = NULL, rt = NULL)
# S3 method for class 'RamanAnalyses'
plot_chromatograms_peaks(
x,
analyses = NULL,
targets = NULL,
rt = NULL,
title = NULL,
legendNames = TRUE,
colorBy = "targets",
xlim = NULL,
ylim = NULL,
xLab = NULL,
yLab = NULL,
interactive = TRUE,
renderEngine = "webgl"
)
Arguments
- files
A
character
vector with full file paths to "asc", "sif", "json", "wdf", "sdf", "csv" and/or "txt" raman files or adata.frame
with colnamesfile
,replicate
andblank
. The "replicate" column is used to group the analyses and the "blank" column is used to identify the blank samples. The "file" column is the full to the raman files.- x
A
RamanAnalyses
object to validate.- value
An object that highly depends on the method. Check the specific method documentation for details.
- i
A character or numeric vector to perform subsetting. Check the specific method for details.
- analyses
Character or numeric vector with names or indexes of analyses in the
Analyses
object.- targets
A
character
vector with the names of the targets (i.e., group or id) to filter the spectra by.- rt
Numeric of length two with the minimum and maximum retention time, in seconds.
- shift
Numeric of length two with the minimum and maximum shift, in cm-1.
- minIntensity
Numeric (length 1) with the minimum intensity.
- useRawData
Logical of length one. Set to
TRUE
for parsing raw data not data in results/processed.- xLab
A string with the title for the x axis.
- yLab
A string with the title for the y axis.
- title
A string with the title.
- colorBy
A string defining how to legend the plot. Possible values are
analyses
,targets
(the default) orreplicates
.- interactive
Logical (length 1). When
TRUE
, the data is plotted interactively using plotly.- renderEngine
The engine to render the data. The default is "webgl".
- legendNames
A character vector with the same length as the targets or
TRUE
orFALSE
for using the name in the added targets as legend of the plot.- zLab
A string with the title for the z axis.
- xlim
A length one or two numeric vector for setting the x limits of the plot.
- ylim
A length one or two numeric vector for setting the y limits of the plot.
Value
A RamanAnalyses
object which is fundamentally a list with each element representing a Raman analysis. Each analysis is a list with the following elements:
name
: The name of the analysis.replicate
: The replicate identifier for the analysis.blank
: The blank sample identifier for the analysis.concentration
: The concentration of the sample in the analysis.reference
: The reference sample identifier for the analysis.file
: The file path to the Raman data file.type
: The type of analysis, which is "Raman".metadata
: A list containing metadata for the analysis.spectra
: Adata.table
containing the Raman spectra data, with columns for shift, intensity, and optionally other parameters like rt and id. Theresults
element is a list that can hold results. Possible results is currently only RamanResults_Spectra.
Methods (by generic)
validate_object(RamanAnalyses)
: Validate the RamanAnalyses object, returningNULL
if valid.get_analysis_names(RamanAnalyses)
: Get the names of the analyses in theRamanAnalyses
object.get_replicate_names(RamanAnalyses)
: Get the replicates of the analyses in theRamanAnalyses
object.set_replicate_names(RamanAnalyses)
: Set the replicates of the analyses in theRamanAnalyses
object. The argumentvalue
must be a character vector with the same length as the number of analyses in the object.get_blank_names(RamanAnalyses)
: Get the blanks of the analyses in theRamanAnalyses
object.set_blank_names(RamanAnalyses)
: Set the blanks of the analyses in theRamanAnalyses
object. The argumentvalue
must be a character vector with the same length as the number of analyses in the object.get_concentrations(RamanAnalyses)
: Get the concentrations of the analyses in theRamanAnalyses
object.set_concentrations(RamanAnalyses)
: Set the concentrations of the analyses in theRamanAnalyses
object. The argumentvalue
must be a numeric vector with the same length as the number of analyses in the object.info(RamanAnalyses)
: Get a summarydata.table
of theRamanAnalyses
object.add(RamanAnalyses)
: Add Raman analyses to theRamanAnalyses
object. The argumentvalue
can be a character vector with full file paths to "asc", "sif", "json", "wdf", "sdf", "csv" and/or "txt" raman files or a list ofRamanAnalysis
objects.remove(RamanAnalyses)
: Remove Raman analyses from theRamanAnalyses
object. The argumentvalue
can be a character vector with the names of the analyses or a numeric vector with the indices of the analyses to remove.[
: Subset theRamanAnalyses
object by analyses. The argumenti
can be a character vector with the names of the analyses or a numeric vector with the indices of the analyses to keep.get_spectra(RamanAnalyses)
: Get the spectra from theRamanAnalyses
object.get_spectra_matrix(RamanAnalyses)
: Get the spectra matrix from theRamanAnalyses
object.plot_spectra(RamanAnalyses)
: Plot the spectra from theRamanAnalyses
object.plot_spectra_3d(RamanAnalyses)
: Plot the spectra in 3D from theRamanAnalyses
object.plot_spectra_baseline(RamanAnalyses)
: Plot the baseline-corrected spectra from theRamanAnalyses
object.plot_chromatograms(RamanAnalyses)
: Plot the chromatograms from theRamanAnalyses
object when the spectra have a time dimension.get_chromatograms_peaks(RamanAnalyses)
: Get the chromatograms peaks from theRamanAnalyses
object.plot_chromatograms_peaks(RamanAnalyses)
: Plot the chromatograms peaks from theRamanAnalyses
object.