Description Usage Arguments Details Methods (by generic) References Examples
The NMF package ships an advanced heatmap engine implemented by the function
aheatmap
.
Some convenience heatmap functions have been implemented for NMF models,
which redefine default values for some of the arguments of aheatmap
,
hence tuning the output specifically for NMF models.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | basismap(object, ...)
## S4 method for signature 'NMF'
basismap(
object,
color = "YlOrRd:50",
scale = "r1",
Rowv = TRUE,
Colv = NA,
subsetRow = FALSE,
annRow = NA,
annCol = NA,
tracks = "basis",
main = "Basis components",
info = FALSE,
...
)
coefmap(object, ...)
## S4 method for signature 'NMF'
coefmap(
object,
color = "YlOrRd:50",
scale = "c1",
Rowv = NA,
Colv = TRUE,
annRow = NA,
annCol = NA,
tracks = "basis",
main = "Mixture coefficients",
info = FALSE,
...
)
consensusmap(object, ...)
## S4 method for signature 'NMFfitX'
consensusmap(
object,
annRow = NA,
annCol = NA,
tracks = c("basis:", "consensus:", "silhouette:"),
main = "Consensus matrix",
info = FALSE,
...
)
## S4 method for signature 'NMF'
consensusmap(object, ...)
## S4 method for signature 'matrix'
consensusmap(
object,
color = "-RdYlBu",
distfun = function(x) as.dist(1 - x),
hclustfun = "average",
Rowv = TRUE,
Colv = "Rowv",
main = if (is.null(nr) || nr > 1) "Consensus matrix" else "Connectiviy matrix",
info = FALSE,
...
)
## S4 method for signature 'NMFfitX'
basismap(object, ...)
## S4 method for signature 'NMFfitX'
coefmap(
object,
Colv = TRUE,
annRow = NA,
annCol = NA,
tracks = c("basis", "consensus:"),
...
)
|
object |
an object from which is extracted NMF factors or a consensus matrix |
... |
extra arguments passed to |
color |
colour specification for the heatmap. Default to palette '-RdYlBu2:100', i.e. reversed palette 'RdYlBu2' (a slight modification of RColorBrewer's palette 'RdYlBu') with 100 colors. Possible values are:
When the colour palette is specified with a single value, and is negative or preceded a minus ('-'), the reversed palette is used. The number of breaks can also be specified after a colon (':'). For example, the default colour palette is specified as '-RdYlBu2:100'. |
scale |
character indicating how the values should scaled in either the row direction or the column direction. Note that the scaling is performed after row/column clustering, so that it has no effect on the row/column ordering. Possible values are:
|
Rowv |
clustering specification(s) for the rows. It allows to specify the distance/clustering/ordering/display parameters to be used for the rows only. See section Row/column ordering and display for details on all supported values. |
Colv |
clustering specification(s) for the columns. It accepts the same
values as argument
See section Row/column ordering and display for details on all supported values. |
subsetRow |
Argument that specifies how to filter the rows that
will appear in the heatmap.
When
|
annRow |
specifications of row annotation tracks displayed as coloured
columns on the left of the heatmaps. The annotation tracks are drawn from
left to right. The same conversion, renaming and colouring rules as for argument
|
annCol |
specifications of column annotation tracks displayed as coloured
rows on top of the heatmaps. The annotation tracks are drawn from bottom to top.
A single annotation track can be specified as a single vector; multiple tracks
are specified as a list, a data frame, or an
|
tracks |
Special additional annotation tracks to highlight associations between basis components and sample clusters:
|
main |
Main title as a character string or a grob. |
info |
if |
distfun |
default distance measure used in clustering rows and columns. Possible values are:
|
hclustfun |
default clustering method used to cluster rows and columns. Possible values are:
|
IMPORTANT: although they essentially have the same set of arguments,
their order sometimes differ between them, as well as from aheatmap
.
We therefore strongly recommend to use fully named arguments when calling these functions.
basimap
default values for the following arguments of aheatmap
:
the color palette;
the scaling specification, which by default scales each
row separately so that they sum up to one (scale='r1'
);
the column ordering which is disabled;
allowing for passing feature extraction methods in argument
subsetRow
, that are passed to extractFeatures
.
See argument description here and therein.
the addition of a default named annotation track, that shows the dominant basis component for each row (i.e. each feature).
This track is specified in argument tracks
(see its argument description).
By default, a matching column annotation track is also displayed, but may be
disabled using tracks=':basis'
.
a suitable title and extra information like the fitting algorithm,
when object
is a fitted NMF model.
coefmap
redefines default values for the following arguments of
aheatmap
:
the color palette;
the scaling specification, which by default scales each
column separately so that they sum up to one (scale='c1'
);
the row ordering which is disabled;
the addition of a default annotation track, that shows the most contributing basis component for each column (i.e. each sample).
This track is specified in argument tracks
(see its argument description).
By default, a matching row annotation track is also displayed, but can be disabled
using tracks='basis:'
.
a suitable title and extra information like the fitting algorithm,
when object
is a fitted NMF model.
consensusmap
redefines default values for the following arguments of
aheatmap
:
the colour palette;
the column ordering which is set equal to the row ordering, since a consensus matrix is symmetric;
the distance and linkage methods used to order the rows (and columns). The default is to use 1 minus the consensus matrix itself as distance, and average linkage.
the addition of two special named annotation tracks, 'basis:'
and
'consensus:'
, that show, for each column (i.e. each sample),
the dominant basis component in the best fit and the hierarchical clustering
of the consensus matrix respectively (using 1-consensus as distance and average
linkage).
These tracks are specified in argument tracks
, which behaves as in
basismap
.
a suitable title and extra information like the type of NMF model or the
fitting algorithm, when object
is a fitted NMF model.
basismap:
basismap(object = NMF)
: Plots a heatmap of the basis matrix of the NMF model object
.
This method also works for fitted NMF models (i.e. NMFfit
objects).
basismap(object = NMFfitX)
: Plots a heatmap of the basis matrix of the best fit in object
.
coefmap:
coefmap(object = NMF)
: The default method for NMF objects has special default values for
some arguments of aheatmap
(see argument description).
coefmap(object = NMFfitX)
: Plots a heatmap of the coefficient matrix of the best fit in object
.
This method adds:
an extra special column annotation track for multi-run NMF fits,
'consensus:'
, that shows the consensus cluster associated to each sample.
a column sorting schema 'consensus'
that can be passed
to argument Colv
and orders the columns using the hierarchical clustering of the
consensus matrix with average linkage, as returned by consensushc(object)
.
This is also the ordering that is used by default for the heatmap of the consensus matrix
as ploted by consensusmap
.
consensusmap:
consensusmap(object = NMF.rank)
: Draw a single plot with a heatmap of the consensus matrix obtained for each value of the rank,
in the range tested with nmfEstimateRank
.
consensusmap(object = list)
: Draw a single plot with a heatmap of the consensus matrix of each element in the list object
.
consensusmap(object = NMFfitX)
: Plots a heatmap of the consensus matrix obtained when fitting an NMF model with multiple runs.
consensusmap(object = NMF)
: Plots a heatmap of the connectivity matrix of an NMF model.
consensusmap(object = matrix)
: Main method that redefines default values for arguments of aheatmap
.
Kim H, Park H (2007). “Sparse non-negative matrix factorizations via alternating non-negativity-constrained least squares for microarray data analysis.” _Bioinformatics (Oxford, England)_, *23*(12), 1495-502. ISSN 1460-2059, doi: 10.1093/bioinformatics/btm134 (URL: https://doi.org/10.1093/bioinformatics/btm134).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## More examples are provided in demo `heatmaps`
## Not run:
demo(heatmaps)
## End(Not run)
##
# random data with underlying NMF model
v <- syntheticNMF(20, 3, 10)
# estimate a model
x <- nmf(v, 3)
# show basis matrix
basismap(x)
## Not run:
# without the default annotation tracks
basismap(x, tracks=NA)
## End(Not run)
# coefficient matrix
coefmap(x)
## Not run:
# without the default annotation tracks
coefmap(x, tracks=NA)
## End(Not run)
## Not run:
res <- nmf(x, 3, nrun=3)
consensusmap(res)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.