Represents 0-based vs 1-based coordinate types
Coordsytem types
Represents whether a coordinate set's end coordinate is open or closed
Labels for each CoordSystem Type
Coordinate type for a single position with in a Coordinate set, where the type itself encodes the coordinate system details (zero or one-based)
The (start, end) coordinates within a coordinate system, where the type itself encodes the coordinate system details (zero or one-based; half-open vs. closed)
template to convert CoordinateSystem enum to respective Basis enum
template to convert CoordinateSystem enum to respective End enum
template to convert Basis, End enum combination to respective CoordinateSystem enum
Coordinates and Coordinate Systems
Interval include start and end, but no reference sequence id (chr, contig, etc.)
The Coordinate type is templated on CoordSystem enum, so that the actual coordinate system in use -- and by this, we mean zero- or one-based, and half-open vs. closed -- is encoded within the type itself. e.g. Coordinate!(CoordSystem.zbho)(0, 100)
In this way, dhtslib functions that take type Coordinate can enforce safety checks, or optionally, interconversions, to avoid off-by-one errors when dealing with different systems, as is common in different HTS/NGS file formats.
In general, zero-based half-open (ZBHO) coordinates are easy to compute on, whereas many data sources intended to be read and understood by humans (including NCBI) are one-based closed systems. You may enjoy reading the following articles:
https://www.biostars.org/p/84686/
https://www.biostars.org/p/6373/
http://genome.ucsc.edu/blog/the-ucsc-genome-browser-coordinate-counting-systems/
http://genomewiki.ucsc.edu/index.php/Coordinate_Transforms
Zero-based, half open: BED, BAM Zero-based, closed: HTSlib function faidx_fetch_seq , strangely One-based, half open: ? One-based, closed: GFF3, SAM (text; not BAM), VCF (text; not BCF)