Learn R Programming

ChemoSpec (version 6.1.10)

hmapSpectra: Seriated Heat Map for a Spectra Object

Description

Creates a heat map with marginal dendrograms using seriation procedures. Heirchical cluster analysis is followed by re-ordering the clusters in a coordinated way across each dimension (controlled by argument method, see hmap). The vignette for package seriation has more details.

Usage

hmapSpectra(spectra, ...)

Value

A list as described in hmap. Side effect is a plot.

Arguments

spectra

An object of S3 class Spectra().

...

Additional arguments to be passed downstream. A great deal of control is available - check hmap for details. Most of the control actually derives from the heatmap function in package stats. See the examples.

Interpretation

Looking at the 2nd hmapSpectra example, and keeping in mind the nature of the sample (see SrE.IR), the most similar samples based on the ester peaks (~1740), are in the lower right corner of the heatmap. These are the two outlier samples, composed of triglycerides which contain the ester functional group (and no detectable carboxylic acid). The most similar samples based on the carboxylic acid peaks (~1710) are in the upper left corner. These samples are mostly from the "pure" extract group, according to the manufacturer's label. These samples have a modest to low amount of the ester functional group, which indicates dilution (or adulteration if you like). In fact, the first two samples (NP_adSrE and NR_pSrE) are the two samples with the smallest ester peaks (see first plot in the examples). This suggests that NP_adSrE was diluted only a little with added olive oil.

Author

Bryan A. Hanson (DePauw University).

See Also

hmap which will get you to the package (there is no package index page); the vignette is a good place to begin (browseVignettes("seriation")). Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

Run this code
# You need to install package "seriation" for this example
if (requireNamespace("seriation", quietly = TRUE)) {
  data(SrE.IR)

  # Let's look just at the carbonyl region
  IR <- removeFreq(SrE.IR, rem.freq = SrE.IR$freq > 1775 | SrE.IR$freq < 1660)
  p <- plotSpectra(IR, which = 1:16, lab.pos = 1800)

  # Defaults, except for color scheme:
  res <- hmapSpectra(IR, col = heat.colors(5))

  # Label samples and frequencies by passing arguments to stats:heatmap
  # Also make a few other nice plot adjustments
  res <- hmapSpectra(IR,
    col = heat.colors(5),
    row_labels = IR$names, col_labels = as.character(round(IR$freq)),
    margins = c(4, 6)
    )
}

Run the code above in your browser using DataLab