nanostringPCA {NanoTube} | R Documentation

## Plot PCA

### Description

Conduct principal components analysis and plot the results, using either ggplot2 or plotly.

### Usage

    nanostringPCA(
      ns,
      pc1 = 1,
      pc2 = 2,
      interactive.plot = FALSE,
      exclude.zeros = TRUE
    )

### Arguments

`ns` | Processed NanoString data
`pc1` | Principal component to plot on x-axis (default 1)
`pc2` | Principal component to plot on y-axis (default 2)
`interactive.plot` | Plot using plotly? Default FALSE (in which case ggplot2 is used)
`exclude.zeros` | Exclude genes that are not detected in all samples (default TRUE)

### Value

A list containing:

`pca` | The PCA object
`plt` | The PCA plot

### Examples

    example_data <- system.file("extdata", "GSE117751_RAW", package = "NanoTube")
    sample_data <- system.file("extdata", "GSE117751_sample_data.csv",
                               package = "NanoTube")

    # Process and normalize data first
    dat <- processNanostringData(example_data,
                                 sampleTab = sample_data,
                                 groupCol = "Sample_Diagnosis",
                                 normalization = "nSolver",
                                 bgType = "t.test", bgPVal = 0.01)

    # Interactive PCA using plotly
    nanostringPCA(dat, interactive.plot = TRUE)$plt

    # Static plot using ggplot2, for the 3rd and 4th PC's.
    nanostringPCA(dat, pc1 = 3, pc2 = 4, interactive.plot = FALSE)$plt

[Package NanoTube version 1.0.0 Index]