BamHeaderRecord - SeqAn API Documentation

# Class BamHeaderRecord
Represents a header entry in a SAM file or the header section of the BAM header.

Defined in | <seqan/bam_io.h>
Signature | `class BamHeaderRecord;`

## Member Function Overview

- `BamHeaderRecord::BamRecord();`
  Constructor.
- `void clear(record);`
  Clear BamHeaderRecord object.
- `bool getTagValue(tagValue, idx, record);, bool getTagValue(tagValue, key, record);`
  Return tag value from a BamHeaderRecord.
- `void setTagValue(idx, value, record);, void setTagValue(key, value, record);`
  Sets the value of a tag in a BamHeaderRecord.

## Member Typedef Overview

- `BamHeaderRecord::TTag;`
  Type of the tag keys (Pair of `TTagName` and `TTagValue`).
- `BamHeaderRecord::TTagName;`
  Type of the tag keys (CharString).
- `BamHeaderRecord::TTags;`
  Type of the tags string (AllocString of `TTag`).
- `BamHeaderRecord::TTagValue;`
  Type of the tag values (CharString).

## Member Variable Overview

- `TRecordString BamHeaderRecord::tags`
  The header record's tags, of type TTags.
- `BamHeaderRecordType BamHeaderRecord::type`
  Type of the record.

## Detailed Description

### Remarks

Comment records are stored with one tag where the key is empty and the value is the comment.

## Member Functions Detail

### `BamHeaderRecord::BamRecord();`

Constructor.

Only the default constructor is provided.

#### Data Races

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

### `void clear(record);`

Clear BamHeaderRecord object.

#### Parameters

`record` | The record to clear.

#### Data Races

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

### `bool getTagValue(tagValue, idx, record); bool getTagValue(tagValue, key, record);`

Return tag value from a BamHeaderRecord.

#### Parameters

`tagValue` | The CharString to write the tag value to.
`idx` | An integer with the index of the tag in the header record.
`key` | A two-letter sequence with the key of the tag in the header record.

#### Returns

`bool` | true in case the value could be retrieved, false otherwise.

#### Example

    CharString tagValue;
    bool keyFound = getTagValue(tagValue, "SN", record);

#### Data Races

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

### `void setTagValue(idx, value, record); void setTagValue(key, value, record);`

Sets the value of a tag in a BamHeaderRecord.

#### Parameters

`idx` | The index of the tag in the header record to set the value for.
`key` | The name of the tag (two-letter sequence) to set.
`record` | The header record to set the value for.

#### Data Races

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

## Member Typedef Detail

### `BamHeaderRecord::TTag;`

Type of the tag keys (Pair of `TTagName` and `TTagValue`).

### `BamHeaderRecord::TTagName;`

Type of the tag keys (CharString).

### `BamHeaderRecord::TTags;`

Type of the tags string (AllocString of `TTag`).

### `BamHeaderRecord::TTagValue;`

Type of the tag values (CharString).

## Member Variables Detail

### `TRecordString BamHeaderRecord::tags`

The header record's tags, of type TTags.

### `BamHeaderRecordType BamHeaderRecord::type`

Type of the record.

#### Dox Sources

    /*!
     * @class BamHeaderRecord
     *
     * @headerfile <seqan/bam_io.h>
     *
     * @brief Represents a header entry in a SAM file or the header section of the
     *        BAM header.
     *
     * @signature class BamHeaderRecord;
     *
     * @section Remarks
     *
     * Comment records are stored with one tag where the key is empty and the value
     * is the comment.
     *
     * @fn BamHeaderRecord::BamHeaderRecord
     *
     * @brief Constructor.
     *
     * @signature BamHeaderRecord::BamRecord();
     *
     * Only the default constructor is provided.
     *
     * @fn BamHeaderRecord::clear
     *
     * @brief Clear BamHeaderRecord object.
     *
     * @signature void clear(record);
     *
     * @param[in,out] record The record to clear.
     *
     * @fn BamHeaderRecord::getTagValue
     *
     * @brief Return tag value from a @link BamHeaderRecord @endlink.
     *
     * @signature bool getTagValue(tagValue, idx, record);
     * @signature bool getTagValue(tagValue, key, record);
     *
     * @param[out] tagValue The @link CharString @endlink to write the tag value to.
     * @param[in] idx An integer with the index of the tag in the header record.
     * @param[in] key A two-letter sequence with the key of the tag in the header
     *                record.
     *
     * @return bool true in case the value could be retrieved, false otherwise.
     *
     * @section Example
     *
     * @code{.cpp}
     * CharString tagValue;
     * bool keyFound = getTagValue(tagValue, "SN", record);
     * @endcode
     *
     *
     * @fn BamHeaderRecord::setTagValue
     *
     * @brief Sets the value of a tag in a BamHeaderRecord.
     *
     * @signature void setTagValue(idx, value, record);
     * @signature void setTagValue(key, value, record);
     *
     * @param[in,out] idx The index of the tag in the header record to set the value
     *                    for.
     * @param[in] key The name of the tag (two-letter sequence) to set.
     * @param[in] record The header record to set the value for.
     *
     * @typedef BamHeaderRecord::TTagName
     *
     * @brief Type of the tag keys (@link CharString @endlink).
     *
     * @signature BamHeaderRecord::TTagName;
     *
     * @typedef BamHeaderRecord::TTagValue
     *
     * @brief Type of the tag values (@link CharString @endlink).
     *
     * @signature BamHeaderRecord::TTagValue;
     *
     * @typedef BamHeaderRecord::TTag
     *
     * @brief Type of the tag keys (@link Pair @endlink of <tt>TTagName</tt> and
     *        <tt>TTagValue</tt>).
     *
     * @signature BamHeaderRecord::TTag;
     *
     * @typedef BamHeaderRecord::TTags
     *
     * @brief Type of the tags string (@link AllocString @endlink of <tt>TTag</tt>).
     *
     * @signature BamHeaderRecord::TTags;
     *
     * @var BamHeaderRecordType BamHeaderRecord::type;
     *
     * @brief Type of the record.
     *
     * @var TRecordString BamHeaderRecord::tags;
     *
     * @brief The header record's tags, of type @link BamHeaderRecord::TTags
     *        @endlink.
     */