Mercator-class: The 'Mercator' Distance Visualization Object

Description Usage Arguments Value Slots Methods Author(s) See Also Examples

Description

The Mercator object represents a distance matrix together with clustering assignments and a set of visualizations. It implements four visualizations for clusters of large-scale, multi-dimensional data: hierarchical clustering, multi-dimensional scaling, t-Stochastic Neighbor Embedding (t-SNE), and iGraph. The default Mercator constructor applies one of ten metrics of binaryDistance to an object of the BinaryMatrix class.

Usage

1
2
3
Mercator(X, metric, method, K, ...)
addVisualization(DV, method, ...)
getClusters(DV)

Arguments

X

Either a BinaryMatrix or a dist object.

metric

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

method

A visualization method, currently limited to hclust, 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

Any arguments to the cmdscale function for an mds visualization. Most commonly, this is likely to include k, the number of dimensions to compute.

any

Any arguments to the Rtsne function for a tsne visualization. Common examples include dims and perplexity.

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 the Mercator class, including a distance matrix calculated on a given metric and given visualizations. It is also possible (though not advisable) to construct a Mercator obecject directly using the new function.

The addVisualizations function can be used to add additional visualizations to an existing 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 used and represented by this object.

view:

Object of class "list"; contains the results of calculations to generate each visualize the object.

clusters:

A numeric vector of cluster assignments.

symbols:

A numeric vector of valid plotting characters, as used by par(pch).

palette:

A character vector of color names.

Methods

plot(x, view = NULL, ask = NULL, ...):

Produce a plot of one or more visualizations within a Mercator object. The default view, when omitted, is the first one contained in the object. You can request multiple views at once; if the current plot layout doesn't have enough space in an interactive session, the ask parameters detemines whether the system will ask you before advancing to the next plot. When plotting a graph view, you can use an optional layout parameter to select a specific layout by name.

barplotheight, maion = ”, sub = NULL, border = NA, space = 0, ...

Produce a (colored) barplot of the silhouette widths for elements clustered in this class. Arguments are as described in te base function barplot.

scatter(object, view = NULL, ask = NULL, colramp = NULL, ...):

Produce a smooth scatter plot of one or more visualizations within a Mercator object. The default view, when omitted, is the first one contained in the object. You can request multiple views at once; if the current plot layout doesn't have enough space in an interactive session, the ask parameters detemines whether the system will ask you before advancing to the next plot. When plotting a graph view, you can use an optional layout parameter to select a specific layout by name. Arguments are otherwise the same as the smoothScatter function, execpt that the default color ramp is topo.colors.

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>, Caitlin E. Coombes

See Also

silhouette, smoothScatter, topo.colors.

Examples

 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
#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)
barplot(my.vis)
my.vis <- addVisualization(my.vis, "mds")
plot(my.vis, view = "hclust")
plot(my.vis, view = "mds")

scatter(my.vis, view ="mds")

# change the color palette
slot(my.vis, "palette") <- c("purple", "red", "orange", "green")
scatter(my.vis, view ="mds")

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

Mercator documentation built on Oct. 16, 2020, 3:01 a.m.