visualisation-methods-analyses {ASICS} | R Documentation

## Visualisation methods

### Description

Method available to plot results of analyses in ASICS package.

### Usage

    ## S4 method for signature 'AnalysisResults,ANY'
    plot(
      x,
      y,
      ...,
      graph = c("default", "ind", "var", "eig", "boxplot", "buckets"),
      add.label = TRUE,
      n.label.var = 10,
      axes = c(1, 2),
      col.ind = NULL,
      xlim = c(0.5, 10),
      ylim = NULL
    )

### Arguments

`x` | An object of class AnalysisResults.
`y` | Currently not used.
`...` | Currently not used.
`graph` | A vector specifying what to plot. Allowed values are `"eig"` for the screegraph (PCA), `"ind"` for plot of individuals (PCA and OPLS-DA), `"var"` for plot of variables (PCA and OPLS-DA), `"boxplot"` for boxplots of test results and `"buckets"` to show significant or influential buckets on the mean spectrum. Default value is `"default"` (i.e., `c("ind", "var")` for PCA and OPLS-DA and `c("boxplot")` for tests).
`add.label` | If `TRUE`, labels are added on individual plot.
`n.label.var` | An integer indicating the number of label to add on variable plot.
`axes` | A numeric vector of length 2 specifying the dimensions to be plotted for individual and variable plots.
`col.ind` | A character specifying the name of the design variable used to color the observations by groups for PCA individual plot.
`xlim, ylim` | Boundaries for x and y, respectively.

### Value

- PCA: a `ggplot` plot that allows for the visualisation of PCA results (eigen values, individuals and variables)

- OPLS-DA: a `ggplot` plot that allows for the visualisation of OPLS-DA results (individuals and variables). If `cross.val > 1` in `oplsda`, the best model is plotted.

### Examples

    # Import quantification results
    if (require("ASICSdata", quietly = TRUE)) {
      quantif_path <- system.file("extdata", "results_ASICS.txt",
                                  package = "ASICSdata")
      quantification <- read.table(quantif_path, header = TRUE, row.names = 1)

      # Import design
      design <- read.table(system.file("extdata", "design_diabete_example.txt",
                                       package = "ASICSdata"), header = TRUE)
      design$condition <- factor(design$condition)

      # Create object for analysis and remove metabolites with more than 25% of
      # zeros
      analysis_obj <- formatForAnalysis(quantification,
                                        zero.threshold = 25, design = design)

      # Perform a PCA and plot results
      res_pca <- pca(analysis_obj)
      plot(res_pca)

      # Perform an OPLS-DA and plot results
      res_oplsda <- oplsda(analysis_obj, "condition", orthoI = 1)
      plot(res_oplsda)
    }

[Package ASICS version 2.3.1 Index]