Last data update: 2014.03.03

R: Plot data superimposed on chromosomal ideogram
plotOnIdeoR Documentation

Plot data superimposed on chromosomal ideogram

Description

Main function to plot binned data alongside chromosomal ideogram.

Usage

plotOnIdeo(chrom = stop("enter chromosome(s) to plot"), ideoTable, 
    values_GR, value_cols = "values", plotType = "lines", col = "orange", 
    bpLim = NULL, val_range = NULL, addScale = TRUE, scaleChrom = TRUE, 
    vertical = FALSE, addOnetoStart = TRUE, smoothVals = FALSE, cex.axis = 1,     plot_title = NULL, ablines_y = NULL, cex.main=1, ...)

Arguments

chrom

(character) chromosome(s) to create ideograms for

ideoTable

(data.frame) ideogram table. See getIdeo()

values_GR

(GenomicRanges) data to be plotted must be in metadata columns

value_cols

(character) which series to plot. Should be column names of the mcols() slot of values_GR

plotType

(character) Plot type for each series. Values can be "lines" or "rect" to plot lines or barplots respectively. The latter is not recommended when several series are to be plotted on the same axis.)

col

(character) vector of colors for data series

bpLim

(numeric) (xlim); display only a section of the chromosome and the corresponding values

val_range

(numeric) (ylim); y-axis scale for data series

addScale

(logical) if TRUE, bp positions will be shown along the chromosomes. This feature should be turned off if numerous chromosomes' worth of data are being plotted and all objects don't fit on the final graphics device.

scaleChrom

(logical) if FALSE, all chroms will display as the same size. scaleChrom will be ignored if bpLim is not NULL

vertical

(logical) if TRUE, chromosomes will be plotted vertically

addOnetoStart

(logical) if TRUE, adds 1 to chromStart. Useful to convert data in half-open coordinates - which is all data from the UCSC genome browser, including cytoBandIdeo, into 1-base.

smoothVals

(logical) if T, smoothes each trendline. Currently hard-coded to lowess smoothing with span=0.03

cex.axis

(integer) axis font size

plot_title

(character) title for overall graph

ablines_y

(numeric) when supplied, draws reference lines on the y-axis

cex.main

(numeric) font size for plot title

...

other graphing options for barplot (i.e. main="Values", to title bar plot "Values")

Details

plotOnIdeo() is the main function of this package. It is the one the end-user is expected to call to generate plots. Input is provided as a GRanges object (values_GR), with data to be plotted contained in its metadata slot. The user is responsible for providing pre-binned data, if binning is required. Data can also be binned using the avgByBin() function in this package. The ideogram table (ideoTable) is the same as the cytoBandIdeo table available from the UCSC genome browser database for a given genome is a can be either automatically downloaded from UCSC (see getIdeo()) or read in from a local-file and passed to this function.

There are numerous arguments which control the appearance of the plot. The main decision points are:

  1. vertical: Whether the entire plot should have a horizontal or vertical orientation

  2. plotType: Whether each dataseries should be shown as a trendline or as a barplot. The latter is not recommended for cases where multiple series are to be plotted on the same axis.

Other considerations:

  • The size of the graphics device limits the number of chromosomes that can be plotted. A simple solution may be to set addScale=FALSE. However, it is recommended to call plotOnIdeo() multiple times, and plotting a fewer number of chromosomes on each page.

  • The code expects coordinates of values_GR to be in 1-base. Set addOneToStart=TRUE if supplied coordinates are in 0-base.

Author(s)

Shraddha Pai <Shraddha.Pai@camh.ca>, Jingliang Ren

Examples

data(binned_multiSeries)
data(hg18_ideo)
plotOnIdeo(chrom=seqlevels(binned_multiSeries),ideoTable=hg18_ideo, values_GR=binned_multiSeries, value_cols=colnames(mcols(binned_multiSeries)), col=1:5)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(IdeoViz)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: IRanges
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: RColorBrewer
Loading required package: rtracklayer
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/IdeoViz/plotOnIdeo.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotOnIdeo
> ### Title: Plot data superimposed on chromosomal ideogram
> ### Aliases: plotOnIdeo
> 
> ### ** Examples
> 
> data(binned_multiSeries)
> data(hg18_ideo)
> plotOnIdeo(chrom=seqlevels(binned_multiSeries),ideoTable=hg18_ideo, values_GR=binned_multiSeries, value_cols=colnames(mcols(binned_multiSeries)), col=1:5)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>