plotTranscripts-methods {SplicingGraphs} | R Documentation

## Plot a set of transcripts along genomic coordinates.

### Description

`plotTranscripts` uses the Gviz package to plot the exon structure of a set of transcripts along genomic coordinates.

### Usage

    plotTranscripts(x, reads=NULL, from=NA, to=NA, max.plot.reads=200)

### Arguments

`x` | A GRangesList object containing the genomic ranges of a set of exons grouped by transcript. Alternatively, `x` can be a TxDb object, or a SplicingGraphs object of length 1.
`reads` | A GAlignments or GAlignmentPairs object containing single-end or paired-end reads.
`from, to` | Single numeric values, giving the range of genomic coordinates to plot the tracks in. By default (i.e. `from=NA` and `to=NA`), the plot covers the range spanned by the transcripts. If `from=NULL` and `to=NULL`, then the plot covers the range spanned by the transcripts and the reads.
`max.plot.reads` | The maximum number of reads that will be plotted. When the number of reads that fall in the region being plotted is very large, plotting them all would take a long time and result in a plot that is not very useful. If that number is greater than `max.plot.reads`, then only `max.plot.reads` randomly chosen reads are plotted.

### Author(s)

H. Pagès

### See Also

This man page is part of the SplicingGraphs package. Please see `?`SplicingGraphs-package`` for an overview of the package and for an index of its man pages.

Other topics related to this man page and documented in other packages:

- `plotTranscripts` is based on the `plotTracks` function defined in the Gviz package.

- The GRangesList class defined in the GenomicRanges package.

- The GAlignments and GAlignmentPairs classes defined in the GenomicAlignments package.

- The TxDb class defined in the GenomicFeatures package.

### Examples

    ## ---------------------------------------------------------------------
    ## A. PLOT TRANSCRIPTS
    ## ---------------------------------------------------------------------
    example(SplicingGraphs)  # create SplicingGraphs object 'sg'
    sg

    ## 'sg' has 1 element per gene and 'names(sg)' gives the gene ids.
    names(sg)

    ## The transcripts of a given gene can be extracted with [[. The result
    ## is an *unnamed* GRangesList object containing the exons grouped by
    ## transcript:
    sg[["geneD"]]
    plotTranscripts(sg[["geneD"]])  # requires the Gviz package

    ## The transcripts of all the genes can be extracted with unlist(). The
    ## result is a *named* GRangesList object containing the exons grouped
    ## by transcript. The names on the object are the gene ids:
    ex_by_tx <- unlist(sg)
    ex_by_tx
    plotTranscripts(ex_by_tx)

    ## ---------------------------------------------------------------------
    ## B. PLOT TRANSCRIPTS AND READS
    ## ---------------------------------------------------------------------
    gal <- readGAlignments(toy_reads_bam(), use.names=TRUE)
    plotTranscripts(sg[["geneA"]], reads=gal)
    plotTranscripts(ex_by_tx, reads=gal)
    plotTranscripts(ex_by_tx, reads=gal, from=1, to=320)
    plotTranscripts(ex_by_tx, reads=gal[21:26], from=1, to=320)

[Package SplicingGraphs version 1.26.1 Index]