]> git.donarmstrong.com Git - bamtools.git/blob - src/api/SamReadGroup.h
b1fbfb8ac04d72bb6c4cb9ebd4f3a5ea0d99a565
[bamtools.git] / src / api / SamReadGroup.h
1 // ***************************************************************************
2 // SamReadGroup.h (c) 2010 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 18 April 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides direct read/write access to the SAM read group data fields.
8 // ***************************************************************************
9
10 #ifndef SAM_READGROUP_H
11 #define SAM_READGROUP_H
12
13 #include "api/api_global.h"
14 #include <string>
15
16 namespace BamTools {
17
18 struct API_EXPORT SamReadGroup {
19
20     // ctor & dtor
21     SamReadGroup(void);
22     SamReadGroup(const std::string& id);
23     SamReadGroup(const SamReadGroup& other);
24     ~SamReadGroup(void);
25
26     // query/modify entire read group
27     void Clear(void);                           // clears all data fields
28
29     // convenience query methods
30     bool HasDescription(void) const;            // returns true if read group has a description
31     bool HasFlowOrder(void) const;              // returns true if read group has a flow order entry
32     bool HasID(void) const;                     // returns true if read group has a group ID
33     bool HasKeySequence(void) const;            // returns true if read group has a key sequence
34     bool HasLibrary(void) const;                // returns true if read group has a library name
35     bool HasPlatformUnit(void) const;           // returns true if read group has a platform unit ID
36     bool HasPredictedInsertSize(void) const;    // returns true if read group has a predicted insert size
37     bool HasProductionDate(void) const;         // returns true if read group has a production date
38     bool HasProgram(void) const;                // returns true if read group has a program entry
39     bool HasSample(void) const;                 // returns true if read group has a sample name
40     bool HasSequencingCenter(void) const;       // returns true if read group has a sequencing center ID
41     bool HasSequencingTechnology(void) const;   // returns true if read group has a sequencing technology ID
42
43
44     // data fields
45     std::string Description;                    // DS:<Description>
46     std::string FlowOrder;                      // FO:<FlowOrder>
47     std::string ID;                             // ID:<ID>              *Required for valid SAM header*
48     std::string KeySequence;                    // KS:<KeySequence>
49     std::string Library;                        // LB:<Library>
50     std::string PlatformUnit;                   // PU:<PlatformUnit>
51     std::string PredictedInsertSize;            // PI:<PredictedInsertSize>
52     std::string ProductionDate;                 // DT:<ProductionDate>
53     std::string Program;                        // PG:<Program>
54     std::string Sample;                         // SM:<Sample>
55     std::string SequencingCenter;               // CN:<SequencingCenter>
56     std::string SequencingTechnology;           // PL:<SequencingTechnology>
57 };
58
59 /*! \fn bool operator==(const SamReadGroup& lhs, const SamReadGroup& rhs)
60     \brief tests equality by comparing read group IDs
61 */
62 API_EXPORT inline bool operator==(const SamReadGroup& lhs, const SamReadGroup& rhs) {
63     return lhs.ID == rhs.ID;
64 }
65
66 } // namespace BamTools
67
68 #endif // SAM_READGROUP_H