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