1 // ***************************************************************************
2 // SamHeader.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 12 January 2011 (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 SamHeader(const std::string& headerText = "");
27 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 // replaces SamHeader contents with headerText
42 void SetHeaderText(const std::string& headerText);
44 // retrieves the printable, SAM-formatted header
45 // (with any local modifications since construction)
46 std::string ToString(void) const;
48 // query if header contains data elements
50 bool HasVersion(void) const;
51 bool HasSortOrder(void) const;
52 bool HasGroupOrder(void) const;
53 bool HasSequences(void) const;
54 bool HasReadGroups(void) const;
55 bool HasProgramName(void) const;
56 bool HasProgramVersion(void) const;
57 bool HasProgramCommandLine(void) const;
58 bool HasComments(void) const;
63 // header metadata (@HD line)
64 std::string Version; // VN:<Version>
65 std::string SortOrder; // SO:<SortOrder>
66 std::string GroupOrder; // GO:<GroupOrder>
68 // header sequences (@SQ entries)
69 SamSequenceDictionary Sequences;
71 // header read groups (@RG entries)
72 SamReadGroupDictionary ReadGroups;
74 // header program data (@PG entries)
75 std::string ProgramName; // ID:<ProgramName>
76 std::string ProgramVersion; // VN:<ProgramVersion>
77 std::string ProgramCommandLine; // CL:<ProgramCommandLine>
79 // header comments (@CO entries)
80 std::vector<std::string> Comments;
83 } // namespace BamTools
85 #endif // SAM_HEADER_H