Questions related to processing, analysis, arithmetic, and set operations involving sequence intervals.

Biological annotations are typically represented as intervals on a 1-dimensional space, and many of the most common data processing problems in bioinformatics can be reduced to interval arithmetic.

The two most common interval notations used in bioinformatics are 1-based closed interval notation and 0-based half-open interval notation.

1-based closed interval notation

In 1-based closed interval notation, each element in the sequence is numbered and the interval is denoted by the first and last element.

  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
  |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  A   C   G   T   G   A   T   T   A   C   A   A   C   G   T
  • The interval containing the sequence GATTACA is denoted 5-11
  • Length calculations: 11 - 5 + 1 = 7
  • Consecutive intervals: 100001-20000, 20001-30000, 30001-40000, ...
  • No unambiguous representation of zero-length features (such as insertion sites)

0-based open interval notation

In 0-based half-open notation, each element's coordinate is its offset from the beginning of the sequence. It can be helpful to think of coordinates as the spaces between elements in the sequence, as in the example below. Each interval is then denoted by the coordinates spanning the sequence of interest.

0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 
|   |   |   |   |   |   |   |   |   |   |   |   |   |   |   |
  A   C   G   T   G   A   T   T   A   C   A   A   C   G   T
  • The interval containing the sequence GATTACA is denoted 4-11.
  • Length calculations: 11 - 4 = 7
  • Consecutive intervals: 10000-20000, 20000-30000, 30000-40000, ...
  • Zero-length features (such as insertion sites) are represented using the same coordinate twice: 4-4