plot_pca {AneuFinder} | R Documentation

## Perform a PCA for copy number profiles

### Description

Perform a PCA for copy number profiles in `aneuHMM` objects.

### Usage

    plot_pca(hmms, PC1 = 1, PC2 = 2, colorBy = NULL, plot = TRUE,
      exclude.regions = NULL)

### Arguments

`hmms` | A list of `aneuHMM` objects or a character vector with files that contain such objects.
`PC1` | Integer specifying the first of the principal components to plot.
`PC2` | Integer specifying the second of the principal components to plot.
`colorBy` | A character vector of the same length as `hmms` which is used to color the points in the plot.
`plot` | Set to `FALSE` if you want to return the data.frame that is used for plotting instead of the plot.
`exclude.regions` | A `GRanges-class` with regions that will be excluded from the computation of the PCA. This can be useful to exclude regions with artifacts.

### Value

A `ggplot` object or a data.frame if `plot=FALSE`.

### Examples

    ## Get results from a small-cell-lung-cancer
    lung.folder <- system.file("extdata", "primary-lung", "hmms", package="AneuFinderData")
    lung.files <- list.files(lung.folder, full.names=TRUE)
    ## Get results from the liver metastasis of the same patient
    liver.folder <- system.file("extdata", "metastasis-liver", "hmms", package="AneuFinderData")
    liver.files <- list.files(liver.folder, full.names=TRUE)
    ## Plot the PCA
    classes <- c(rep('lung', length(lung.files)), rep('liver', length(liver.files)))
    labels <- c(paste('lung',1:length(lung.files)), paste('liver',1:length(liver.files)))
    plot_pca(c(lung.files, liver.files), colorBy=classes, PC1=2, PC2=4)

[Package AneuFinder version 1.12.1 Index]