Last data update: 2014.03.03

R: Basic plotting function for obtained features
plotFeaturesR Documentation

Basic plotting function for obtained features

Description

This functions creates a basic plot with the features retrieved by getDasFeature or adds them to an existing plot.

Usage

    plotFeatures(df, col=NULL, col.start="start", col.end="end", col.id ="label", col.type="type", box.height=4, box.sep=2, pos.label=c("middle", "top", "bottom", "no"), new=TRUE, legend=TRUE, ...)

Arguments

df

data.frame with the features. Columns col.start, col.end, col.id and col.type must be present.

col

Vector of colors for each box in df. If NULL, automatic rainbow coloring for different types will be used.

col.start, col.end, col.id, col.type

Names of the columns of the data.frame from which retrieve the values

box.height, box.sep

Height and separation between boxes (in percentual points respect y-axis)

pos.label

Position of the label respect the box. If pos.label=="no", labels are disabled.

new

Open a new graphical device. If new=FALSE, boxes will be added to an existing plot (so, coordinate system must be consistent).

legend

Add legend to the plot

...

Other graphical parameters passed to plot.default

Details

This function provides a quick way to view (non-overlapped) boxes in a new or an existing plot with the features retrieved.

Notice that boxes will can be plotted overlaping the current open graphical device, so the x-coordinates must match.

Value

(none)

Author(s)

Oscar Flores <oflores@mmb.pcb.ub.es>

See Also

getDasFeature

Examples

    # This is UCSC Genome browser
    setDasServer(server="http://genome.ucsc.edu/cgi-bin/das")

    # Note that id now changes, we can retrieve it from getDasDsn()
    source <- "sacCer3"
    range <- GRanges(c("I"), IRanges(start=1, end=2500))
    type <- c("sgdGene")

    # We want the official genes from 'sdgGene' in the range I:1-2500
    features <- getDasFeature(source, range, type)
    print(features)

    plotFeatures(features)

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(DASiR)
Loading required package: Biostrings
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

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: IRanges
Loading required package: XVector
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/DASiR/plotFeatures.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotFeatures
> ### Title: Basic plotting function for obtained features
> ### Aliases: plotFeatures
> ### Keywords: plot
> 
> ### ** Examples
> 
>     # This is UCSC Genome browser
>     setDasServer(server="http://genome.ucsc.edu/cgi-bin/das")
DAS server for this session is: http://genome.ucsc.edu/cgi-bin/das
> 
>     # Note that id now changes, we can retrieve it from getDasDsn()
>     source <- "sacCer3"
>     range <- GRanges(c("I"), IRanges(start=1, end=2500))
>     type <- c("sgdGene")
> 
>     # We want the official genes from 'sdgGene' in the range I:1-2500
>     features <- getDasFeature(source, range, type)
Querying url: http://genome.ucsc.edu/cgi-bin/das/sacCer3/features
>     print(features)
  segment.range                    id     label    type method start  end score
1             1    YAL069W.chrI.334.0   YAL069W sgdGene          335  649     -
2             1  YAL068W-A.chrI.537.0 YAL068W-A sgdGene          538  792     -
3             1   YAL068C.chrI.1806.0   YAL068C sgdGene         1807 2169     -
4             1 YAL067W-A.chrI.2479.0 YAL067W-A sgdGene         2480 2707     -
  orientation phase                group
1           +     - Link to UCSC Browser
2           +     - Link to UCSC Browser
3           -     - Link to UCSC Browser
4           +     - Link to UCSC Browser
> 
>     plotFeatures(features)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>