Plot the insert size distribution from one of Fastp reports

plotInsertSize(x, usePlotly = FALSE, labels, pattern = ".(fast|fq|bam).*", ...)

# S4 method for class 'FastpData'
plotInsertSize(
  x,
  usePlotly = FALSE,
  labels,
  pattern = ".(fast|fq|bam).*",
  plotType = c("histogram", "cumulative"),
  counts = FALSE,
  plotTheme = theme_get(),
  expand.x = 0.01,
  expand.y = c(0, 0.05),
  ...
)

# S4 method for class 'FastpDataList'
plotInsertSize(
  x,
  usePlotly = FALSE,
  labels,
  pattern = ".(fast|fq|bam).*",
  plotType = c("heatmap", "line", "cumulative"),
  plotTheme = theme_get(),
  scaleFill = NULL,
  scaleColour = NULL,
  cluster = FALSE,
  dendrogram = FALSE,
  heat_w = 8,
  ...
)

Arguments

x

A FastpData or FastpDataList object

usePlotly

logical. Generate an interactive plot using plotly

labels

An optional named vector of labels for the file names. All file names must be present in the names of the vector.

pattern

Regex to remove from the end of any filenames

...

Passed to geom* functions during plotting

plotType

Determine the plot type. Options vary with the input structure

counts

logical(1) Plot read counts, or percentages (default)

plotTheme

a theme object

expand.x, expand.y

Axis expansions

scaleFill

Continuous scale used to fill heatmap cells. Defaults to the "inferno" palette

scaleColour

Discrete scale for adding line colours

cluster

logical default FALSE. If set to TRUE, data will be clustered using hierarchical clustering

dendrogram

logical redundant if cluster is FALSE if both cluster and dendrogram are specified as TRUE the dendrogram will be displayed.

heat_w

Width of the heatmap relative to other plot components

Value

A ggplot or plotly object

Details

Takes a Fastp os a set of Fastp reports and plot insert size distributions. Plots can be drawn as cumulative totals or the default histograms for a single report, and as boxplots or heatmaps for a set of reports

Examples

# Get the files included with the package
packageDir <- system.file("extdata", package = "ngsReports")
fl <- list.files(packageDir, pattern = "fastp.json.gz", full.names = TRUE)
fp <- FastpData(fl)
plotInsertSize(
  fp, counts = TRUE, fill = "steelblue4",
  plotTheme = theme(plot.title = element_text(hjust = 0.5))
)

plotInsertSize(fp, plotType = "cumulative")