Class: DecompositionModel

DecompositionModel

DecompositionModel

Models all the ordination data to be plotted.

Constructor

new DecompositionModel(name, ids, coords, pct_var, md_headers, metadata) → {DecompositionModel}

Parameters:
Name Type Description
name string

A string containing the abbreviated name of the ordination method.

ids Array.<string>

An array of strings where each string is a sample identifier

coords Array.<float>

A 2D Array of floats where each row contains the coordinates of a sample. The rows are in ids order.

pct_var Array.<float>

An Array of floats where each position contains the percentage explained by that axis

md_headers Array.<float>

An Array of string where each string is a metadata column header

metadata Array.<string>

A 2D Array of strings where each row contains the metadata values for a given sample. The rows are in ids order. The columns are in md_headers order.

Source:
Throws:

In any of the following cases:

  • The number of coordinates does not match the number of samples.
  • If there's a coordinate in coords that doesn't have the same length as the rest.
  • The number of samples is different than the rows provided as metadata.
  • Not all metadata rows have the same number of fields.
Type
Error
Returns:
Type
DecompositionModel

Members

abbreviatedName :string

Abbreviated name of the ordination method used to create the data.

Type:
  • string
Source:

axesNames :Array.<string>

Names of the axes in the ordination

Type:
  • Array.<string>
Source:

dimensionRanges :Object

Minimum and maximum values for each axis in the ordination. More concretely this object has a min and a max attributes, each with a list of floating point arrays that describe the minimum and maximum for each axis.

Type:
  • Object
Source:

ids :Array.<string>

List of sample name identifiers.

Type:
  • Array.<string>
Source:

md_headers :Array.<string>

Column names for the metadata in the samples.

Type:
  • Array.<string>
Source:

percExpl :Array.<float>

Percentage explained by each of the axes in the ordination.

Type:
  • Array.<float>
Source:

Methods

apply(func) → {Array.<Object>}

Executes the provided func passing all the plottables as parameters.

Parameters:
Name Type Description
func function

The function to call for each plottable. It should accept a single parameter which will be the plottable.

Source:
Returns:

An array with the results of executing func over all plottables.

Type
Array.<Object>

getPlottableByID(id) → {Plottable}

Retrieve the plottable object with the given id.

Parameters:
Name Type Description
id string

A string with the plottable.

Source:
Returns:

The plottable object for the given id.

Type
Plottable

getPlottableByIDs(idArray) → {Array.<Plottable>}

Retrieve all the plottable objects with the given ids.

Parameters:
Name Type Description
idArray Array.<integer>

an Array of strings where each string is a plottable id.

Source:
Returns:

An Array of plottable objects for the given ids.

Type
Array.<Plottable>

getPlottablesByMetadataCategoryValue(category, value) → {Array.<Plottable>}

Retrieve all the plottable objects under the metadata header value.

Parameters:
Name Type Description
category string

A string with the metadata header.

value string

A string with the value under the metadata category.

Source:
Returns:

An Array of plottable objects for the given category value pair.

Type
Array.<Plottable>

getUniqueValuesByCategory(category) → {Array.<string>}

Retrieve the available values for a given metadata category

Parameters:
Name Type Description
category string

A string with the metadata header.

Source:
Returns:

An array of the available values for the given metadata header.

Type
Array.<string>

toString() → {string}

Helper method to convert a DecompositionModel into a string.

Source:
Returns:

String representation describing the Decomposition object.

Type
string