Constructor
new DecompositionModel(data, md_headers, metadata) → {DecompositionModel}
Parameters:
Name | Type | Description |
---|---|---|
data |
object | An object with the following attributes (keys):
|
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 |
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
axesNames :Array.<string>
Names of the axes in the ordination
Type:
- Array.<string>
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
dimensions :integer
Number of dimensions in this decomposition model
Type:
- integer
edges :Array.<Array>
Array of pairs of Plottable objects.
Type:
- Array.<Array>
ids :Array.<string>
List of sample name identifiers.
Type:
- Array.<string>
length :integer
Number of plottables in this decomposition model
Type:
- integer
md_headers :Array.<string>
Column names for the metadata in the samples.
Type:
- Array.<string>
percExpl :Array.<float>
Percentage explained by each of the axes in the ordination.
Type:
- Array.<float>
type :string
Model's type of the data, can be either 'scatter' or 'arrow'
Type:
- string
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. |
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. |
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. |
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. |
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. |
Returns:
An array of the available values for the given metadata header sorted first alphabetically and then numerically.
- Type
- Array.<string>
hasConfidenceIntervals() → {Boolean}
Whether or not the plottables have confidence intervals
Returns:
true
if the plottables have confidence intervals,
false
otherwise.
- Type
- Boolean
isArrowType()
Method to determine if this is an arrow decomposition
isScatterType()
Method to determine if this is a scatter decomposition
toString() → {string}
Helper method to convert a DecompositionModel into a string.
Returns:
String representation describing the Decomposition object.
- Type
- string