dhtslib.coordinates

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)

Members

Aliases

OB
alias OB = Coordinate!(Basis.one)
Undocumented in source.
OBC
alias OBC = Interval!(CoordSystem.obc)
Undocumented in source.
OBHO
alias OBHO = Interval!(CoordSystem.obho)
Undocumented in source.
OneBased
alias OneBased = Coordinate!(Basis.one)
Undocumented in source.
OneBasedClosed
alias OneBasedClosed = Interval!(CoordSystem.obc)
Undocumented in source.
OneBasedHalfOpen
alias OneBasedHalfOpen = Interval!(CoordSystem.obho)
Undocumented in source.
ZB
alias ZB = Coordinate!(Basis.zero)
Undocumented in source.
ZBC
alias ZBC = Interval!(CoordSystem.zbc)
Undocumented in source.
ZBHO
alias ZBHO = Interval!(CoordSystem.zbho)
Undocumented in source.
ZeroBased
alias ZeroBased = Coordinate!(Basis.zero)
Undocumented in source.
ZeroBasedClosed
alias ZeroBasedClosed = Interval!(CoordSystem.zbc)
Undocumented in source.
ZeroBasedHalfOpen
alias ZeroBasedHalfOpen = Interval!(CoordSystem.zbho)
Undocumented in source.

Enums

Basis
enum Basis

Represents 0-based vs 1-based coordinate types

CoordSystem
enum CoordSystem

Coordsytem types

End
enum End

Represents whether a coordinate set's end coordinate is open or closed

Manifest constants

CoordSystemLabels
enum CoordSystemLabels;

Labels for each CoordSystem Type

Structs

Coordinate
struct Coordinate(Basis bs)

Coordinate type for a single position with in a Coordinate set, where the type itself encodes the coordinate system details (zero or one-based)

Interval
struct Interval(CoordSystem cs)

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)

Templates

coordinateSystemToBasis
template coordinateSystemToBasis(CoordSystem cs)

template to convert CoordinateSystem enum to respective Basis enum

coordinateSystemToEnd
template coordinateSystemToEnd(CoordSystem cs)

template to convert CoordinateSystem enum to respective End enum

getCoordinateSystem
template getCoordinateSystem(Basis bs, End es)

template to convert Basis, End enum combination to respective CoordinateSystem enum

Meta