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 = "");
27 explicit SamHeader(const SamHeader& other);
30 // query/modify entire SamHeader at once
33 // clear all header contents
36 // checks if SAM header is well-formed
37 // @verbose - if true, validation errors & warnings will be printed to stderr
38 // otherwise, output is suppressed and only validation check occurs
39 bool IsValid(bool verbose = false) const;
41 // retrieves the printable, SAM-formatted header
42 // (with any local modifications since construction)
43 std::string ToString(void) const;
45 // query if header contains data elements
47 bool HasVersion(void) const;
48 bool HasSortOrder(void) const;
49 bool HasGroupOrder(void) const;
50 bool HasSequences(void) const;
51 bool HasReadGroups(void) const;
52 bool HasProgramName(void) const;
53 bool HasProgramVersion(void) const;
54 bool HasProgramCommandLine(void) const;
55 bool HasComments(void) const;
60 // header metadata (@HD line)
61 std::string Version; // VN:<Version>
62 std::string SortOrder; // SO:<SortOrder>
63 std::string GroupOrder; // GO:<GroupOrder>
65 // header sequences (@SQ entries)
66 SamSequenceDictionary Sequences;
68 // header read groups (@RG entries)
69 SamReadGroupDictionary ReadGroups;
71 // header program data (@PG entries)
72 std::string ProgramName; // ID:<ProgramName>
73 std::string ProgramVersion; // VN:<ProgramVersion>
74 std::string ProgramCommandLine; // CL:<ProgramCommandLine>
76 // header comments (@CO entries)
77 std::vector<std::string> Comments;
80 } // namespace BamTools
82 #endif // SAM_HEADER_H