plotFunctions {FRASER} | R Documentation

## Visualization functions for FRASER

### Description

The FRASER package provides mutliple functions to visualize the data and the results of a full data set analysis.

Plots the p values over the delta psi values, known as volcano plot. Visualizes per sample the outliers. By type and aggregate by gene if requested.

Plot the number of aberrant events per samples

Plots the observed split reads of the junction of interest over all reads coming from the given donor/acceptor.

Plots the expected psi value over the observed psi value of the given junction.

Plots the quantile-quantile plot

Histogram of the geometric mean per junction based on the filter status

Histogram of minimal delta psi per junction

Count correlation heatmap function

### Usage

    plotVolcano(
      fds,
      sampleID,
      type = c("psi3", "psi5", "psiSite"),
      basePlot = TRUE,
      aggregate = FALSE,
      main = NULL,
      label = NULL,
      deltaPsiCutoff = 0.3,
      padjCutoff = 0.1,
      ...
    )

    plotAberrantPerSample(
      fds,
      main,
      type = c("psi3", "psi5", "psiSite"),
      padjCutoff = 0.1,
      zScoreCutoff = NA,
      deltaPsiCutoff = 0.3,
      aggregated = TRUE,
      BPPARAM = bpparam(),
      ...
    )

    plotExpression(
      fds,
      type = c("psi5", "psi3", "psiSite"),
      site = NULL,
      result = NULL,
      colGroup = NULL,
      basePlot = TRUE,
      main = NULL,
      label = "aberrant",
      ...
    )

    plotExpectedVsObservedPsi(
      fds,
      type = c("psi5", "psi3", "psiSite"),
      idx = NULL,
      result = NULL,
      colGroup = NULL,
      main = NULL,
      basePlot = TRUE,
      label = "aberrant",
      ...
    )

    plotQQ(
      fds,
      type = NULL,
      idx = NULL,
      result = NULL,
      aggregate = FALSE,
      global = FALSE,
      main = NULL,
      conf.alpha = 0.05,
      samplingPrecision = 3,
      basePlot = TRUE,
      label = "aberrant",
      Ncpus = min(3, getDTthreads()),
      ...
    )

    plotEncDimSearch(
      fds,
      type = c("psi3", "psi5", "psiSite"),
      plotType = c("auc", "loss")
    )

    plotFilterExpression(
      fds,
      bins = 200,
      legend.position = c(0.8, 0.8),
      onlyVariableIntrons = FALSE
    )

    plotFilterVariability(
      fds,
      bins = 200,
      legend.position = c(0.8, 0.8),
      onlyExpressedIntrons = FALSE
    )

    plotCountCorHeatmap(
      fds,
      type = c("psi5", "psi3", "psiSite"),
      logit = FALSE,
      topN = 50000,
      topJ = 5000,
      minMedian = 1,
      main = NULL,
      normalized = FALSE,
      show_rownames = FALSE,
      show_colnames = FALSE,
      minDeltaPsi = 0.1,
      annotation_col = NA,
      annotation_row = NA,
      border_color = NA,
      nClust = 5,
      plotType = c("sampleCorrelation", "junctionSample"),
      sampleClustering = NULL,
      plotMeanPsi = TRUE,
      plotCov = TRUE,
      ...
    )

### Arguments

