plotFastqcPCA {ngsReports} | R Documentation

## Draw a PCA plot for Fast QC modules

### Description

Draw a PCA plot for Fast QC modules across multiple samples

### Usage

    plotFastqcPCA(
      x,
      module,
      usePlotly = FALSE,
      labels,
      cluster = FALSE,
      clusterType = "colour",
      groups = NULL,
      ...
    )

    ## S4 method for signature 'ANY'
    plotFastqcPCA(
      x,
      module,
      usePlotly = FALSE,
      labels,
      cluster = FALSE,
      clusterType = "colour",
      groups = NULL,
      ...
    )

    ## S4 method for signature 'character'
    plotFastqcPCA(
      x,
      module,
      usePlotly = FALSE,
      labels,
      cluster = FALSE,
      clusterType = "colour",
      groups = NULL,
      ...
    )

    ## S4 method for signature 'FastqcDataList'
    plotFastqcPCA(
      x,
      module,
      usePlotly = FALSE,
      labels,
      cluster = FALSE,
      clusterType = "colour",
      groups = NULL,
      ...
    )

### Arguments

`x` | Can be a `FastqcData`, `FastqcDataList` or file paths
`module` | `character` vector containing the desired FastQC module (eg. c("Per_base_sequence_quality", "Per_base_sequence_content"))
`usePlotly` | `logical`. Output as ggplot2 (default) or plotly object.
`labels` | An optional named vector of labels for the file names. All filenames must be present in the names. File extensions are dropped by default
`cluster` | `logical` default `FALSE`. If `groups` argument is not set fastqc data will be clustered using hierarchical clustering.
`clusterType` | One of "color/colour" or "hulls". Default is "colours" and will colour points based on cluster/group, "hulls" will draw a polygon around each cluster.
`groups` | Optional data.frame (or tibble) with columns `Filename` and `Group`. Values in the Filename column should correspond to the values returned by fqName(x). If not supplied and `cluster = TRUE`, clusters will be automatically generated using HCPC from FactoMiner
`...` | Used to pass additional attributes to theme() and between methods

### Details

This carries out PCA on all or a subset of FastQC modules and plots the output using either ggplot or plotly. Clustering of the PCA can be carried out using a hierarchical clustering approach. Current modules for PCA are Per_base_sequence_quality, Per_sequence_quality_scores, Per_sequence_GC_content, Per_base_sequence_content, and Sequence_Length_Distribution.

### Value

A standard ggplot2 object, or an interactive plotly object

### Examples

    # Get the files included with the package
    packageDir <- system.file("extdata", package = "ngsReports")
    fl <- list.files(packageDir, pattern = "fastqc.zip", full.names = TRUE)

    # Load the FASTQC data as a FastqcDataList object
    fdl <- FastqcDataList(fl)
    plotFastqcPCA(fdl, module = "Per_sequence_quality_scores", cluster = TRUE)

[Package ngsReports version 1.3.2 Index]