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
Read and write SAM or BAM files.
File "bam_stream.cpp"
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 |
The output is as follows:
@SQ SN:ref LN:45
@SQ SN:ref2 LN:40
r001 163 ref 7 30 8M4I4M1D3M = 37 39 TTAGATAAAGAGGATACTG * XX:B:S,12561,2,20,112
r002 0 ref 9 30 1S2I6M1P1I1P1I4M2I * 0 0 AAAAGATAAGGGATAAA *
r003 0 ref 9 30 5H6M * 0 0 AGCTAA *
r004 0 ref 16 30 6M14N1I5M * 0 0 ATAGCTCTCAGC *
r003 16 ref 29 30 6H5M * 0 0 TAGGC *
r001 83 ref 37 30 9M = 7 -39 CAGCGCCAT *
SeqAn - Sequence Analysis Library - www.seqan.de