Class: ColorViewController

ColorViewController

ColorViewController

Controls the color changing tab in Emperor. Takes care of changes to color based on metadata, as well as making colorbars if coloring by a numeric metadata category.

Constructor

new ColorViewController(container, decompViewDict) → {ColorViewController}

Parameters:
Name Type Description
container Node

Container node to create the controller in.

decompViewDict Object

This is object is keyed by unique identifiers and the values are DecompositionView objects referring to a set of objects presented on screen. This dictionary will usually be shared by all the tabs in the application. This argument is passed by reference.

Source:
Returns:
Type
ColorViewController

Extends

Members

(static) Colormaps :Object

Color maps available, along with what type of colormap they are.

Type:
  • Object
Source:

$body :Node

jQuery element for the body, which contains the lowermost elementsdisplayed in tab. This goes below the header.

Type:
  • Node
Inherited From:
Source:

$canvas :Node

jQuery element for the canvas, which contains the header and the body.

Type:
  • Node
Inherited From:
Source:

$colormapSelect :Node

jQuery object holding the select box for the colormaps

Type:
  • Node
Source:

$colorScale :Node

jQuery object holding the SVG colorbar

Type:
  • Node
Source:

$container :Node

jQuery element for the parent container.

Type:
  • Node
Inherited From:
Source:

$gridDiv :Node

jQuery element for the div containing the slickgrid of sample information

Type:
  • Node
Inherited From:
Source:

$header :Node

jQuery element for the header which contains the uppermost elementsdisplayed in a tab.

Type:
  • Node
Inherited From:
Source:

$scaled :Node

jQuery object holding the continuous value checkbox

Type:
  • Node
Source:

$scaleDiv :Node

jQuery object holding the colorbar div

Type:
  • Node
Source:

$scaledLabel :Node

jQuery object holding the continuous value label

Type:
  • Node
Source:

active :Boolean

Indicates whether the tab is front most

Type:
  • Boolean
Inherited From:
Default Value:
  • false
Source:

activeViewKey :String

This is the key of the active decomposition view.

Type:
  • String
Inherited From:
Source:

bodyGrid :Slick.Grid

Container that lists the metadata categories described under themetadataField column and the attribute that can be modified.

Type:
  • Slick.Grid
Inherited From:
Source:

decompViewDict :Object

This is object is keyed by unique identifiers and the values areDecompositionView objects referring to a set of objects presented onscreen. This dictionary will usually be shared by all the tabs in theapplication. This argument is passed by reference.

Type:
  • Object
Inherited From:
Source:

description :String

Human-readable description of the tab.

Type:
  • String
Inherited From:
Source:

enabled :Boolean

Indicates if tab can be accessed.

Type:
  • Boolean
Inherited From:
Default Value:
  • true
Source:

identifier :String

Unique hash identifier for the tab instance.

Type:
  • String
Inherited From:
Default Value:
  • "EMPtab-xxxxxxx"
Source:

metadataField :String

Metadata column name.

Type:
  • String
Inherited From:
Source:

title :String

Human-readable title of the tab.

Type:
  • String
Inherited From:
Source:

Methods

(static) getColorList(values, mapopt, discrete, scaledopt) → {Object|String}

Wrapper for generating a list of colors that corresponds to all samples in the plot by coloring type requested

Parameters:
Name Type Attributes Default Description
values Array.<String>

list of objects to generate a color for, usually a category in a given metadata column.

map String <optional>
{'discrete-coloring-qiime'|'Viridis'}

name of the color map to use, see ColorViewController.Colormaps

discrete Boolean

Whether to treat colormap requested as a discrete set of colors or use interpolation to create gradient of colors

scaled Boolean <optional>
false

Whether to use a scaled colormap or equidistant colors for each value

Source:
See:
Returns:
  • colors The object containing the hex colors keyed to each sample

    Type
    Object
  • gradientSVG The SVG string for the scaled data or null

    Type
    String

(static) getDiscreteColors(values, mapopt) → {Object}

Retrieve a discrete color set.

Parameters:
Name Type Attributes Default Description
values Array.<String>

list of objects to generate a color for, usually a category in a given metadata column.

map String <optional>
'discrete-coloring-qiime'

name of the color map to use, see ColorViewController.Colormaps

Source:
See:
Returns:

colors The object containing the hex colors keyed to each sample

Type
Object

(static) getInterpolatedColors(values, mapopt) → {Object}

Retrieve an interpolatd color set.

Parameters:
Name Type Attributes Default Description
values Array.<String>

Objects to generate a color for, usually a category in a given metadata column.

map String <optional>
'Viridis'

name of the discrete color map to use.

Source:
Returns:

colors The object containing the hex colors keyed to each sample.

Type
Object

(static) getScaledColors(values, mapopt, nanColoropt) → {Object|String}

Retrieve a scaled color set.

Parameters:
Name Type Attributes Default Description
values Array.<String>

Objects to generate a color for, usually a category in a given metadata column.

map String <optional>
'Viridis'

name of the discrete color map to use.

nanColor String <optional>
'#64655d'

Color to use for non-numeric values.

Source:
Returns:
  • colors The object containing the hex colors keyed to each sample

    Type
    Object
  • gradientSVG The SVG string for the scaled data or null

    Type
    String

fromJSON(Parsed)

Decodes JSON string and modifies its own instance variables accordingly.

Parameters:
Name Type Description
Parsed Object

JSON string representation of self.

Overrides:
Source:

getActiveDecompViewKey() → {String}

Retrieves the metadata field currently being controlled

Inherited From:
Source:
Returns:

A key corresponding to the active decomposition view.

Type
String

getSlickGridDataset() → {Array}

Retrieves the underlying data in the slick grid

Inherited From:
Source:
Returns:

Returns an array of objects displayed by the body grid.

Type
Array

resize(width, height)

Resizes the container and the individual elements.

Note, the consumer of this class, likely the main controller should call the resize function any time a resizing event happens.

Parameters:
Name Type Description
width Float

the container width.

height Float

the container height.

Overrides:
Source:

setActive(trulse)

Sets whether or not the tab is visible.

Parameters:
Name Type Description
trulse Boolean

option to activate tab (i.e. move tab to foreground).

Inherited From:
Source:

setActiveDecompViewKey(k)

Changes the metadata column name to control.

Parameters:
Name Type Description
k String

Key corresponding to active decomposition view.

Inherited From:
Source:

setEnabled(trulse)

Sets whether or not the tab can be modified or accessed.

Parameters:
Name Type Description
trulse Boolean

option to enable tab.

Inherited From:
Source:

setMetadataField(m)

Changes the metadata column name to control.

Parameters:
Name Type Description
m String

Metadata column name to control.

Inherited From:
Source:

setPlottableAttributes(object, string, array)

Helper function to set the color of plottable

Parameters:
Name Type Description
object scope

, the scope where the plottables exist

string color

, hexadecimal representation of a color, which will be applied to the plottables

array group

of objects, list of object that should be changed in scope

Source:

setSlickGridDataset(data)

Changes the underlying data in the slick grid

Parameters:
Name Type Description
data Array

data.

Inherited From:
Source:

toJSON() → {Object}

Converts the current instance into a JSON string.

Overrides:
Source:
Returns:

JSON ready representation of self.

Type
Object