]> git.donarmstrong.com Git - bamtools.git/blob - src/api/SamReadGroup.h
Major update to BamTools version 1.0
[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: 4 March 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 HasID(void) const;                     // returns true if read group has a group ID
32     bool HasSample(void) const;                 // returns true if read group has a sample name
33     bool HasLibrary(void) const;                // returns true if read group has a library name
34     bool HasDescription(void) const;            // returns true if read group has a description
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 HasSequencingCenter(void) const;       // returns true if read group has a sequencing center ID
38     bool HasProductionDate(void) const;         // returns true if read group has a production date
39     bool HasSequencingTechnology(void) const;   // returns true if read group has a sequencing technology ID
40
41     // data members
42     std::string ID;                   // ID:<ID>
43     std::string Sample;               // SM:<Sample>
44     std::string Library;              // LB:<Library>
45     std::string Description;          // DS:<Description>
46     std::string PlatformUnit;         // PU:<PlatformUnit>
47     std::string PredictedInsertSize;  // PI:<PredictedInsertSize>
48     std::string SequencingCenter;     // CN:<SequencingCenter>
49     std::string ProductionDate;       // DT:<ProductionDate>
50     std::string SequencingTechnology; // PL:<SequencingTechnology>
51 };
52
53 /*! \fn bool operator==(const SamReadGroup& lhs, const SamReadGroup& rhs)
54     \brief tests equality by comparing read group IDs
55 */
56 API_EXPORT inline bool operator==(const SamReadGroup& lhs, const SamReadGroup& rhs) {
57     return lhs.ID == rhs.ID;
58 }
59
60 } // namespace BamTools
61
62 #endif // SAM_READGROUP_H