cluster: Wrapper to clustering algorithms

Description Usage Arguments Value Author(s) Examples

View source: R/cluster.R

Description

This is a convenient wrapper to Kmeans and Hierarchical clustering when using the 'tms' package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
cluster(
  dat,
  timepoints = NULL,
  K,
  dist.method = c("euclidean", "cor.diss", "dtw"),
  cluster.method = c("kmeans", "hclust"),
  hclust.algorithm = "complete",
  kmeans.algorithm = "Hartigan-Wong",
  kmeans.centers,
  center.dat = TRUE,
  scale.dat = FALSE,
  verbose = FALSE,
  seed = NULL,
  ...
)

Arguments

dat

a (denoised) data matrix with m biomarkers as rows, over n time points (columns).

timepoints

a vector of time points for columns of dat. While this is not necessary, it's here for now to remind the user about the analysis pipeline.

K

a number of clusters.

dist.method

a distance method for time course data, resulting in a m * m distance matrix for rows. 'dtw' for dynamic time wrapping or 'cor.diss' for correlation-based dissimilarities.

cluster.method

a clustering method.

hclust.algorithm

an algorithm used in hierarchical clustering. See hclust for a full list.

kmeans.algorithm

an algorithm used in kmeans clustering. See kmeans for a full list.

center.dat

a logical specifying to center the input and denoised data. By default, TRUE.

scale.dat

a logical specifying to scale the input and denoised data. By default, FALSE.

verbose

a logical specifying to print the computational progress. By default, FALSE.

seed

a seed for the random number generator.

...

optional arguments.

Value

cluster returns a list consisting of

dat.dtw

m * m distance matrix based on dynamic time wrapping.

cluster.obj

an object returned from clustering the predicted data.

membership

a vector of length m, identities of clusters.

Author(s)

Neo Christopher Chung nchchung@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
## load the example "coptm" data
data(cys_optm)
meta <- cys_optm[,1:4]
optm <- log(cys_optm[meta$Select,5:10])
optm <- t(scale(t(optm), scale=TRUE, center=TRUE))
days <- as.numeric(colnames(optm))

## denoise using the cubic splines
denoised_optm <- denoise_spline(optm, timepoints = days, dof="cv", verbose=FALSE)

## cluster the denoised data using K-means clustering
clustered_optm <- cluster(denoised_optm,
                timepoints = days,
                cluster.method = "kmeans",
                K=6,
                center.dat = TRUE,
                scale.dat = FALSE,
                verbose = TRUE)

## End(Not run)

UCLA-BD2K/CV.Signature.TCP documentation built on May 15, 2020, 11:27 p.m.