chemoDivPlot: Plot chemodiversity

View source: R/chemoDivPlot.R

chemoDivPlotR Documentation

Plot chemodiversity

Description

Function to conveniently create basic plots of the different types of chemodiversity measurements calculated by functions in the package. This function exists to provide an easy way to make basic chemodiversity plots. As functions in the package output data in standard formats, customized plots are easily created with ggplot2.

Usage

chemoDivPlot(
  compDisMat = NULL,
  divData = NULL,
  divProfData = NULL,
  sampDisMat = NULL,
  groupData = NULL
)

Arguments

compDisMat

Compound dissimilarity matrix, generated by the compDis function. Note that only a single matrix should be supplied, and not the whole list.

divData

Diversity/evenness data frame, generated by the calcDiv function. This data frame can contain a single or multiple columns with diversity/evenness measures.

divProfData

Diversity profile, generated by the calcDivProf function. Note that the whole list outputted by the calcDivProf function should be supplied.

sampDisMat

Sample dissimilarity matrix, generated by the sampDis function. This can be either the list of one or both matrices outputted by the function, or a single matrix directly.

groupData

Grouping data. Should be either a vector or a data frame with a single column.

Details

The function can create four different types of plots, (using ggplot2) depending on which input data is supplied:

  • Function argument compDisMat. A compound dissimilarity matrix will be plotted as a dendrogram visualizing how structurally/biosynthetically similar different compounds are to each other.

  • Function argument divData. Diversity/evenness values will be plotted as a boxplot.

  • Function argument divProfData. A diversity profile, plotting (Functional) Hill diversity at different values of q will be plotted as a line plot.

  • Function argument sampDisMat. A sample dissimilarity matrix will be plotted as an NMDS plot.

  • Function argument groupData. Grouping data (e.g. population, species etc.) may be supplied, to plot each group in different boxes/lines/colours.

Note that this function can take any combination of the four arguments as input, and argument names should always be specified to ensure each dataset is correctly plotted. If including the function argument sampDisMat, a Nonmetric Multidimensional Scaling (NMDS) will be performed, which may take time for larger datasets.

Value

The specified chemodiversity plots.

Examples

minimalDiv <- calcDiv(minimalSampData, minimalCompDis, type = "FuncHillDiv")
groups <- c("A", "A", "B", "B")
chemoDivPlot(divData = minimalDiv, groupData = groups)

data(alpinaCompDis)
data(alpinaSampDis)
data(alpinaPopData)
alpinaDiv <- calcDiv(sampleData = alpinaSampData, compDisMat = alpinaCompDis,
type = "FuncHillDiv")
alpinaDivProf <- calcDivProf(sampleData = alpinaSampData,
compDisMat = alpinaCompDis, type = "FuncHillDiv",
qMin = 0, qMax = 2, step = 0.2)
chemoDivPlot(compDisMat = alpinaCompDis, divData = alpinaDiv,
divProfData = alpinaDivProf, sampDisMat = alpinaSampDis,
groupData = alpinaPopData)

chemodiv documentation built on Aug. 18, 2023, 1:08 a.m.