Class
BamStream
Class that provides an easy to use interface for reading and writing SAM and BAM files.
Include Headers
seqan/bam_io.h
Data Members
The BamIOContext object to use for reading and writing BamAlignmentRecords. | |
The BamHeader of the BamStream object. |
Member Functions
Constructor |
Functions
Check whether a BamStream object is at end when reading. | |
Close BamStream object's underlying file. | |
Flush output when writing. | |
Check whether the BamStream object has is in the failure state. | |
Open a BamStream object for reading/writing. | |
Read one BamAlignmentRecord from a BamStream. | |
Reset BamStream object to status after construction. | |
Write one BamAlignmentRecord to a BamStream. |
Examples
Stream through a SAM or BAM file.
// Access the header through `header(bamIO)`;
seqan::BamAlignmentRecord record;
while (!atEnd(bamIO))
{
readRecord(record, bamIO);
// Process record...
}
Write out a string of SAM or BAM files.
seqan::String<seqan::BamAlignmentRecord> records;
// Fill records string here.
// Set header through `header(bamIO)`.
for (unsigned i = 0; i < length(record); ++i)
writeRecord(bamIO, records[i]);
SeqAn - Sequence Analysis Library - www.seqan.de