]> git.donarmstrong.com Git - bamtools.git/blob - src/api/SamHeader.h
Added explicit copy ctors to SamHeader data structures
[bamtools.git] / src / api / SamHeader.h
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 // **************************************************************************
10
11 #ifndef SAM_HEADER_H
12 #define SAM_HEADER_H
13
14 #include <api/api_global.h>
15 #include <api/SamReadGroupDictionary.h>
16 #include <api/SamSequenceDictionary.h>
17 #include <string>
18 #include <vector>
19
20 namespace BamTools {
21
22 struct API_EXPORT SamHeader {
23
24     // ctor & dtor
25     public:
26         explicit SamHeader(const std::string& headerText = "");
27         explicit SamHeader(const SamHeader& other);
28         ~SamHeader(void);
29
30     // query/modify entire SamHeader at once
31     public:
32
33         // clear all header contents
34         void Clear(void);
35
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;
40
41         // retrieves the printable, SAM-formatted header
42         // (with any local modifications since construction)
43         std::string ToString(void) const;
44
45     // query if header contains data elements
46     public:
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;
56
57     // data members
58     public:
59
60         // header metadata (@HD line)
61         std::string Version;                // VN:<Version>
62         std::string SortOrder;              // SO:<SortOrder>
63         std::string GroupOrder;             // GO:<GroupOrder>
64
65         // header sequences (@SQ entries)
66         SamSequenceDictionary Sequences;
67
68         // header read groups (@RG entries)
69         SamReadGroupDictionary ReadGroups;
70
71         // header program data (@PG entries)
72         std::string ProgramName;            // ID:<ProgramName>
73         std::string ProgramVersion;         // VN:<ProgramVersion>
74         std::string ProgramCommandLine;     // CL:<ProgramCommandLine>
75
76         // header comments (@CO entries)
77         std::vector<std::string> Comments;
78 };
79
80 } // namespace BamTools
81
82 #endif // SAM_HEADER_H