`fds` | An FraserDataSet object.
`sampleID` | A sample ID which should be plotted. Can also be a vector. Integers are treated as indices.
`type` | The psi type: either psi5, psi3 or psiSite (for SE).
`basePlot` | if `TRUE` (default), use the R base plot version, else use the plotly framework.
`aggregate, aggregated` | If TRUE, the pvalues are aggregated by gene, otherwise junction level pvalues are used (default).
`main` | Title for the plot, if missing a default title will be used.
`label` | Indicates the genes or samples that will be labelled in the plot (only for `basePlot=TRUE`). Setting `label="aberrant"` will label all aberrant genes or samples. Labelling can be turned off by setting `label=NULL`. The user can also provide a custom list of gene symbols or sampleIDs.
`padjCutoff, zScoreCutoff, deltaPsiCutoff` | Significance, Z-score or delta psi cutoff to mark outliers
`...` | Additional parameters passed to plot() or plot_ly() if not stated otherwise in the details for each plot function
`BPPARAM` | BiocParallel parameter to use.
`result` | The result table to be used by the method.
`colGroup` | Group of samples that should be colored.
`idx, site` | A junction site ID or gene ID or one of both, which should be plotted. Can also be a vector. Integers are treated as indices.
`global` | Flag to plot a global Q-Q plot, default FALSE
`conf.alpha` | If set, a confidence interval is plotted, defaults to 0.05
`samplingPrecision` | Plot only non overlapping points in Q-Q plot to reduce number of points to plot. Defines the digits to round to.
`Ncpus` | Number of cores to use.
`plotType` | Character string indicating the type of correlation heatmap that should be plotted. Can be either 'sampleCorrelation' for a sample-sample correlation heatmap or 'junctionSample' for a junction-sample correlation heatmap.
`bins` | Set the number of bins to be used in the histogram.
`legend.position` | Set legend position (x and y coordinate), defaults to the top right corner.
`onlyVariableIntrons` | Logical value indicating whether to show only introns that also pass the variability filter. Defaults to FALSE.
`onlyExpressedIntrons` | Logical value indicating whether to show only introns that also pass the expression filter. Defaults to FALSE.
`logit` | If TRUE, the default, psi values are plotted in logit space.
`topN, topJ` | Top x most variable junctions that should be used in the heatmap. TopN is used for sample-sample correlation heatmaps and topJ for junction-sample correlation heatmaps.
`minMedian, minDeltaPsi` | Minimal median value or minimal delta psi of a junction to be considered for the correlation heatmap.
`normalized` | If TRUE, the normalized psi values are used, the default, otherwise the raw psi values
`show_rownames, show_colnames` | Logical value indicating whether to show row or column names on the heatmap axes.
`annotation_col, annotation_row` | Row or column annotations that should be plotted on the heatmap.
`border_color` | Sets the border color of the heatmap
`nClust` | Number of clusters to show in the row and column dendrograms.
`sampleClustering` | A clustering of the samples that should be used as an annotation of the heatmap.
`plotMeanPsi, plotCov` | If `TRUE`, then the heatmap is annotated with the mean psi values or the junction coverage.

### Details

This is the list of all plotting function provided by FRASER:

- plotAberrantPerSample()

- plotVolcano()

- plotExpression()

- plotQQ()

- plotExpectedVsObservedPsi()

- plotCountCorHeatmap()

- plotFilterExpression()

- plotFilterVariability()

- plotEncDimSearch()

For a detailed description of each plot function please see the details. Most of the functions share the same parameters.

`plotAberrantPerSample`: The number of aberrant events per sample are plotted sorted by rank. The ... parameters are passed on to the `aberrant` function.

`plotVolcano`: the volcano plot is sample-centric. It plots for a given sample and psi type the negative log10 nominal P-values against the delta psi values for all splice sites or aggregates by gene if requested.

`plotExpression`: This function plots for a given site the read count at this site (i.e. K) against the total coverage (i.e. N) for the given psi type (psi5, psi3 or SE (psiSite)) for all samples.

`plotQQ`: the quantile-quantile plot for a given gene or if `global` is set to `TRUE` over the full data set. Here the observed P-values are plotted against the expected ones in the negative log10 space.

`plotExpectedVsObservedPsi`: A scatter plot of the observed psi against the predicted psi for a given site.

`plotCountCorHeatmap`: The correlation heatmap of the count data either of the full data set (i.e. sample-sample correlations) or of the top x most variable junctions (i.e. junction-sample correlations). By default the values are log transformed and row centered. The ... arguments are passed to the `pheatmap` function.

`plotFilterExpression`: The distribution of FPKM values. If the FraserDataSet object contains the `passedFilter` column, it will plot both FPKM distributions for the expressed introns and for the filtered introns.

`plotFilterVariability`: The distribution of maximal delta Psi values. If the FraserDataSet object contains the `passedFilter` column, it will plot both maximal delta Psi distributions for the variable introns and for the filtered (i.e. non-variable) introns.

`plotEncDimSearch`: Visualization of the hyperparameter optimization. It plots the encoding dimension against the achieved loss (area under the precision-recall curve). From this plot the optimum should be choosen for the `q` in fitting process.

### Value

If base R graphics are used nothing is returned else the plotly or the gplot object is returned.

### Examples

    fds <- createTestFraserDataSet()

    plotEncDimSearch(fds, type="psi5")
    plotAberrantPerSample(fds, padjCutoff=NA, zScoreCutoff=0.5)
    plotVolcano(fds, "sample1", "psi5")

    # for this example a padj cutoff of 1 is used to get results for the small
    # example dataset and be able to show the usage of the plot functions
    res <- results(fds, padjCutoff=1, zScoreCutoff=NA, deltaPsiCutoff=NA)
    res
    plotExpression(fds, result=res[2], type="psi5")
    plotQQ(fds, result=res[1])
    plotExpectedVsObservedPsi(fds, type="psi5", idx=5)

    plotCountCorHeatmap(fds, "psiSite")

[Package FRASER version 1.0.2 Index]