plotFusion {chimeraviz} | R Documentation

## Plot a fusion event with transcripts, coverage and ideograms.

### Description

This function creates a plot with information about transcripts, coverage, location and more.

### Usage

    plotFusion(fusion, edb = NULL, bamfile = NULL,
      whichTranscripts = "exonBoundary", ylim = c(0, 1000), nonUCSC = TRUE,
      reduceTranscripts = FALSE, bedgraphfile = NULL)

    plotFusionSeparate(fusion, edb, bamfile = NULL,
      whichTranscripts = "exonBoundary", ylim = c(0, 1000), nonUCSC = TRUE,
      reduceTranscripts = FALSE, bedgraphfile = NULL)

    plotFusionTogether(fusion, edb, bamfile = NULL,
      whichTranscripts = "exonBoundary", ylim = c(0, 1000), nonUCSC = TRUE,
      reduceTranscripts = FALSE, bedgraphfile = NULL)

### Arguments

`fusion` | The Fusion object to plot.
`edb` | The ensembldb object that will be used to fetch data.
`bamfile` | The bamfile with RNA-seq data.
`whichTranscripts` | This character vector decides which transcripts are to be plotted. Can be "exonBoundary", "withinExon", "withinIntron", "intergenic", or a character vector with specific transcript ids. Default value is "exonBoundary".
`ylim` | Limits for the coverage y-axis.
`nonUCSC` | Boolean indicating whether or not the bamfile used has UCSC- styled chromosome names (i.e. with the "chr" prefix). Setting this to true lets you use a bamfile with chromosome names like "1" and "X", instead of "chr1" and "chrX".
`reduceTranscripts` | Boolean indicating whether or not to reduce all transcripts into a single transcript for each partner gene.
`bedgraphfile` | A bedGraph file to use instead of the bamfile to plot coverage.

### Details

plotFusion() will dispatch to either plotFusionSeparate() or plotFusionTogether(). plotFusionSeparate() will plot the fusion gene partners in separate graphs shown next to each other, while plotFusionTogether() will plot the fusion gene partners in the same graph with the same x-axis. plotFusion() will dispatch to plotFusionTogether() if the fusion gene partners are on the same strand, same chromosome and are close together (<=50,000 bp apart).

### Value

Creates a fusion plot.

### Examples

    # Load data and example fusion event
    defuse833ke <- system.file(
      "extdata",
      "defuse_833ke_results.filtered.tsv",
      package="chimeraviz")
    fusions <- importDefuse(defuse833ke, "hg19", 1)
    fusion <- getFusionById(fusions, 5267)
    # Load edb
    edbSqliteFile <- system.file(
      "extdata",
      "Homo_sapiens.GRCh37.74.sqlite",
      package="chimeraviz")
    edb <- ensembldb::EnsDb(edbSqliteFile)
    # bamfile with reads in the regions of this fusion event
    bamfile5267 <- system.file(
      "extdata",
      "fusion5267and11759reads.bam",
      package="chimeraviz")
    # Temporary file to store the plot
    pngFilename <- tempfile(
      pattern = "fusionPlot",
      fileext = ".png",
      tmpdir = tempdir())
    # Open device
    png(pngFilename, width = 1000, height = 750)
    # Plot!
    plotFusion(
      fusion = fusion,
      bamfile = bamfile5267,
      edb = edb,
      nonUCSC = TRUE)
    # Close device
    dev.off()

    # Example using a .bedGraph file instead of a .bam file:
    # Load data and example fusion event
    defuse833ke <- system.file(
      "extdata",
      "defuse_833ke_results.filtered.tsv",
      package="chimeraviz")
    fusions <- importDefuse(defuse833ke, "hg19", 1)
    fusion <- getFusionById(fusions, 5267)
    # Load edb
    edbSqliteFile <- system.file(
      "extdata",
      "Homo_sapiens.GRCh37.74.sqlite",
      package="chimeraviz")
    edb <- ensembldb::EnsDb(edbSqliteFile)
    # bedgraphfile with coverage data from the regions of this fusion event
    bedgraphfile <- system.file(
      "extdata",
      "fusion5267and11759reads.bedGraph",
      package="chimeraviz")
    # Temporary file to store the plot
    pngFilename <- tempfile(
      pattern = "fusionPlot",
      fileext = ".png",
      tmpdir = tempdir())
    # Open device
    png(pngFilename, width = 1000, height = 750)
    # Plot!
    plotFusion(
      fusion = fusion,
      bedgraphfile = bedgraphfile,
      edb = edb,
      nonUCSC = TRUE)
    # Close device
    dev.off()

[Package chimeraviz version 1.4.3 Index]