Description Usage Arguments Details Value Author(s) References Examples

The `downsample`

function implements a structured reduction
of data points with a parent `Mercator`

distance visualization to
improve visualization and computational time, especially for the
implementation of the iGraph visualization.

1 | ```
downsample(target, distanceMat, cutoff)
``` |

`target` |
An |

`distanceMat` |
An object of class |

`cutoff` |
An inclusion cutoff for selected points based on the local density within the parent data. |

Mercator can be used to visualize complex networks using
iGraph. To improve clarity of the visualization and computational
time, we implement the `downsample`

function to reduce the
number of data points to be linked and visualized. The conceptual
grounding for `downsample`

draws on Peng Qiu's implementation of the
SPADE clustering algorithm for mass cytometry data. The
`downsample`

function
under-samples the densest regions of the data space to make it more
likely that rarer clusters will still be adequately sampled.

`downsample`

returns an object of class `Mercator`

containing
a structured subset of items from the parent `Mercator`

object.

Kevin R. Coombes <krc@silicovore.com>, Caitlin E. Coombes

Qiu, P., et. al. (2011). Extracting a cellular hierarchy from high-dimensional cytometry data with SPADE. Nature biotechnology, 29(10), 886.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
#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 and plot Mercator object
# Set K to the known number of species in the dataset
my.vis <- Mercator(my.binmat, "euclid", "tsne", K=3)
summary(my.vis)
plot(my.vis, view = "tsne", main="t-SNE plot of all data points")
#Downsample the Mercator object
M <- as.matrix(my.vis@distance)
set.seed(21340)
DS <- downsample(50, M, 0.1)
red.vis <- my.vis[DS]
#Visualize the down sampled t-SNE plot
plot(red.vis, view = "tsne", main="Down sampled t-SNE Plot")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.