1 // ***************************************************************************
2 // SamHeader.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 23 December 2010 (DB)
7 // ---------------------------------------------------------------------------
8 // Provides functionality for querying/manipulating SAM header data
9 // **************************************************************************
14 #include <api/api_global.h>
15 #include <api/SamReadGroupDictionary.h>
16 #include <api/SamSequenceDictionary.h>
22 struct API_EXPORT SamHeader {
26 explicit SamHeader(const std::string& headerText = "");
29 // query/modify entire SamHeader at once
32 // clear all header contents
35 // checks if SAM header is well-formed
36 // @verbose - if true, validation errors & warnings will be printed to stderr
37 // otherwise, output is suppressed and only validation check occurs
38 bool IsValid(bool verbose = false) const;
40 // retrieves the printable, SAM-formatted header
41 // (with any local modifications since construction)
42 std::string ToString(void) const;
44 // query if header contains data elements
46 bool HasVersion(void) const;
47 bool HasSortOrder(void) const;
48 bool HasGroupOrder(void) const;
49 bool HasSequences(void) const;
50 bool HasReadGroups(void) const;
51 bool HasProgramName(void) const;
52 bool HasProgramVersion(void) const;
53 bool HasProgramCommandLine(void) const;
54 bool HasComments(void) const;
59 // header metadata (@HD line)
60 std::string Version; // VN:<Version>
61 std::string SortOrder; // SO:<SortOrder>
62 std::string GroupOrder; // GO:<GroupOrder>
64 // header sequences (@SQ entries)
65 SamSequenceDictionary Sequences;
67 // header read groups (@RG entries)
68 SamReadGroupDictionary ReadGroups;
70 // header program data (@PG entries)
71 std::string ProgramName; // ID:<ProgramName>
72 std::string ProgramVersion; // VN:<ProgramVersion>
73 std::string ProgramCommandLine; // CL:<ProgramCommandLine>
75 // header comments (@CO entries)
76 std::vector<std::string> Comments;
79 } // namespace BamTools
81 #endif // SAM_HEADER_H