Provides write access for generating BAM files. More...
#include <BamWriter.h>
Public Types | |
enum | CompressionMode { Compressed = 0, Uncompressed } |
This enum describes the compression behaviors for output BAM files. More... | |
Public Member Functions | |
BamWriter (void) | |
constructor | |
~BamWriter (void) | |
destructor | |
void | Close (void) |
Closes the current BAM file. | |
std::string | GetErrorString (void) const |
Returns a human-readable description of the last error that occurred. | |
bool | IsOpen (void) const |
Returns true if BAM file is open for writing. | |
bool | Open (const std::string &filename, const std::string &samHeaderText, const RefVector &referenceSequences) |
Opens a BAM file for writing. | |
bool | Open (const std::string &filename, const SamHeader &samHeader, const RefVector &referenceSequences) |
Opens a BAM file for writing. | |
bool | SaveAlignment (const BamAlignment &alignment) |
Saves an alignment to the BAM file. | |
void | SetCompressionMode (const BamWriter::CompressionMode &compressionMode) |
Sets the output compression mode. |
Provides write access for generating BAM files.
BamWriter::BamWriter | ( | void | ) |
constructor
BamWriter::~BamWriter | ( | void | ) |
destructor
void BamWriter::Close | ( | void | ) |
Closes the current BAM file.
std::string BamWriter::GetErrorString | ( | void | ) | const |
Returns a human-readable description of the last error that occurred.
This method allows elimination of STDERR pollution. Developers of client code may choose how the messages are displayed to the user, if at all.
bool BamWriter::IsOpen | ( | void | ) | const |
Returns true
if BAM file is open for writing.
bool BamWriter::Open | ( | const std::string & | filename, | |
const SamHeader & | samHeader, | |||
const RefVector & | referenceSequences | |||
) |
Opens a BAM file for writing.
This is an overloaded function.
Will overwrite the BAM file if it already exists.
[in] | filename | name of output BAM file |
[in] | samHeader | header data, wrapped in SamHeader object |
[in] | referenceSequences | list of reference entries |
true
if opened successfully bool BamWriter::Open | ( | const std::string & | filename, | |
const std::string & | samHeaderText, | |||
const RefVector & | referenceSequences | |||
) |
Opens a BAM file for writing.
Will overwrite the BAM file if it already exists.
[in] | filename | name of output BAM file |
[in] | samHeaderText | header data, as SAM-formatted string |
[in] | referenceSequences | list of reference entries |
true
if opened successfully bool BamWriter::SaveAlignment | ( | const BamAlignment & | alignment | ) |
Saves an alignment to the BAM file.
[in] | alignment | BamAlignment record to save |
void BamWriter::SetCompressionMode | ( | const BamWriter::CompressionMode & | compressionMode | ) |
Sets the output compression mode.
Default mode is BamWriter::Compressed.
BamWriter writer; writer.SetCompressionMode(BamWriter::Uncompressed); writer.Open( ... ); // ...
[in] | compressionMode | desired output compression behavior |