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