plotFeatureBoxplot {clusterExperiment} | R Documentation

## Plot boxplot of feature values by cluster

### Description

Plot a boxplot of the (transformed) values for a particular gene, separated by cluster

### Usage

    ## S4 method for signature 'ClusterExperiment,character'
    plotFeatureBoxplot(object, feature, whichCluster = "primary", ...)

    ## S4 method for signature 'ClusterExperiment,numeric'
    plotFeatureBoxplot(
      object,
      feature,
      whichCluster = "primary",
      plotUnassigned = FALSE,
      unassignedColor = NULL,
      missingColor = NULL,
      main = NULL,
      whichAssay = 1,
      ...
    )

### Arguments

`object` | a ClusterExperiment object
`feature` | identification of feature to plot, either row name or index
`whichCluster` | argument that can be a single numeric or character value indicating the single clustering to be used. Giving values that result in more than one clustering will result in an error. See details of `getClusterIndex`.
`...` | arguments passed to `boxplot`
`plotUnassigned` | whether to plot the unassigned samples as a cluster (either -1 or -2)
`unassignedColor` | If not NULL, should be character value giving the color for unassigned (-2) samples (overrides `clusterLegend`) default.
`missingColor` | If not NULL, should be character value giving the color for missing (-2) samples (overrides `clusterLegend`) default.
`main` | title of plot. If NULL, given default title.
`whichAssay` | numeric or character specifying which assay to use. See `assay` for details.

### Value

A plot is created. The output of boxplot is returned (see `boxplot`), with additional elements `colors` and `clusterIds` that gives the colors and internal ids that match each boxplot (pulled from `clusterLegend` but in the order of plot)

### See Also

`boxplot`

### Examples

    data(simData)
    #Create a ClusterExperiment object
    cl <- clusterMany(simData, nReducedDims=c(5, 10, 50), reducedDim="PCA",
       clusterFunction="pam", ks=2:4, findBestK=c(TRUE,FALSE),
       removeSil=c(TRUE,FALSE), makeMissingDiss=TRUE)
    #give names to the clusters
    cl<-renameClusters(cl, whichCluster=1,
       value=letters[1:nClusters(cl)[1]])
    plotFeatureBoxplot(cl,feature=1)

[Package clusterExperiment version 2.10.1 Index]