plotPbExprs {CATALYST} | R Documentation

## Pseudobulk-level boxplot

### Description

Boxplot of aggregated marker data by sample or cluster, optionally colored and faceted by non-numeric cell metadata variables of interest.

### Usage

    plotPbExprs(
      x,
      k = "meta20",
      features = "state",
      assay = "exprs",
      fun = c("median", "mean", "sum"),
      facet_by = c("antigen", "cluster_id"),
      color_by = "condition",
      group_by = color_by,
      shape_by = NULL,
      size_by = FALSE,
      geom = c("both", "points", "boxes"),
      jitter = TRUE,
      ncol = NULL
    )

    plotMedExprs(
      x,
      k = "meta20",
      features = "state",
      facet_by = c("antigen", "cluster_id"),
      group_by = "condition",
      shape_by = NULL
    )

### Arguments

`x` | a `SingleCellExperiment{SingleCellExperiment}`.
`k` | character string specifying which clustering to use; values values are `names(cluster_codes(x))`. Ignored if `facet_by = "antigen"`.
`features` | character vector specifying which features to include; valid values are `"type"/"state"` for `type/state_markers(x)` if `rowData(x)$marker_class` have been specified; a subset of `rownames(x)`; NULL to use all features.
`assay` | character string specifying which assay data to use; valid values are `assayNames(x)`.
`fun` | character string specifying the summary statistic to use.
`facet_by` | `"antigen"` or `"cluster_id"`; the latter requires having run `cluster`.
`color_by, group_by, shape_by` | character string specifying a non-numeric cell metadata variable to color, group and shape by, respectively; valid values are `names(colData(x))` and `names(cluster_codes(x))` if `cluster` has been run.
`size_by` | logical specifying whether to scale point sizes by the number of cells in a given sample or cluster-sample instance; ignored when `geom = "boxes"`.
`geom` | character string specifying whether to include only points, boxplots or both.
`jitter` | logical specifying whether to use `position_jitterdodge` in `geom_point` when `geom != "boxes"`.
`ncol` | integer scalar specifying number of facet columns.

### 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
    data(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- prepData(PBMC_fs, PBMC_panel, PBMC_md)
    sce <- cluster(sce, verbose = FALSE)

    # plot median expressions by sample & condition
    # ...split by marker
    plotPbExprs(sce,
      shape_by = "patient_id",
      features = sample(rownames(sce), 6))

    # ...split by cluster
    plotPbExprs(sce, facet_by = "cluster_id", k = "meta6")

    # plot median type-marker expressions by sample & cluster
    plotPbExprs(sce, feature = "type", k = "meta6",
      facet_by = "antigen", group_by = "cluster_id", color_by = "sample_id",
      size_by = TRUE, geom = "points", jitter = FALSE, ncol = 5)

    # plot median state-marker expressions
    # by sample & cluster, split by condition
    plotPbExprs(sce, k = "meta6", facet_by = "antigen",
      group_by = "cluster_id", color_by = "condition", ncol = 7)

[Package CATALYST version 1.16.2 Index]