Mercator-class {Mercator}R Documentation

The Mercator Distance Visualization Object

Description

The Mercator object applies one of 10 metrics of binaryDistance to an object of class BinaryMatrix and implements 5 visualizations for clusters of large-scale, multi-dimensional data: hierarchical clustering, heat map, multi-dimensional scaling, t-Stochastic Neighbor Embedding (t-SNE), and iGraph.

Usage

Mercator(binaryMat, metric, method, K, ...)
addVisualization(DV, method, ...)
getClusters(DV)

Arguments

binaryMat

A BinaryMatrix.

metric

A binaryDistance limited to the names of 10 selected distance metrics: jaccard, sokalMichener, hamming, russellRao, pearson, goodmanKruskal, manhattan, canberra, binary, or euclid.

method

A visualization method, limited to hclust, heat, mds, tsne, and graph.

K

An integer specifying the number of desired clusters.

DV

A distance visualization produced as the output of the Mercator function.

...

Additional arguments passed on to the functions that implement different methods for addVisualization (possibly passed here through the Mercator function). These include

...

Any arguments to the cmdscale function for an mds visualization.

...

Any arguments to the Rtsne function for a tsne visualization.

Q

A quantile cutoff for the creation of the IGraph visualization. By default, the value is set at the 10th percentile.

Value

The Mercator function constructs and returns a distance visualization object of Mercator class, including a distance matrix calculated on a given metric and given visualiations.

The addVisualizations function can be used to add additional visualizations to a given Mercator object.

The getClusters function returns a vector of cluster assignments.

Slots

metric:

Object of class "character"; the name of the binaryDistance applied to create this object.

distance:

Object of class "dist"; the distance matrix calculated by this object.

view:

Object of class "list"; contains the calculations to generate each visualization added to the object.

colv:

Object of class "character"; a vector identifying the color assigned to each clustered feature.

symv:

Object of class "numeric"; a vector identifying the cluster number assigned to each clustered feature.

Methods

plot

signature(object = "Mercator"@view[[n]], col = "Mercator"@colv, pch = "Mercator"@symv)

: Produce a plot of the nth visualization created within a Mercator object. Producing a t-SNE plot requires the added information "Mercator"@view[[n]]$Y

hist

signature(object = "Mercator")

: Produce a histogram of distances calculated in the dissimilarity matrix generated in the Mercator object.

summary

signature(object = "Mercator")

: Returns the chosen distance metric, dimensions of the distance matrix, and available, calculated visualizations in this object.

dim

signature(object = "Mercator")

: Returns the dimensions of the distance matrix of this object.

[

signature(object = "Mercator")

: Subsets the distance matrix of this object.

Author(s)

Kevin R. Coombes <krc@silicovore.com

Examples

#Form a BinaryMatrix
data("iris")
my.data <- as.matrix(iris[,c(1:4)])
my.rows <- as.data.frame(c(1:length(my.data[,1])))
my.binmat <- BinaryMatrix(my.data, , my.rows)
my.binmat <- t(my.binmat)
summary(my.binmat)

# Form a Mercator object
# Set K to the known number of species in the dataset
my.vis <- Mercator(my.binmat, "euclid", "hclust", K=3) 
summary(my.vis)
hist(my.vis)
my.vis <- addVisualization(my.vis, "mds")
plot(my.vis@view[[1]], col=my.vis@colv, pch=my.vis@symv)
plot(my.vis@view[[2]], col=my.vis@colv, pch=my.vis@symv)

#Recover cluster identities
#What species comprise cluster 1?
my.clust <- getClusters(my.vis)
my.species <- iris$Species[my.clust == 1]
my.species

[Package Mercator version 0.8.2 Index]