NMR_plot_spectra_pval_stocsy: Plot one or multiple NMR spectra, colored by user defined...

Description Usage Arguments Value Examples

Description

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

Usage

1
2
NMR_plot_spectra_pval_stocsy(ppm, data, spectraColour = NULL,
  pval = NULL, driver = NULL, verbose = TRUE, debug = FALSE)

Arguments

ppm

(float) vector of ppm values (x-axis)

data

(data.frame) spectra intensity values matching ppm (spectra as rows, ppm as columns)

spectraColour

(str) NULL or vector of colour for each sample (same length as the number of row of data)

pval

(float) NULL or vector of p-value for each ppm (same length as ppm and the number of columns of data)

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

Value

Grob (ggplot object)

Examples

 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)
}

adwolfer/someRutils documentation built on May 15, 2019, 10:48 a.m.