Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

set (clustergram)

Set property of clustergram object

Syntax

set(CGobj)
set(CGobj, 'PropertyName')
set(CGobj, 'PropertyName', PropertyValue)
set(CGobj, 'Property1Name', Property1Value, 'Property2Name', Property2Value, ...)

Arguments

CGobjClustergram object created with the function clustergram.
PropertyNameProperty name for a clustergram object.

Description

Note

You cannot set the properties of a clustergram object if you created it using the Export Group to Workspace command in the Clustergram window.

set(CGobj) displays possible values for all properties that have a fixed set of property values in CGobj, a clustergram object.

set(CGobj, 'PropertyName') displays possible values for a specific property that has a fixed set of property values in CGobj, a clustergram object.

set(CGobj, 'PropertyName', PropertyValue) sets the specified property of CGobj, a clustergram object.

set(CGobj, 'Property1Name', Property1Value, 'Property2Name', Property2Value, ...) sets the specified properties of CGobj, a clustergram object.

Properties of a Clustergram Object

PropertyDescription
RowLabels Vector of numbers or cell array of character vectors to label the rows in the dendrogram and heat map. Default is a vector of values 1 through M, where M is the number of rows in Data, the matrix of data used by the clustergram function to create the clustergram object.
ColumnLabelsVector of numbers or cell array of character vectors to label the columns in the dendrogram and heat map. Default is a vector of values 1 through N, where N is the number of columns in Data, the matrix of data used by the clustergram function to create the clustergram object.
Standardize

Numeric value that specifies the dimension for standardizing the values in Data, the matrix of data used to create the clustergram object. The standardized values are transformed so that the mean is 0 and the standard deviation is 1 in the specified dimension. Choices are:

  • 'column' or 1 — Standardize along the columns of data.

  • 'row' or 2 — Standardize along the rows of data.

  • 'none' or 3 (default) — Do not standardize.

Cluster

Numeric value that specifies the dimension for clustering the values in Data, the matrix of data used to create the clustergram object. Choices are:

  • 1 — Cluster rows of data only.

  • 2 — Cluster columns of data only.

  • 3 — Cluster rows of data, then cluster columns of row-clustered data.

RowPdist

Character vector that specifies the distance metric to pass to the pdist function (Statistics and Machine Learning Toolbox™ software) to use to calculate the pairwise distances between rows. For information on choices, see the pdist function.

Note

If the distance metric requires extra arguments, then RowPdistValue is a cell array. For example, to use the Minkowski distance with exponent P, you would use {'minkowski', P}.

ColumnPdist

Character vector that specifies the distance metric to pass to the pdist function (Statistics and Machine Learning Toolbox software) to use to calculate the pairwise distances between columns. For information on choices, see the pdist function.

Note

If the distance metric requires extra arguments, then ColumnPdistValue is a cell array. For example, to use the Minkowski distance with exponent P, you would use {'minkowski', P}.

LinkageCharacter vector or two-element cell array of character vectors that specifies the linkage method to pass to the linkage function (Statistics and Machine Learning Toolbox software) to use to create the hierarchical cluster tree for rows and columns. If a two-element cell array of character vectors, the first element is used for linkage between rows, and the second element is used for linkage between columns. For information on choices, see the linkage function.
DendrogramScalar or two-element numeric vector or cell array that specifies the 'colorthreshold' property to pass to the dendrogram function (Statistics and Machine Learning Toolbox software) to create the dendrogram plot. If a two-element numeric vector or cell array, the first element is for the rows, and the second element is for the columns. For more information, see the dendrogram function.
OptimalLeafOrderProperty to enable or disable the optimal leaf ordering calculation, which determines the leaf order that maximizes the similarity between neighboring leaves. Choices are true (enable) or false (disable).

Tip

Disabling the optimal leaf ordering calculation can be useful when working with large data sets because this calculation uses a large amount of memory and can be very time consuming.

LogTransControls the log2 transform of Data, the matrix of data used to create the clustergram object, from natural scale. Choices are true or false.
Colormap

Either of the following:

  • M-by-3 matrix of RGB values

  • Name or function handle of a function that returns a colormap, such as redgreencmap or redbluecmap

DisplayRange

Positive scalar that specifies the display range of standardized values.

For example, if you specify redgreencmap for the 'ColorMap' property, pure red represents values ≥ DisplayRange, and pure green represents values ≤ –DisplayRange.

SymmetricProperty to force the color scale of the heat map to be symmetric around zero. Choices are true or false.
Ratio

Either of the following:

  • Scalar

  • Two-element vector

It specifies the ratio of space that the row and column dendrograms occupy relative to the heat map. If Ratio is a scalar, it is used as the ratio for both dendrograms. If Ratio is a two-element vector, the first element is used for the ratio of the row dendrogram width to the heat map width, and the second element is used for the ratio of the column dendrogram height to the heat map height. The second element is ignored for one-dimensional clustergrams.

Impute

Any of the following:

  • Name of a function that imputes missing data.

  • Handle to a function that imputes missing data.

  • Cell array where the first element is the name of or handle to a function that imputes missing data and the remaining elements are property name/property value pairs used as inputs to the function.

RowMarkers

Optional structure array for annotating the groups (clusters) of rows determined by the clustergram function. Each structure in the array represents a group of rows and contains the following fields:

  • GroupNumber — Number to annotate the row group.

  • Annotation — Character vector specifying text to annotate the row group.

  • Color — Character vector or three-element vector of RGB values specifying a color, which is used to label the row group. For more information on specifying colors, see colorspec. If this field is empty, default is 'blue'.

ColumnMarkers

