Skip to content

BAM records and BAM file IO

Mason M Lai edited this page Jun 22, 2017 · 1 revision

Representing BAM records

This framework draws a distinction between a BAM record and its alignment.

Objects that implement the Aligned interface have been, successfully or unsuccessfully, aligned to a reference. They are not annotations, because they are not guaranteed to have a valid (concordant) alignment. In other words, they may not have a reference, a start position, etc.

Objects that implement the Alignment interface have been concordantly aligned to a reference. They are annotations, and indeed extend the Annotated interface, because they have a reference, start position, etc.

In fact, the Aligned interface merely designates that the object potentially wraps an Alignment. Aligned objects have the method getAlignment(), which returns the Alignment in an Optional if it exists, and Optional.empty() if it does not.

BAM parsers have some convenience methods so that you don't often have to explicitly extract an Alignment from its corresponding Aligned object.

Single-read fragments

Paired-end fragments

Clone this wiki locally