\name{globalSeg}
\alias{globalSeg}




\title{Class manipulating segments}
\description{
  We made a set of tools manipulation segments
}



\details{
  The aim of this class is to describe regions on chromosomes
  that are discontinuous segments on a line like:

  \preformatted{            
            1        10             25             40
Region A:   ##########              #######
Region B:   ####  ####              #############
Region C:                                          ######  ####
}

  We made two kind of class
  
  \itemize{
    \item \code{segSet}: segments set, is a matrix nx2 composed of a
    column of "from", and a column of "to". Used to describe a region like
    'A' or 'B' in our example. (A matrix 3x2 to describe region 'B').
    \item \code{globalSeg}: a list of \code{segSet}. It allows the
    notion of list of discontinuous segments (our use: a list of gene's
    models as a gene's model is stored as a list of its exons). In our
    sample, globalSeg will be the list of the 3 regions A,B and C. Note
    that it store more information than just a matrix with 2 columns
    containing all \code{segments} of theses 3 regions.    
  }

  For a better comprehension of other man pages, we introduce this
  notation:
    \itemize{
      \item a segment is just a part of a line determined by two values
      (from and to)
      \item an object of class segSet is a set of \code{n} segments,
      determined by a matrix \code{n}x2
      \item an  object of class globalSeg is a set of
      segSets, determined by a list of matrix.
      
    }
  
}


\author{Epissage group at CGM.}



\seealso{ See also \code{\link{as.segSet}}, \code{\link{as.globalSeg}},
  \code{\link{unionSeg}}}
\examples{

a = list(
    matrix( c( 1, 15, 17,  5, 45, 38),ncol=2),
    matrix( c( 100 , 120),ncol=2),
    matrix( c( 130, 135, 140, 145),ncol=2),
    matrix( c( 142 , 160),ncol=2))


b = list(
    matrix( c(15, 28, 18, 45),ncol=2),
    matrix( c(1, 15, 25, 10, 20, 40),ncol=2),
    matrix( c(17, 35, 23, 38),ncol=2),
    matrix( c(100, 110, 105, 120),ncol=2))

a = as.globalSeg(a)
b = as.globalSeg(b)

par(mar=c(1,0,1,0))

par(mfrow=c(8,1))
plot(a,xlim=c(1,160),main="A")
plot(b,xlim=c(1,160),main="B")

plot(and(b),xlim=c(1,160),main="and(B)")
plot(or(b),xlim=c(1,160),main="or(B)")
plot(Xor(b),xlim=c(1,160),main="Xor(B)")

plot(a&b,xlim=c(1,160),main="A&B")
plot(a|b,xlim=c(1,160),main="A|B")
plot(Xor(a,b),xlim=c(1,160),main="Xor(A,B)")


}

\keyword{utilities}