Optional structure array for annotating groups (clusters) of columns determined by the clustergram function. Each structure in the array represents a group of rows and contains the following fields:

  • GroupNumber — Number to annotate the column group.

  • Annotation — Character vector specifying text to annotate the column group.

  • Color — Character vector or three-element vector of RGB values specifying a color, which is used to label the column group. For more information on specifying colors, see colorspec. If this field is empty, default is 'blue'.

Examples

collapse all

Load microarray data containing gene expression levels of Saccharomyces cerevisiae (yeast) during the metabolic shift from fermentation to respiration (Derisi, J. et al., 1997).

load filteredyeastdata

This MAT-file includes three variables, which are added to the MATLAB® workspace:

  • yeastvalues - A matrix of gene expression data from Saccharomyces cerevisiae during the metabolic shift from fermentation to respiration

  • genes - A cell array of GenBank® accession numbers for labeling the rows in yeastvalues

  • times - A vector of time values for labeling the columns in yeastvalues

Create a clustergram object and display the heat map from the gene expression data in the first 30 rows of the yeastvalues matrix and standardize along the rows of data.

cgo = clustergram(yeastvalues(1:30,:),'Standardize','Row')
Clustergram object with 30 rows of nodes and 7 columns of nodes.

Use the set method and the genes and times vectors to add meaningful row and column labels to the clustergram.

set(cgo,'RowLabels',genes(1:30),'ColumnLabels',times)

Add a color bar to the clustergram by clicking the Insert Colorbar button on the toolbar.

View a data tip containing the intensity value, row label, and column label for a specific area of the heat map by clicking the Data Cursor button on the toolbar, then clicking an area in the heat map. To delete this data tip, right-click it, then select Delete Current Datatip.

Display intensity values for each area of the heat map by clicking the Annotate button on the toolbar. Click the Annotate button again to remove the intensity values.

Tip: If the amount of data is large enough, the cells within the clustergram
are too small to display the intensity annotations. Zoom in to see the
intensity annotations.

Remove the dendrogram tree diagrams from the figure by clicking the Show Dendrogram button on the toolbar. Click it again to display the dendrograms.

Use the get method to display the properties of the clustergram object, cgo.

get(cgo)
               Cluster: 'ALL'
              RowPDist: {'Euclidean'}
           ColumnPDist: {'Euclidean'}
               Linkage: {'Average'}
            Dendrogram: {}
      OptimalLeafOrder: 1
              LogTrans: 0
          DisplayRatio: [0.2000 0.2000]
        RowGroupMarker: []
     ColumnGroupMarker: []
        ShowDendrogram: 'on'
           Standardize: 'ROW'
             Symmetric: 1
          DisplayRange: 3
              Colormap: [11x3 double]
             ImputeFun: []
          ColumnLabels: {1x7 cell}
             RowLabels: {30x1 cell}
    ColumnLabelsRotate: 90
       RowLabelsRotate: 0
              Annotate: 'off'
        AnnotPrecision: 2
            AnnotColor: 'w'
     ColumnLabelsColor: []
        RowLabelsColor: []
     LabelsWithMarkers: 0

Change the clustering parameters by changing the linkage method and changing the color of the groups of nodes in the dendrogram whose linkage is less than a threshold of 3.

set(cgo,'Linkage','complete','Dendrogram',3)

Place the cursor on a branch node in the dendrogram to highlight (in blue) the group associated with it. Press and hold the mouse button to display a data tip listing the group number and the nodes (genes or samples) in the group.

Right-click a branch node in the dendrogram to display a menu of options.

The following options are available:

  • Set Group Color - Change the cluster group color.

  • Print Group to Figure - Print the group to a Figure window.

  • Copy Group to New Clustergram - Copy the group to a new Clustergram window.

  • Export Group to Workspace - Create a clustergram object of the group in the MATLAB Workspace.

  • Export Group Info to Workspace - Create a structure containing information about the group in the MATLAB Workspace. The structure contains these fields:

  1. GroupNames - Cell array of character vectors containing the names of the row or column groups.

  2. RowNodeNames - Cell array of character vectors containing the names of the row nodes.

  3. ColumnNodeNames - Cell array of text character vectors containing the names of the column nodes.

  4. ExprValues - An M-by-N matrix of intensity values, where M and N are the number of row nodes and of column nodes respectively. If the matrix contains gene expression data, typically each row corresponds to a gene and each column corresponds to sample.

Create a clustergram object in the MATLAB Workspace of Group 18 by right-clicking it, then selecting Export Group to Workspace. In the Export to Workspace dialog box, type Group18, then click OK.

Use the view method to view the clustergram object, Group18.

view(Group18)

View all the gene expression data using a diverging red and blue colormap and standardize along the rows of data.

cgo_all = clustergram(yeastvalues,'Colormap',redbluecmap,'Standardize','Row')
Clustergram object with 614 rows of nodes and 7 columns of nodes.

Create structure arrays to specify marker colors and annotations for two groups of rows (510 and 593) and two groups of columns (4 and 5).

rm = struct('GroupNumber',{510,593},'Annotation',{'A','B'},...
     'Color',{'b','m'});
cm = struct('GroupNumber',{4,5},'Annotation',{'Time1','Time2'},...
     'Color',{[1 1 0],[0.6 0.6 1]});

Use the 'RowGroupMarker' and 'ColumnGroupMarker' properties to add the color markers and annotations to the clustergram.

set(cgo_all,'RowGroupMarker',rm,'ColumnGroupMarker',cm)

References

[1] DeRisi, J.L., Iyer, V.R., and Brown, P.O. (1997). Exploring the metabolic and genetic control of gene expression on a genomic scale. Science 278, 680–686s.

Introduced in R2008a

Was this topic helpful?