Loading...
Searching...
No Matches
SamReadGroupDictionary.h
Go to the documentation of this file.
// ***************************************************************************
// SamReadGroupDictionary.h (c) 2010 Derek Barnett
// Marth Lab, Department of Biology, Boston College
// ---------------------------------------------------------------------------
// Last modified: 16 October 2011 (DB)
// ---------------------------------------------------------------------------
// Provides methods for operating on a collection of SamReadGroup entries.
// ***************************************************************************
#ifndef SAM_READGROUP_DICTIONARY_H
#define SAM_READGROUP_DICTIONARY_H
#include <cstddef>
#include <map>
#include <string>
#include <vector>
#include "api/SamReadGroup.h"
#include "api/api_global.h"
namespace BamTools {
typedef std::vector<SamReadGroup> SamReadGroupContainer;
typedef SamReadGroupContainer::iterator SamReadGroupIterator;
typedef SamReadGroupContainer::const_iterator SamReadGroupConstIterator;
class API_EXPORT SamReadGroupDictionary
{
// ctor & dtor
public:
SamReadGroupDictionary();
// query/modify read group data
public:
// adds a read group
void Add(const SamReadGroup& readGroup);
void Add(const std::string& readGroupId);
// adds multiple read groups
void Add(const SamReadGroupDictionary& readGroups);
void Add(const std::vector<SamReadGroup>& readGroups);
void Add(const std::vector<std::string>& readGroupIds);
// clears all read group entries
void Clear();
// returns true if dictionary contains this read group
bool Contains(const SamReadGroup& readGroup) const;
bool Contains(const std::string& readGroupId) const;
// returns true if dictionary is empty
bool IsEmpty() const;
// removes read group, if found
void Remove(const SamReadGroup& readGroup);
void Remove(const std::string& readGroupId);
// removes multiple read groups
void Remove(const std::vector<SamReadGroup>& readGroups);
void Remove(const std::vector<std::string>& readGroupIds);
// returns number of read groups in dictionary
int Size() const;
// retrieves a modifiable reference to the SamReadGroup object associated with this ID
SamReadGroup& operator[](const std::string& readGroupId);
// retrieve STL-compatible iterators
public:
SamReadGroupIterator Begin(); // returns iterator to begin()
SamReadGroupConstIterator Begin() const; // returns const_iterator to begin()
SamReadGroupConstIterator ConstBegin() const; // returns const_iterator to begin()
SamReadGroupIterator End(); // returns iterator to end()
SamReadGroupConstIterator End() const; // returns const_iterator to end()
SamReadGroupConstIterator ConstEnd() const; // returns const_iterator to end()
// data members
private:
SamReadGroupContainer m_data;
std::map<std::string, std::size_t> m_lookupData;
};
} // namespace BamTools
#endif // SAM_READGROUP_DICTIONARY_H
SamReadGroup.h
api_global.h
BamTools::SamReadGroupDictionary::operator[]
SamReadGroup & operator[](const std::string &readGroupId)
Retrieves the modifiable SamReadGroup that matches readGroupId.
Definition SamReadGroupDictionary.cpp:300
BamTools::SamReadGroupDictionary::Clear
void Clear()
Clears all read group entries.
Definition SamReadGroupDictionary.cpp:130
BamTools::SamReadGroupDictionary::Begin
SamReadGroupIterator Begin()
Definition SamReadGroupDictionary.cpp:110
BamTools::SamReadGroupDictionary::ConstBegin
SamReadGroupConstIterator ConstBegin() const
Definition SamReadGroupDictionary.cpp:140
BamTools::SamReadGroupDictionary::ConstEnd
SamReadGroupConstIterator ConstEnd() const
Definition SamReadGroupDictionary.cpp:149
BamTools::SamReadGroupDictionary::IsEmpty
bool IsEmpty() const
Returns true if dictionary contains no read groups.
Definition SamReadGroupDictionary.cpp:203
BamTools::SamReadGroupDictionary::Contains
bool Contains(const SamReadGroup &readGroup) const
Returns true if dictionary contains read group (matching on ID).
Definition SamReadGroupDictionary.cpp:173
BamTools::SamReadGroupDictionary::End
SamReadGroupIterator End()
Definition SamReadGroupDictionary.cpp:182
BamTools::SamReadGroupDictionary::Remove
void Remove(const SamReadGroup &readGroup)
Removes read group from dictionary, if found (matching on ID).
Definition SamReadGroupDictionary.cpp:215
BamTools::SamReadGroupDictionary::Size
int Size() const
Returns number of read groups in dictionary.
Definition SamReadGroupDictionary.cpp:285
BamTools::SamReadGroupDictionary::SamReadGroupDictionary
SamReadGroupDictionary()
constructor
Definition SamReadGroupDictionary.cpp:25
BamTools::SamReadGroupDictionary::Add
void Add(const SamReadGroup &readGroup)
Appends a read group to the dictionary.
Definition SamReadGroupDictionary.cpp:34
BamTools
Contains all BamTools classes & methods.
Definition Sort.h:24
BamTools::SamReadGroupConstIterator
SamReadGroupContainer::const_iterator SamReadGroupConstIterator
Definition SamReadGroupDictionary.h:24
BamTools::SamReadGroupContainer
std::vector< SamReadGroup > SamReadGroupContainer
Definition SamReadGroupDictionary.h:22
BamTools::SamReadGroupIterator
SamReadGroupContainer::iterator SamReadGroupIterator
Definition SamReadGroupDictionary.h:23
BamTools::SamReadGroup
Represents a SAM read group entry.
Definition SamReadGroup.h:21