metagenePlot: Metagene plot

View source: R/vis.R

metagenePlotR Documentation

Metagene plot

Description

Plot metagene signal per position. The metagene must be output from calcMetagene function.

Usage

metagenePlot(
  metagene,
  color = ifelse(metagene$mode == 1, list("steelblue"), list(c("red1",
    "steelblue")))[[1]],
  metageneFun = c("mean", "median")
)

Arguments

metagene

A list containing three elements. The first element is metagne, either one matrix if regionGR is set or a list of two matrices in CDS start and end regions (with names of start and end). Each row is a transcript, each column is a position, and a value represents read counts or relative frequency for a transcript at a position. The second element is the GRanges for the metagene, either one range if regionGR is set or a list of two ranges representing the CDS start and end regions. This list also contains information of the transcripts selected and flanking sequence lengths for CDS start and end. The third element is an internal variable indicating if regionGR is specified or not (1 means regionGR is set and 2 means not set). Check calcMetagene function to see more details of metagene calculation and output object. The metagene must be output from calcMetagene function. (Required).

color

A character variable if metagene$mode == 1, or a character vector specifying the colors for CDS start and end regions if metagene$mode == 2. (Default: ifelse(metagene$mode == 1, 'steelblue', c('red1', 'steelblue'))).

metageneFun

A character variable indicating how metagene should be summarized. Must be selected from c('mean', 'median'). If 'mean', column means will be taken. If 'median', column medians will be taken. (Default: 'mean').

Value

A ggplot object showing the metagene signal per position. If metagene$mode == 1, the x-axis is labeled as 1, 2, ..., N where N is the width of the metagene region. If metagene$mode == 2, the CDS start region is labeled as -M, -(M-1) , -(M-2), ..., -1, 0, 1, ..., (N-1) where M and N are values set by cdsStartUpstream and cdsStartDownstream options in calcMetagene function. Position 0 in CDS start region represents the first base of start codon; the CDS end region is labeled as -(P-1), -(P-2), ..., -1, 0, 1, ..., Q where P and Q are values set by cdsEndUpstream and cdsEndDownstream. Position 0 in CDS end region represents the last base of stop codon.


nzhang89/RiboSeeker documentation built on April 15, 2022, 10:18 a.m.