BamTools  2.5.2
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 <string>
14 #include "api/BamAux.h"
15 #include "api/api_global.h"
16 
17 namespace BamTools {
18 
19 class SamProgramChain;
20 
21 struct API_EXPORT SamProgram
22 {
23 
24  // ctor & dtor
25  SamProgram();
26  SamProgram(const std::string& id);
27 
28  // query/modify entire program record
29  void Clear(); // clears all data fields
30 
31  // convenience query methods
32  bool HasCommandLine() const; // returns true if program record has a command line entry
33  bool HasID() const; // returns true if program record has an ID
34  bool HasName() const; // returns true if program record has a name
35  bool HasPreviousProgramID()
36  const; // returns true if program record has a 'previous program ID'
37  bool HasVersion() 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() const;
50  std::string NextProgramID;
52 };
53 
57 inline bool operator==(const SamProgram& lhs, const SamProgram& rhs)
58 {
59  return lhs.ID == rhs.ID;
60 }
61 
62 } // namespace BamTools
63 
64 #endif // SAM_PROGRAM_H
Sorted container "chain" of SamProgram records.
Definition: SamProgramChain.h:27
Contains all BamTools classes & methods.
Definition: Sort.h:24
bool operator==(const SamProgram &lhs, const SamProgram &rhs)
tests equality by comparing program IDs
Definition: SamProgram.h:57
Represents a SAM program record.
Definition: SamProgram.h:22
std::string Name
corresponds to @PG PN:<Name>
Definition: SamProgram.h:42
std::vector< CustomHeaderTag > CustomTags
Definition: SamProgram.h:45
std::string Version
corresponds to @PG VN:<Version>
Definition: SamProgram.h:44
std::string PreviousProgramID
corresponds to @PG PP:<PreviousProgramID>
Definition: SamProgram.h:43
std::string CommandLine
corresponds to @PG CL:<CommandLine>
Definition: SamProgram.h:40
std::string ID
corresponds to @PG ID:<ID>
Definition: SamProgram.h:41