connectivity is an S4 generic that computes the
connectivity matrix based on the clustering of samples
obtained from a model's predict method.
The consensus matrix has been proposed by Brunet et
al. (2004) to help visualising and measuring the
stability of the clusters obtained by NMF approaches. For
objects of class NMF (e.g. results of a single NMF
run, or NMF models), the consensus matrix reduces to the
connectivity matrix.
extra arguments to allow extension. They are
passed to predict, except for the
vector and factor methods.
no.attrib
a logical that indicates if attributes
containing information about the NMF model should be
attached to the result (TRUE) or not
(FALSE).
Details
The connectivity matrix of a given partition of a set of
samples (e.g. given as a cluster membership index) is the
matrix C containing only 0 or 1 entries such that:
C_{ij} = 1 if
sample i belongs to the same cluster as sample j, 0
otherwise
Value
a square matrix of dimension the number of samples in the
model, full of 0s or 1s.
Methods
connectivity
signature(object = "ANY"):
Default method which computes the connectivity matrix
using the result of predict(x, ...) as cluster
membership index.
connectivity
signature(object = "factor"):
Computes the connectivity matrix using x as
cluster membership index.
connectivity
signature(object = "numeric"):
Equivalent to connectivity(as.factor(x)).
connectivity
signature(object = "NMF"):
Computes the connectivity matrix for an NMF model, for
which cluster membership is given by the most
contributing basis component in each sample. See
predict,NMF-method.
consensus
signature(object = "NMFfitX"):
Pure virtual method defined to ensure consensus is
defined for sub-classes of NMFfitX. It throws an
error if called.
consensus
signature(object = "NMF"): This
method is provided for completeness and is identical to
connectivity, and returns the connectivity
matrix, which, in the case of a single NMF model, is also
the consensus matrix.
consensus
signature(object = "NMFfitX1"):
The result is the matrix stored in slot
‘consensus’. This method returns NULL if
the consensus matrix is empty.
See consensus,NMFfitX1-method for more
details.
consensus
signature(object = "NMFfitXn"):
This method returns NULL on an empty object. The
result is a matrix with several attributes attached, that
are used by plotting functions such as
consensusmap to annotate the plots.
See consensus,NMFfitXn-method for more
details.
References
Brunet J, Tamayo P, Golub TR and Mesirov JP (2004).
"Metagenes and molecular pattern discovery using matrix
factorization." _Proceedings of the National Academy of
Sciences of the United States of America_, *101*(12), pp.
4164-9. ISSN 0027-8424, <URL:
http://dx.doi.org/10.1073/pnas.0308531101>, <URL:
http://www.ncbi.nlm.nih.gov/pubmed/15016911>.
See Also
predict
Examples
#----------
# connectivity,ANY-method
#----------
# clustering of random data
h <- hclust(dist(rmatrix(10,20)))
connectivity(cutree(h, 2))
#----------
# connectivity,factor-method
#----------
connectivity(gl(2, 4))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(NMF)
Loading required package: pkgmaker
Loading required package: registry
Attaching package: 'pkgmaker'
The following object is masked from 'package:base':
isNamespaceLoaded
Loading required package: rngtools
Loading required package: cluster
NMF - BioConductor layer [OK] | Shared memory capabilities [OK] | Cores 3/4
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/NMF/connectivity.Rd_%03d_medium.png", width=480, height=480)
> ### Name: connectivity
> ### Title: Clustering Connectivity and Consensus Matrices
> ### Aliases: connectivity connectivity,ANY-method
> ### connectivity,factor-method connectivity-methods
> ### connectivity,NMF-method connectivity,numeric-method consensus
> ### consensus-methods consensus,NMFfitX-method consensus,NMF-method
> ### Keywords: methods
>
> ### ** Examples
>
> ## Don't show:
> # roxygen generated flag
> options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
> ## End(Don't show)
>
> #----------
> # connectivity,ANY-method
> #----------
> # clustering of random data
> h <- hclust(dist(rmatrix(10,20)))
> connectivity(cutree(h, 2))
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 1 1 0 1 1 1 0 1 0 1
[2,] 1 1 0 1 1 1 0 1 0 1
[3,] 0 0 1 0 0 0 1 0 1 0
[4,] 1 1 0 1 1 1 0 1 0 1
[5,] 1 1 0 1 1 1 0 1 0 1
[6,] 1 1 0 1 1 1 0 1 0 1
[7,] 0 0 1 0 0 0 1 0 1 0
[8,] 1 1 0 1 1 1 0 1 0 1
[9,] 0 0 1 0 0 0 1 0 1 0
[10,] 1 1 0 1 1 1 0 1 0 1
>
> #----------
> # connectivity,factor-method
> #----------
> connectivity(gl(2, 4))
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 1 1 1 0 0 0 0
[2,] 1 1 1 1 0 0 0 0
[3,] 1 1 1 1 0 0 0 0
[4,] 1 1 1 1 0 0 0 0
[5,] 0 0 0 0 1 1 1 1
[6,] 0 0 0 0 1 1 1 1
[7,] 0 0 0 0 1 1 1 1
[8,] 0 0 0 0 1 1 1 1
>
>
>
>
>
> dev.off()
null device
1
>