Description Usage Arguments Value Examples
Plot one or multiple NMR spectra with ppm as x-axis and intensity as y-axis; the colour of each spectra can be defined using spectraColour
(default grey for one spectra, rainbow for multiple ones). If a vector of pval
(one per ppm) is passed as input, each datapoint will be colored depending on the p-value. If a driver
ppm is passed as input, the correlation of all variables to this driver will be calculated (statistical total correlation spectroscopy - STOCSY) and used to colour the median spectra. Only one colouring method (spectraColour
, pval
or driver
) can be used at any given time). Require ggplot2
, reshape2
, scales
, grDevices
, stats
1 2 |
ppm |
(float) vector of ppm values (x-axis) |
data |
(data.frame) spectra intensity values matching |
spectraColour |
(str) NULL or vector of colour for each sample (same length as the number of row of |
pval |
(float) NULL or vector of p-value for each ppm (same length as |
driver |
(float) NULL or ppm value of the driver feature for STOCSY (the closest ppm value will be used) |
verbose |
(bool) If TRUE message progress |
debug |
(bool) If TRUE returns the data to plot instead of the ggplot object |
Grob (ggplot object)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | {
# load data (2.95 - 3.5 ppm)
inPPM <- someRutils::exampleNMR$ppm[711:821]
inData <- someRutils::exampleNMR$data[,711:821]
# default plot
NMR_plot_spectra_pval_stocsy(ppm=inPPM, data=inData)
# set each spectra colour (3 spectra)
inSpectraColour <- c('blue', 'red', 'green')
NMR_plot_spectra_pval_stocsy(ppm=inPPM[1:3], data=inData[1:3], spectraColour=inSpectraColour)
# colour by p-value
inPval <- rep(c(0.0000001, 0.001, 0.01, 0.05, 0.1, 0.25, 0.5, 1), 14)[1:111]
NMR_plot_spectra_pval_stocsy(ppm=inPPM, data=inData, pval=inPval)
# STOCSY (driver peak is 3.2765ppm)
NMR_plot_spectra_pval_stocsy(ppm=inPPM, data=inData, driver=3.2765)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.