formatData {bubbleHeatmap}R Documentation

Split Data Into Matrices and Reorder Rows and Columns.

Description

Prepare data variables for plot building by splitting into matrices and ordering rows and columns. Includes pre-defined settings for plotting Nightingale metabolomics data.

Usage

formatData(
  data,
  rowName = "rowName",
  colName = "colName",
  plotGroup = "plotGroup",
  colorValue = "colorValue",
  sizeValue = "sizeValue",
  rowOrder = NULL,
  colOrder = NULL,
  listOrder = NULL,
  nightingale = TRUE
)

Arguments

data

Dataset containing variables to be plotted on color and size scales with additional matrix layout specification variables (see details).

rowName

String naming the variable of data which defines rows of each matrix.

colName

String naming the variable of data which defines columns of each matrix.

plotGroup

String naming the variable of data which groups the dataset into plots.

colorValue

String naming the variable of data containing the values to be plotted on the color scale.

sizeValue

String naming the variable of data containing the values to scale bubble sizes.

rowOrder

List of vectors of character strings matching the values of rowName for each plot. List names should match values of plotGroup. Can be NULL (default) if no sorting required or when using inbuilt Nightingale ordering. If used, it is not necessary for all plots to have list entries, but each entry should include all row names for that plot.

colOrder

As rowOrder for columns and colName.

listOrder

Vector of character strings matching values of plotGroup variable, or NULL (default) if no sorting required or when using inbuilt Nightingale ordering.

nightingale

Logical - use Nightingale style settings?

Details

This function takes an input dataset with one row for each plot cell and splits it into a list of plot datasets as defined by the variable plotGroup. Each plot dataset is then recast (using the cast() function from the reshape package) into matrices defined by the colName and rowName variables. Two matrices are produced for each plot, containing the values of colorValue and sizeValue respectively. To use the included Nightingale metabolomics plot templates, the rowName, colName and plotGroup variables can be merged from the options in the package datafiles ntngale225/249.

Value

A list of two lists of numeric matrices. The matrices in colorList contain values of data$colorValue and those in sizeList contain values of data$sizeValue. The matrice layouts are defined by data$rowName and data$colName and each list has one item for each unique value of data$plotGroup.

Examples

data <- merge_template(cetp, "ckb_id")
formatData(data, colorValue = "estimate", sizeValue = "negLog10P",
nightingale = TRUE)

[Package bubbleHeatmap version 0.1.1 Index]