rnb.plot.dreduction {RnBeads} | R Documentation

## rnb.plot.dreduction

### Description

Creates a dimension reduction plot based on the methylation values of the given dataset.

### Usage

    rnb.plot.dreduction(
      rnb.set,
      plot.type = "pca",
      dimensions = 1:2,
      distance.metric = "euclidean",
      target = "sites",
      point.types = 0L,
      point.colors = 0L,
      legend.space = 2
    )

### Arguments

`rnb.set` | Methylation dataset as an object of type inheriting `RnBSet`. This dataset must contain at least four samples.
`plot.type` | Type of plot to be created. This must be one of `"pca"` (projection to two principal components), `"mds"` (multidimensional scaling to two dimensions) or `"tsne"` (t-distributed stochastic neighbor embedding to two dimensions). The section Details provides more details on how the dimension reduction techniques are applied.
`dimensions` | Vector of two positive `integer` values giving the principle components to be shown in the horizontal and vertical axis of the plot. This parameter is considered only when `plot.type` is `"pca"`.
`distance.metric` | Distance metric to be applied when reducing the dimensionality of the methylation data. This must be one of `"eucledian"` or `"manhattan"`. The second metric is not supported by principal component analysis.
`target` | Site or region type to be used in the dimension reduction technique. This must be either `"sites"` (individual CpGs) or one of the region types summarized in `rnb.set`.
`point.types` | Trait, specified as column name or index in the sample annnotation table of `rnb.set`, to be used to define point types in the plot. Setting this parameter to zero (default) or to a trait that does not define categories results in all samples being displayed as filled circles. If this parameter specifies a column that can be used as sample identifiers, the plot displays the samples as identifiers instead of points.
`point.colors` | Trait, specified as column name or index in the sample annnotation table of `rnb.set`, to be used to define sample colors in the plot. Setting this parameter to zero (default) or to a trait that does not define numerical values or categories results in all samples being displayed in black.
`legend.space` | Width, in inches, of the space dedicated for legends that will be assigned on the right side of the plot. This parameter is considered only if legends are actually included, that is, if sample traits are mapped to point types and/or colors.

### Details

The analysis option `"exploratory.top.dimensions"` controls whether dimension reduction is applied on all probes, sites or regions available in the given dataset, or only on the most variable ones. In case a trait is mapped to point types, the shapes to use are taken from the option `"points.category"`. Similary, the option `"colors.category"` determines which colors are used when mapping sample categories to color. In cases when numerical values are mapped to color, the option `"colors.3.gradient"` is used. If the set of value contains both positive and negative numbers, the middle point in the color legend is set to zero. See RnBeads Options for more information on the options mentioned above.

### Value

The generated plot as an object of type `ggplot`. The object also contains an attribute `"info"`, which is a list with the following elements:

`"Target"`

  Targeted sites or regions; the value of the parameter `target`.

`"Technique"`

  Dimension reduction technique applied; one of `"PCA"` or `"MDS"`.

`"All"`

  Total number of sites or regions defining the high dimensional methylation space.

`"Missing"`

  Number of dimensions ignored because they contain (only) missing values.

`"Selected"`

  Number of dimensions used when applying a dimension reduction technique.

`"Explained"`

  Value between `0` and `1` showing the variance explained by the selected dimensions, as a fraction of the total variance of all dimensions.

### Author(s)

Yassen Assenov

### See Also

`summarized.regions` for listing all region types summarized in a dataset

### Examples

    library(RnBeads.hg19)
    data(small.example.object)
    pdf("PCA.pdf", width = 7.2, height = 5.2)
    print(rnb.plot.dreduction(rnb.set.example, point.colors="Sample_Group"))
    dev.off()

[Package RnBeads version 2.10.0 Index]