/*!
* @class BamFileIn
*
* @extends FormattedFileIn
*
* @headerfile <seqan/bam_io.h>
*
* @brief Class for reading SAM and BAM files.
*
* @signature typedef FormattedFile<Bam, Input> BamFileIn;
*
* @section Example
*
* Access SAM or BAM files.
*
* @include demos/tutorial/sam_and_bam_io/solution1.cpp
*
* The output is as follows:
*
* @include demos/tutorial/sam_and_bam_io/example.sam
*
*
*
* @see BamHeader
* @see BamAlignmentRecord
*
* @fn BamFileIn#viewRecords
*
* @brief Extract all reads overlapping a region from a BamFileIn mimicking
* samtools view.
*
* @signature bool viewRecords(resultContainer, bamFileIn, bamIndex, refID,
* regionStart, regionEnd, index);
*
* @param[in,out] resultContainer Container of @link BamAlignmentRecord @endlink
* 's to store the alignments.
* @param[in,out] bamFileIn The @link BamFileIn @endlink to extract reads from.
* @param[in] bamIndex The @link BamIndex @endlink over the `bamFileIn`.
* @param[in] refID The reference id to extract reads from (<tt>int32_t</tt>).
* @param[in] regionStart The begin of the region to extract reads from
* (<tt>int32_t</tt>).
* @param[in] regionEnd The end of the region to extract reads from
* (<tt>int32_t</tt>).
*
* @throw ParseError when reading the bamFile or index fails.
* @throw std::logical_error when the input arguments are invalid.
*
* You provide a 1-based region <tt>[regionStart, regionEnd]</tt> on the
* reference <tt>refID</tt> and the functions extracts all reads that overlap
* this region with at least one base. The overlapping records are **appended**
* in the <tt>resultContainer</tt>, which must be a container over @link
* BamAlignmentRecord @endlink. This function extracts the same records as
* samtools view would do when the same region is specified. The result
* container remains empty if an error occurred or no reads were found.
*
* @section Remarks This function fails if <tt>refID</tt>/<tt>regionStart</tt>
* are invalid.
*
* @fn BamFileIn#jumpToRegion
*
* @brief Seek in BamFileIn using an index.
*
* @signature bool jumpToRegion(bamFileIn, hasAlignments, refID, regionStart,
* regionEnd, index);
*
* @param[in,out] bamFileIn The @link BamFileIn @endlink to jump with.
* @param[out] hasAlignments A <tt>bool</tt> that is set true if the region
* <tt>[regionStart, regionEnd]</tt> has any at least
* one overlapping alignment (bam record).
* @param[in] refID The reference id to jump to (<tt>int32_t</tt>).
* @param[in] regionStart The begin of the region to jump to (<tt>int32_t</tt>).
* @param[in] regionEnd The end of the region to jump to (<tt>int32_t</tt>).
* @param[in] index The @link BamIndex @endlink to use for the jumping.
*
* @return bool `false` if an error occurred while seeking, otherwise `true`.
*
* @throw ParseError when reading the bamFile or index fails.
* @throw std::logical_error when the input arguments are invalid.
*
* You provide a 1-based region <tt>[regionStart, regionEnd]</tt> on the
* reference <tt>refID</tt> that you want to jump to and the function jumps to
* the first alignment (bam record) whose **start position** lies inside this
* region, if any.
*
* Note: The current implementation only considers the read start positions.
* Therefore, we do guarantee that reads overlapping the region are included. To
* account for this limitation you may want to choose the start of your your
* region with an appropriate offset (e.g. start - length_of_read) or use
* viewRecords().
*
* @section Remarks
*
* This function fails if <tt>refID</tt>/<tt>regionStart</tt> are invalid.
*
* @fn BamFileIn#jumpToOrphans
*
* @brief Seek to orphans block in BamFileIn using an index.
*
* @signature bool jumpToOrphans(bamFileIn, hasAlignments, index);
*
* @param[in,out] bamFileIn The @link BamFileIn @endlink object to jump with.
* @param[out] hasAlignments A <tt>bool</tt> that is set to true if there are
* any orphans.
* @param[in] index The @link BamIndex @endlink to use for jumping.
*/