molNetPlot {chemodiv}R Documentation

Plot molecular networks

Description

Function to conveniently create a basic plot of the molecular network created by the molNet function. Molecular networks can be used to illustrate the biosynthetic/structural similarity of phytochemical compounds in a sample, while simultaneously visualizing their relative concentrations. In the network, nodes are compounds, with node sizes or node colours representing the relative concentrations of compounds. Edges connects nodes, with edge widths representing compound similarity. This function exists to provide an easy way to make basic molecular network plots. Customized network plots can be created with e.g. the ggraph package or the Cytoscape software platform.

Usage

molNetPlot(
  sampleData,
  networkObject,
  groupData = NULL,
  npcTable = NULL,
  plotNames = FALSE,
  layout = "kk"
)

Arguments

sampleData

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

networkObject

A network object, as created by the molNet function. Note that this is only the network object, which is one of the elements in the list outputted by molNet. The network is extracted as molNetOutput$networkObject.

groupData

Grouping data (e.g. population, species etc.). If supplied, a separate network will be created for each group. Should be either a vector, or a data frame with a single column.

npcTable

It is optional but recommended to supply an NPCTable. This will result in network nodes being coloured by their NPC pathway classification.

plotNames

Indicates if compounds names should be included in the molecular network plot.

layout

Layout used by ggraph when creating the network. The default chosen here, "kk", is the the Kamada-Kawai layout algorithm which in most cases should produce a visually pleasing network. Another useful option is "circle", which puts all nodes in a circle, for easier comparisons between different networks.

Details

The network object from molNet and sampleData have to be supplied. In addition, groupData and/or an NPCTable can be supplied. If an NPCTable is supplied, which is recommended, node colours will represent NPC pathways, and node sizes the relative concentration of the compounds. Edge widths represent compound similarity, and only edges with similarity values above the cutOff value in the molNet function will be plotted. If groupData is supplied, one network will be created for each group. When groupData but not an NPCTable is supplied, compounds missing (i.e. having a mean of 0) from specific groups are plotted as triangles. When groupData and an NPCTable is supplied, compounds missing from specific groups have a white fill. Additionally, in both cases, edges connecting to missing compounds are lighter coloured. These graphical styles are done so that networks are more easy to compare across groups.

Value

A plot with one or more molecular networks.

Examples

data(minimalSampData)
data(minimalNPCTable)
data(minimalMolNet)
groups <- c("A", "A", "B", "B")
molNetPlot(minimalSampData, minimalMolNet)
molNetPlot(minimalSampData, minimalMolNet, groups)
molNetPlot(minimalSampData, minimalMolNet, plotNames = TRUE)

data(alpinaSampData)
data(alpinaPopData)
data(alpinaMolNet)
data(alpinaNPCTable)
molNetPlot(sampleData = alpinaSampData, networkObject = alpinaMolNet,
npcTable = alpinaNPCTable)

[Package chemodiv version 0.3.0 Index]