plotAbundances {CATALYST} | R Documentation

## Population frequencies across samples & clusters

### Description

Plots the relative population abundances of the specified clustering.

### Usage

    plotAbundances(
      x,
      k = "meta20",
      by = c("sample_id", "cluster_id"),
      group_by = "condition",
      shape_by = NULL,
      col_clust = TRUE,
      distance = c("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski"),
      linkage = c("average", "ward.D", "single", "complete", "mcquitty", "median",
        "centroid", "ward.D2"),
      k_pal = CATALYST:::.cluster_cols
    )

### Arguments

`x` | a `SingleCellExperiment`.
`k` | character string specifying which clustering to use; valid values are `names(cluster_codes(x))`.
`by` | a character string specifying whether to plot frequencies by samples or clusters.
`group_by` | character string specifying a non-numeric cell metadata columnd to group by (determines the color coding); valid values are `names(colData(x))` other than "sample_id" and "cluster_id".
`shape_by` | character string specifying a non-numeric cell metadata columnd to shape by; valid values are `names(colData(x))` other than "sample_id" and "cluster_id".
`col_clust` | for `by = "sample_id"`, specifies whether to hierarchically cluster samples and reorder them accordingly. When `col_clust = FALSE`, samples are ordered according to `levels(x$sample_id)` (or alphabetically, when `x$sample_id` is not a factor).
`distance` | character string specifying the distance metric to use for sample clustering; passed to `dist`
`linkage` | character string specifying the agglomeration method to use for sample clustering; passed to `hclust`.
`k_pal` | character string specifying the cluster color palette; ignored when `by = "cluster_id"`. If less than `nlevels(cluster_ids(x, k))` are supplied, colors will be interpolated via `colorRampPalette`.

### Value

a `ggplot` object.

### Author(s)

Helena L Crowell helena.crowell@uzh.ch

### References

Nowicka M, Krieg C, Crowell HL, Weber LM et al. CyTOF workflow: Differential discovery in high-throughput high-dimensional cytometry datasets. F1000Research 2017, 6:748 (doi: 10.12688/f1000research.11622.1)

### Examples

    # construct SCE & run clustering
    data(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- cluster(sce)

    # plot relative population abundances
    # by sample & cluster, respectively
    plotAbundances(sce, k = "meta12")
    plotAbundances(sce, k = "meta8", by = "cluster_id")

    # use custom cluster color palette
    plotAbundances(sce, k = "meta10",
      k_pal = c("lightgrey", "cornflowerblue", "navy"))

[Package CATALYST version 1.16.2 Index]