plot_PCA {proBatch} | R Documentation

## plot PCA plot

### Description

plot PCA plot

### Usage

    plot_PCA(
      data_matrix,
      sample_annotation,
      feature_id_col = "peptide_group_label",
      sample_id_col = "FullRunName",
      color_by = "MS_batch",
      PC_to_plot = c(1, 2),
      fill_the_missing = -1,
      color_scheme = "brewer",
      filename = NULL,
      width = NA,
      height = NA,
      units = c("cm", "in", "mm"),
      plot_title = NULL,
      theme = "classic"
    )

### Arguments

`data_matrix` | features (in rows) vs samples (in columns) matrix, with feature IDs in rownames and file/sample names as colnames. See "example_proteome_matrix" for more details (to call the description, use `help("example_proteome_matrix")`)
`sample_annotation` | data frame with: `sample_id_col` (this can be repeated as row names) biological covariates technical covariates (batches etc) . See `help("example_sample_annotation")`
`feature_id_col` | name of the column with feature/gene/peptide/protein ID used in the long format representation `df_long`. In the wide formatted representation `data_matrix` this corresponds to the row names.
`sample_id_col` | name of the column in `sample_annotation` table, where the filenames (colnames of the `data_matrix` are found).
`color_by` | column name (as in `sample_annotation`) to color by
`PC_to_plot` | principal component numbers for x and y axis
`fill_the_missing` | numeric value determining how missing values should be substituted. If `NULL`, features with missing values are excluded. If `NULL`, features with missing values are excluded.
`color_scheme` | a named vector of colors to map to `batch_col`, names corresponding to the levels of the factor. For continuous variables, vector doesn't need to be named.
`filename` | path where the results are saved. If null the object is returned to the active window; otherwise, the object is save into the file. Currently only pdf and png format is supported
`width` | option determining the output image width
`height` | option determining the output image width
`units` | units: 'cm', 'in' or 'mm'
`plot_title` | title of the plot (e.g., processing step + representation level (fragments, transitions, proteins) + purpose (meanplot/corrplot etc))
`theme` | ggplot theme, by default `classic`. Can be easily overriden

### Value

ggplot scatterplot colored by factor levels of column specified in `factor_to_color`

### See Also

`autoplot.pca_common`, `ggplot`

### Examples

    pca_plot <- plot_PCA(example_proteome_matrix, example_sample_annotation,
    color_by = 'MS_batch', plot_title = "PCA colored by MS batch")
    pca_plot <- plot_PCA(example_proteome_matrix, example_sample_annotation,
    color_by = 'DateTime', plot_title = "PCA colored by DateTime")

    color_list <- sample_annotation_to_colors (example_sample_annotation,
    factor_columns = c('MS_batch', 'digestion_batch'),
    numeric_columns = c('DateTime','order'))
    pca_plot <- plot_PCA(example_proteome_matrix, example_sample_annotation,
    color_by = 'DateTime', color_scheme = color_list[['DateTime']])

    ## Not run:
    pca_plot <- plot_PCA(example_proteome_matrix, example_sample_annotation,
    color_by = 'DateTime', plot_title = "PCA colored by DateTime",
    filename = 'test_PCA.png', width = 14, height = 9, units = 'cm')

    ## End(Not run)

[Package proBatch version 1.4.0 Index]