Last data update: 2014.03.03

R: Functions to plot circular chromosomes informations
polygonChromR Documentation

Functions to plot circular chromosomes informations

Description

Functions to plot circular chromosomes informations

Usage

cPlotCircle(radius=1, xlim=c(-2, 2), ylim=xlim, edges=300, main=NULL,
            main.inside, ...)

chromPos2angle(pos, len.chrom, rot=pi/2, clockwise=TRUE)

polygonChrom(begin, end, len.chrom, radius.in, radius.out,
             total.edges = 300,
             edges = max(round(abs(end - begin)/len.chrom *
                     total.edges), 2, na.rm = TRUE),
             rot = pi/2, clockwise = TRUE, ...)

linesChrom(begin, end, len.chrom, radius,
             total.edges = 300,
             edges = max(round(abs(end - begin)/len.chrom *
                     total.edges), 2, na.rm = TRUE),
             rot = pi/2, clockwise = TRUE, ...)

ecoli.len

Arguments

radius

radius

xlim, ylim

range for the plot. Can be used to zoom-in a particular region.

pos

position (nucleic base coordinate)

begin

begining of the segment (nucleic base number).

end

end of the segment (nucleic base number).

len.chrom

length of the chromosome in base pairs

radius.in

inner radius

radius.out

outer radius

total.edges

total number of edges for the chromosome

edges

number of edges for the specific segment(s)

rot

rotation (default is pi / 2, bringing the angle zero at 12 o'clock)

clockwise

rotate clockwise. Default to TRUE.

main, main.inside

main titles for the plot

...

optional graphical parameters

Details

The function chromPos2angle is a convenience function. The variable ecoli.len contains the size of the Escheria coli genome considered (K12).

Value

Except chromPos2angle, the function are solely used for their border effects.

Author(s)

laurent <laurent@cbs.dtu.dk>

Examples


data(ecoligenomeSYMBOL2AFFY)
data(ecoligenomeCHRLOC)

## find the operon lactose ("lac*" genes)
lac.i <- grep("^lac", ls(ecoligenomeSYMBOL2AFFY))
lac.symbol <- ls(ecoligenomeSYMBOL2AFFY)[lac.i]
lac.affy <- unlist(lapply(lac.symbol, get, envir=ecoligenomeSYMBOL2AFFY))

beg.end <- lapply(lac.affy, get, envir=ecoligenomeCHRLOC)
beg.end <- matrix(unlist(beg.end), nc=2, byrow=TRUE)

lac.o <- order(beg.end[, 1])

lac.i <- lac.i[lac.o]
lac.symbol <- lac.symbol[lac.o]
lac.affy <- lac.affy[lac.o]
beg.end <- beg.end[lac.o, ]

lac.col <- rainbow(length(lac.affy))

par(mfrow=c(2,2))

## plot

cPlotCircle(main="lac genes")
polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.2, col=lac.col)
rect(0, 0, 1.1, 1.1, border="red")

cPlotCircle(xlim=c(0, 1.2), ylim=c(0, 1.1))
polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.1, col=lac.col)
rect(0.4, 0.8, 0.7, 1.1, border="red")

cPlotCircle(xlim=c(.45, .5), ylim=c(.85, 1.0))
polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.03, col=lac.col)

mid.genes <- apply(beg.end, 1, mean)
mid.angles <- chromPos2angle(mid.genes, ecoli.len)
xy <- polar2xy(1.03, mid.angles)
xy.labels <- data.frame(x = seq(0.45, 0.5, length=4), y = seq(0.95, 1.0, length=4))
segments(xy$x, xy$y, xy.labels$x, xy.labels$y, col=lac.col)
text(xy.labels$x, xy.labels$y, lac.symbol, col=lac.col)

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(ecolitk)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ecolitk/polygonChrom.Rd_%03d_medium.png", width=480, height=480)
> ### Name: polygonChrom
> ### Title: Functions to plot circular chromosomes informations
> ### Aliases: polygonChrom linesChrom cPlotCircle chromPos2angle
> ### Keywords: hplot dplot
> 
> ### ** Examples
> 
> 
> data(ecoligenomeSYMBOL2AFFY)
> data(ecoligenomeCHRLOC)
> 
> ## find the operon lactose ("lac*" genes)
> lac.i <- grep("^lac", ls(ecoligenomeSYMBOL2AFFY))
> lac.symbol <- ls(ecoligenomeSYMBOL2AFFY)[lac.i]
> lac.affy <- unlist(lapply(lac.symbol, get, envir=ecoligenomeSYMBOL2AFFY))
> 
> beg.end <- lapply(lac.affy, get, envir=ecoligenomeCHRLOC)
> beg.end <- matrix(unlist(beg.end), nc=2, byrow=TRUE)
> 
> lac.o <- order(beg.end[, 1])
> 
> lac.i <- lac.i[lac.o]
> lac.symbol <- lac.symbol[lac.o]
> lac.affy <- lac.affy[lac.o]
> beg.end <- beg.end[lac.o, ]
> 
> lac.col <- rainbow(length(lac.affy))
> 
> par(mfrow=c(2,2))
> 
> ## plot
> 
> cPlotCircle(main="lac genes")
> polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.2, col=lac.col)
> rect(0, 0, 1.1, 1.1, border="red")
> 
> cPlotCircle(xlim=c(0, 1.2), ylim=c(0, 1.1))
> polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.1, col=lac.col)
> rect(0.4, 0.8, 0.7, 1.1, border="red")
> 
> cPlotCircle(xlim=c(.45, .5), ylim=c(.85, 1.0))
> polygonChrom(beg.end[, 1], beg.end[, 2], ecoli.len, 1, 1.03, col=lac.col)
> 
> mid.genes <- apply(beg.end, 1, mean)
> mid.angles <- chromPos2angle(mid.genes, ecoli.len)
> xy <- polar2xy(1.03, mid.angles)
> xy.labels <- data.frame(x = seq(0.45, 0.5, length=4), y = seq(0.95, 1.0, length=4))
> segments(xy$x, xy$y, xy.labels$x, xy.labels$y, col=lac.col)
> text(xy.labels$x, xy.labels$y, lac.symbol, col=lac.col)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>