addCluster: Clustering wrapper

addClusterR Documentation

Clustering wrapper

Description

This function returns a SummarizedExperiment with clustering information in its colData or rowData

Usage

addCluster(
  x,
  BLUSPARAM,
  assay.type = assay_name,
  assay_name = "counts",
  MARGIN = "features",
  full = FALSE,
  name = "clusters",
  clust.col = "clusters",
  ...
)

## S4 method for signature 'SummarizedExperiment'
addCluster(
  x,
  BLUSPARAM,
  assay.type = assay_name,
  assay_name = "counts",
  MARGIN = "features",
  full = FALSE,
  name = "clusters",
  clust.col = "clusters",
  ...
)

Arguments

x

A SummarizedExperiment object.

BLUSPARAM

A BlusterParam object specifying the algorithm to use.

assay.type

a single character value for specifying which assay to use for calculation.

assay_name

a single character value for specifying which assay to use for calculation. (Please use assay.type instead. At some point assay_name will be disabled.)

MARGIN

A single character value for specifying whether the transformation is applied sample (column) or feature (row) wise. (By default: MARGIN = "samples")

full

Logical scalar indicating whether the full clustering statistics should be returned for each method.

name

the name to store the result in metadata

clust.col

A single character value indicating the name of the rowData (or colData) where the data will be stored.

...

Additional parameters to use altExps for example

Details

This is a wrapper for the clusterRows function from the bluster package.

When setting full = TRUE, the clustering information will be stored in the metadata of the object.

By default, clustering is done on the features.

Value

addCluster returns an object of the same type as the x parameter with clustering information named clusters stored in colData or rowData.

Author(s)

Basil Courbayre

Examples

library(bluster)
data(GlobalPatterns, package = "mia")
tse <- GlobalPatterns

# Cluster on rows using Kmeans
tse <- addCluster(tse, KmeansParam(centers = 3))

# Clustering done on the samples using Hclust
tse <- addCluster(tse, 
               MARGIN = "samples", 
               HclustParam(metric = "bray", dist.fun = vegan::vegdist))

# Getting the clusters
colData(tse)$clusters


microbiome/mia documentation built on April 27, 2024, 4:04 a.m.