BamTools 2.5.2
Loading...
Searching...
No Matches
SamReadGroupDictionary.h
Go to the documentation of this file.
1// ***************************************************************************
2// SamReadGroupDictionary.h (c) 2010 Derek Barnett
3// Marth Lab, Department of Biology, Boston College
4// ---------------------------------------------------------------------------
5// Last modified: 16 October 2011 (DB)
6// ---------------------------------------------------------------------------
7// Provides methods for operating on a collection of SamReadGroup entries.
8// ***************************************************************************
9
10#ifndef SAM_READGROUP_DICTIONARY_H
11#define SAM_READGROUP_DICTIONARY_H
12
13#include <cstddef>
14#include <map>
15#include <string>
16#include <vector>
17#include "api/SamReadGroup.h"
18#include "api/api_global.h"
19
20namespace BamTools {
21
22typedef std::vector<SamReadGroup> SamReadGroupContainer;
23typedef SamReadGroupContainer::iterator SamReadGroupIterator;
24typedef SamReadGroupContainer::const_iterator SamReadGroupConstIterator;
25
26class API_EXPORT SamReadGroupDictionary
27{
28
29 // ctor & dtor
30public:
32
33 // query/modify read group data
34public:
35 // adds a read group
36 void Add(const SamReadGroup& readGroup);
37 void Add(const std::string& readGroupId);
38
39 // adds multiple read groups
40 void Add(const SamReadGroupDictionary& readGroups);
41 void Add(const std::vector<SamReadGroup>& readGroups);
42 void Add(const std::vector<std::string>& readGroupIds);
43
44 // clears all read group entries
45 void Clear();
46
47 // returns true if dictionary contains this read group
48 bool Contains(const SamReadGroup& readGroup) const;
49 bool Contains(const std::string& readGroupId) const;
50
51 // returns true if dictionary is empty
52 bool IsEmpty() const;
53
54 // removes read group, if found
55 void Remove(const SamReadGroup& readGroup);
56 void Remove(const std::string& readGroupId);
57
58 // removes multiple read groups
59 void Remove(const std::vector<SamReadGroup>& readGroups);
60 void Remove(const std::vector<std::string>& readGroupIds);
61
62 // returns number of read groups in dictionary
63 int Size() const;
64
65 // retrieves a modifiable reference to the SamReadGroup object associated with this ID
66 SamReadGroup& operator[](const std::string& readGroupId);
67
68 // retrieve STL-compatible iterators
69public:
70 SamReadGroupIterator Begin(); // returns iterator to begin()
71 SamReadGroupConstIterator Begin() const; // returns const_iterator to begin()
72 SamReadGroupConstIterator ConstBegin() const; // returns const_iterator to begin()
73 SamReadGroupIterator End(); // returns iterator to end()
74 SamReadGroupConstIterator End() const; // returns const_iterator to end()
75 SamReadGroupConstIterator ConstEnd() const; // returns const_iterator to end()
76
77 // data members
78private:
80 std::map<std::string, std::size_t> m_lookupData;
81};
82
83} // namespace BamTools
84
85#endif // SAM_READGROUP_DICTIONARY_H
Container of SamReadGroup entries.
Definition SamReadGroupDictionary.h:27
Contains all BamTools classes & methods.
Definition Sort.h:24
SamReadGroupContainer::const_iterator SamReadGroupConstIterator
Definition SamReadGroupDictionary.h:24
std::vector< SamReadGroup > SamReadGroupContainer
Definition SamReadGroupDictionary.h:22
SamReadGroupContainer::iterator SamReadGroupIterator
Definition SamReadGroupDictionary.h:23
Represents a SAM read group entry.
Definition SamReadGroup.h:21