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>

_S_e_e _A_l_s_o:

_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)

