1 // ***************************************************************************
2 // BamHeader_p.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 26 January 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides the basic functionality for handling BAM headers.
8 // ***************************************************************************
17 // This file is not part of the BamTools API. It exists purely as an
18 // implementation detail. This header file may change from version to version
19 // without notice, or even be removed.
23 #include <api/SamHeader.h>
38 // BamHeader interface
40 // clear SamHeader data
42 // return true if SamHeader data is valid
43 bool IsValid(void) const;
44 // load BAM header ('magic number' and SAM header text) from BGZF stream
45 // returns true if all OK
46 bool Load(BgzfStream* stream);
47 // returns (editable) copy of SamHeader data object
48 SamHeader ToSamHeader(void) const;
49 // returns SAM-formatted string of header data
50 std::string ToString(void) const;
54 // reads magic number from BGZF stream, returns true if valid
55 bool CheckMagicNumber(BgzfStream* stream);
56 // reads SAM header length from BGZF stream, stores it in @length
57 // returns read success/fail status
58 bool ReadHeaderLength(BgzfStream* stream, uint32_t& length);
59 // reads SAM header text from BGZF stream, stores in SamHeader object
60 // returns read success/fail status
61 bool ReadHeaderText(BgzfStream* stream, const uint32_t& length);
68 } // namespace Internal
69 } // namespace BamTools
71 #endif // BAMHEADER_P_H