# Class BamIndex
Access to BAM indices.

All Subcl's | BaiBamIndex
Defined in | <seqan/bam_io.h>
Signature | `template <typename TSpec> class BamIndex;`

## Interface Function Overview

- `uint64_t getUnalignedCount(index);`
  Query index for number of unaligned reads.
- `bool open(index, filename);`
  Load a BAM index from a given file name.
- `bool save(baiIndex, baiFileName);`
  Save a BamIndex object.

## Detailed Description

This is an abstract class; don't use it itself but its specializations.

## See Also

- BamFileIn

## Interface Functions Detail

### `uint64_t getUnalignedCount(index);`

Query index for number of unaligned reads.

#### Parameters

`index` | Index to query.

#### Returns

`uint64_t` | The number of unaligned reads.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool open(index, filename);`

Load a BAM index from a given file name.

#### Parameters

`index` | Target data structure.
`filename` | Path to file to load. Types: char const *

#### Returns

`bool` | Returns `true` on success, false otherwise.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool save(baiIndex, baiFileName);`

Save a BamIndex object.

#### Parameters

`baiIndex` | The BamIndex to write out.
`baiFileName` | The name of the BAI file to write to.

#### Returns

`bool` | `true` on success, `false` otherwise.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

#### Dox Sources

    /*!
     * @class BamIndex
     *
     * @headerfile <seqan/bam_io.h>
     *
     * @brief Access to BAM indices.
     *
     * @signature template <typename TSpec> class BamIndex;
     *
     * This is an abstract class; don't use it itself but its specializations.
     *
     * @see BamFileIn
     *
     * @fn BamIndex#getUnalignedCount
     *
     * @brief Query index for number of unaligned reads.
     *
     * @signature uint64_t getUnalignedCount(index);
     *
     * @param[in] index Index to query.
     *
     * @return uint64_t The number of unaligned reads.
     *
     * @fn BamIndex#open
     *
     * @brief Load a BAM index from a given file name.
     *
     * @signature bool open(index, filename);
     *
     * @param[in,out] index Target data structure.
     * @param[in] filename Path to file to load. Types: char const *
     *
     * @return bool Returns <tt>true</tt> on success, false otherwise.
     *
     * @fn BamIndex#save
     *
     * @brief Save a BamIndex object.
     *
     * @signature bool save(baiIndex, baiFileName);
     *
     * @param[in] baiIndex The BamIndex to write out.
     * @param[in] baiFileName The name of the BAI file to write to.
     *
     * @return bool <tt>true</tt> on success, <tt>false</tt> otherwise.
     */