BamTools  2.4.1
SamProgram.h
Go to the documentation of this file.
1 // ***************************************************************************
2 // SamProgram.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 October 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides direct read/write access to the SAM header program records.
8 // ***************************************************************************
9 
10 #ifndef SAM_PROGRAM_H
11 #define SAM_PROGRAM_H
12 
13 #include "api/api_global.h"
14 #include "api/BamAux.h"
15 #include <string>
16 
17 namespace BamTools {
18 
19 class SamProgramChain;
20 
22 
23  // ctor & dtor
24  SamProgram(void);
25  SamProgram(const std::string& id);
26  SamProgram(const SamProgram& other);
27  ~SamProgram(void);
28 
29  // query/modify entire program record
30  void Clear(void); // clears all data fields
31 
32  // convenience query methods
33  bool HasCommandLine(void) const; // returns true if program record has a command line entry
34  bool HasID(void) const; // returns true if program record has an ID
35  bool HasName(void) const; // returns true if program record has a name
36  bool HasPreviousProgramID(void) const; // returns true if program record has a 'previous program ID'
37  bool HasVersion(void) const; // returns true if program record has a version
38 
39  // data members
40  std::string CommandLine; // CL:<CommandLine>
41  std::string ID; // ID:<ID> *Required for valid SAM header*
42  std::string Name; // PN:<Name>
43  std::string PreviousProgramID; // PP:<PreviousProgramID>
44  std::string Version; // VN:<Version>
45  std::vector<CustomHeaderTag> CustomTags; // optional custom tags
46 
47  // internal (non-standard) methods & fields
48  private:
49  bool HasNextProgramID(void) const;
50  std::string NextProgramID;
52 };
53 
57 API_EXPORT inline bool operator==(const SamProgram& lhs, const SamProgram& rhs) {
58  return lhs.ID == rhs.ID;
59 }
60 
61 } // namespace BamTools
62 
63 #endif // SAM_PROGRAM_H
std::vector< CustomHeaderTag > CustomTags
Definition: SamProgram.h:45
API_EXPORT bool operator==(const SamProgram &lhs, const SamProgram &rhs)
tests equality by comparing program IDs
Definition: SamProgram.h:57
std::string PreviousProgramID
corresponds to @PG PP:<PreviousProgramID>
Definition: SamProgram.h:43
std::string Name
corresponds to @PG PN:<Name>
Definition: SamProgram.h:42
std::string Version
corresponds to @PG VN:<Version>
Definition: SamProgram.h:44
#define API_EXPORT
Definition: api_global.h:18
Sorted container "chain" of SamProgram records.
Definition: SamProgramChain.h:26
std::string ID
corresponds to @PG ID:<ID>
Definition: SamProgram.h:41
Contains all BamTools classes & methods.
Definition: Sort.h:24
Represents a SAM program record.
Definition: SamProgram.h:21
std::string CommandLine
corresponds to @PG CL:<CommandLine>
Definition: SamProgram.h:40