polygonChrom             package:ecolitk             R Documentation

_F_u_n_c_t_i_o_n_s _t_o _p_l_o_t _c_i_r_c_u_l_a_r _c_h_r_o_m_o_s_o_m_e_s _i_n_f_o_r_m_a_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     Functions to plot circular chromosomes informations

_U_s_a_g_e:

     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

_A_r_g_u_m_e_n_t_s:

  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 

_D_e_t_a_i_l_s:

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

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     laurent <laurent@cbs.dtu.dk>

_E_x_a_m_p_l_e_s:

     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)

