plotReadTotals {ngsReports} | R Documentation

## Draw a barplot of read totals

### Description

Draw a barplot of read totals

### Usage

    plotReadTotals(
      x,
      usePlotly = FALSE,
      labels,
      duplicated = TRUE,
      bars = c("stacked", "adjacent"),
      barCols = c("red", "blue"),
      expand.x = expansion(mult = c(0, 0.02)),
      ...
    )

    ## S4 method for signature 'ANY'
    plotReadTotals(
      x,
      usePlotly = FALSE,
      labels,
      duplicated = TRUE,
      bars = c("stacked", "adjacent"),
      barCols = c("red", "blue"),
      expand.x = expansion(mult = c(0, 0.02)),
      ...
    )

    ## S4 method for signature 'character'
    plotReadTotals(
      x,
      usePlotly = FALSE,
      labels,
      duplicated = TRUE,
      bars = c("stacked", "adjacent"),
      barCols = c("red", "blue"),
      expand.x = expansion(mult = c(0, 0.02)),
      ...
    )

    ## S4 method for signature 'FastqcDataList'
    plotReadTotals(
      x,
      usePlotly = FALSE,
      labels,
      duplicated = TRUE,
      bars = c("stacked", "adjacent"),
      barCols = c("red", "blue"),
      expand.x = expansion(mult = c(0, 0.02)),
      ...
    )

### Arguments

`x` | Can be a `FastqcData`, `FastqcDataList` or file paths
`usePlotly` | `logical` Default `FALSE` will render using ggplot. If `TRUE` plot will be rendered with plotly
`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.
`duplicated` | `logical`. Include deduplicated read total estimates to plot charts
`bars` | If `duplicated = TRUE`, show unique and deduplicated reads as "stacked" or "adjacent".
`barCols` | Colours for duplicated and unique reads.
`expand.x` | Output from `expansion()` controlling x-axis expansion. Alternatively can be a numeric vector of length 4
`...` | Used to pass additional attributes to theme()

### Details

Draw a barplot of read totals using the standard ggplot2 syntax. The raw data from `readTotals()` can otherwise be used to manually create a plot.

Duplication levels are based on the value shown on FASTQC reports at the top of the DeDuplicatedTotals plot, which is known to be inaccurate. As it still gives a good guide as to sequence diversity it is included as the default. This can be turned off by setting `duplicated = FALSE`.

### Value

Returns a ggplot or 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)

    # Plot the Read Totals showing estimated duplicates
    plotReadTotals(fdl)

    # Plot the Read Totals without estimated duplicates
    plotReadTotals(fdl, duplicated = FALSE)

[Package ngsReports version 1.8.1 Index]