plot_pca {DEP} | R Documentation

## Plot PCA

### Description

`plot_pca` generates a PCA plot using the top variable proteins.

### Usage

    plot_pca(dep, x = 1, y = 2, indicate = c("condition", "replicate"),
      label = FALSE, n = 500, point_size = 4, label_size = 3,
      plot = TRUE)

### Arguments

`dep` | SummarizedExperiment, Data object for which differentially enriched proteins are annotated (output from `test_diff()` and `add_rejections()`).
`x` | Integer(1), Sets the principle component to plot on the x-axis.
`y` | Integer(1), Sets the principle component to plot on the y-axis.
`indicate` | Character, Sets the color, shape and facet_wrap of the plot based on columns from the experimental design (colData).
`label` | Logical, Whether or not to add sample labels.
`n` | Integer(1), Sets the number of top variable proteins to consider.
`point_size` | Integer(1), Sets the size of the points.
`label_size` | Integer(1), Sets the size of the labels.
`plot` | Logical(1), If `TRUE` (default) the PCA plot is produced. Otherwise (if `FALSE`), the data which the PCA plot is based on are returned.

### Value

A scatter plot (generated by `ggplot`).

### Examples

    # Load example
    data <- UbiLength
    data <- data[data$Reverse != "+" & data$Potential.contaminant != "+",]
    data_unique <- make_unique(data, "Gene.names", "Protein.IDs", delim = ";")

    # Make SummarizedExperiment
    columns <- grep("LFQ.", colnames(data_unique))
    exp_design <- UbiLength_ExpDesign
    se <- make_se(data_unique, columns, exp_design)

    # Filter, normalize and impute missing values
    filt <- filter_missval(se, thr = 0)
    norm <- normalize_vsn(filt)
    imputed <- impute(norm, fun = "MinProb", q = 0.01)

    # Test for differentially expressed proteins
    diff <- test_diff(imputed, "control", "Ctrl")
    dep <- add_rejections(diff, alpha = 0.05, lfc = 1)

    # Plot PCA
    plot_pca(dep)
    plot_pca(dep, indicate = "condition")

[Package DEP version 1.9.0 Index]