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