clusterTracks: Cluster Tracks

Description Usage Arguments Details Value Examples

View source: R/functions.R

Description

Perform a hierarchical clustering of a set of tracks according to a given vector of track measures.

Usage

1

Arguments

tracks

the tracks that are to be clustered.

measures

a function, or a vector of functions (see TrackMeasures). Each function is expected to return a single number given a single track.

scale

logical indicating whether the measures values shall be scaled using the function scale before the clustering.

...

additional parameters to be passed to hclust.

Details

The measures are applied to each of the tracks in the given tracks object. According to the resulting values, the tracks are clustered using a hierarchical clustering (see hclust). If scale is TRUE, the measure values are scaled to mean value 0 and standard deviation 1 (per measure) before the clustering.

Value

An object of class *hclust*, see hclust.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Cluster tracks according to the mean of their Hust exponents along X and Y

cells <- c(TCells,Neutrophils)
real.celltype <- rep(c("T","N"),c(length(TCells),length(Neutrophils)))
## Prefix each track ID with its cell class to evaluate the clustering visually
names(cells) <- paste0(real.celltype,seq_along(cells))
clust <- clusterTracks( cells, hurstExponent )
plot( clust )
## How many cells are "correctly" clustered?
sum( real.celltype == c("T","N")[cutree(clust,2)] )

jtextor/MotilityLab documentation built on May 20, 2019, 3:13 a.m.