vec <- as.integer(c(19, 5, 0, 8, 5))
  successiveIRanges(vec)
  breakInChunks(600999, 50000)  # 13 chunks of size 50000 (last chunk is
                                # smaller).
  whichAsIRanges(vec >= 5)
  x <- IRanges(start=c(-2L, 6L, 9L, -4L, 1L, 0L, -6L, 10L),
               width=c( 5L, 0L, 6L,  1L, 4L, 3L,  2L,  3L))
  asNormalIRanges(x)  # 3 non-empty ranges ordered from left to right and
                      # separated by gaps of width >= 1.
  ## More on normality:
  example(`IRanges-class`)
  isNormal(x16)                        # FALSE
  if (interactive())
      x16 <- asNormalIRanges(x16)      # Error!
  whichFirstNotNormal(x16)             # 57
  isNormal(x16[1:56])                  # TRUE
  xx <- asNormalIRanges(x16[1:56])
  class(xx)
  max(xx)
  min(xx)
Run the code above in your browser using DataLab