quickChemoDiv: Quickly calculate or plot chemodiversity

View source: R/quickChemoDiv.R

quickChemoDivR Documentation

Quickly calculate or plot chemodiversity

Description

This function is a shortcut that makes use of many of the other functions in the package. In one simple step chemodiversity is calculated, and if requested also plotted, for users wanting to quickly explore their data using standard parameters.

Usage

quickChemoDiv(
  sampleData,
  compoundData = NULL,
  groupData = NULL,
  outputType = "plots"
)

Arguments

sampleData

Data frame with the relative concentration of each compound (column) in every sample (row).

compoundData

Data frame with the compounds in sampleData as rows. Should have a column named "compound" with common names of the compounds, a column named "smiles" with SMILES IDs of the compounds, and a column named "inchikey" with the InChIKey IDs for the compounds. See chemodiv for details on obtaining SMILES and InChIKey IDs.

groupData

Grouping data (e.g. population, species etc.). Should be either a vector, or a data frame with a single column.

outputType

Type of output that should be returned: either data to output a list with different types of chemodiversity data, or plots to instead produce standard plots of this data.

Details

The function requires sample data as input, and can also include compound data. chemoDivCheck can be used to ensure these datasets are correctly formatted, see chemodiv for further details on data formatting. If only sample data is supplied, phytochemical diversity and dissimilarity will be calculated as Hill diversity and Bray-Curtis dissimilarity, respectively. If sample data and compound data is supplied, phytochemical diversity and dissimilarity will be calculated as Functional Hill diversity and Generalized UniFrac dissimilarity, respectively. This function then uses the following other functions in the package:

  • compDis is used to calculate compound dissimilarities using PubChem Fingerprints, if compound data is supplied.

  • calcDiv is used to calculate (Functional) Hill Diversity for q = 1.

  • calcDivProf is used to calculate a diversity profile with (Functional) Hill Diversity for q = 0-3.

  • sampDis is used to calculate Bray-Curtis or Generalized UniFrac dissimilarities between samples.

  • chemoDivPlot is used to create different chemodiversity plots if requested.

quickChemoDiv is designed to provide an easy way to calculate and visualize the most central measures of phytochemical diversity. It uses default parameters to do so, which should be reasonable in most cases. However, for detailed analyses it is recommended to use the separate functions to allow for full control of function input, arguments and output.

Value

Different types of chemodiversity measures, either as elements in a list or as separate plots. If outputType = "data", function returns a compound dissimilarity matrix (if compound data was supplied), a data frame with (Functional) Hill Diversity at q = 1, a data frame with a (Functional) Hill Diversity profile for q = 0-3, and a sample dissimilarity matrix. If outputType = "plots", these data sets are plotted as a dendrogram (if compound data was supplied), a boxplot, a diversity profile plot and an NMDS plot, respectively.

Examples

data(minimalCompData)
data(minimalSampData)
groups <- c("A", "A", "B", "B")
quickChemoDiv(sampleData = minimalSampData, groupData = groups,
outputType = "data") # Without compound data

data(alpinaSampData)
data(alpinaPopData)
quickChemoDiv(sampleData = alpinaSampData, outputType = "plots",
groupData = alpinaPopData) # Without compound data

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