#include <genesis/population/formats/sam_variant_input_iterator.hpp>
Iterator over loci of the input sources.
This is the class that does the actual work of turning the underlying file data into our Variant and BaseCounts samples. Use the dereference operator*()
and operator->()
to get the Variant at the current locus of the iteration.
Definition at line 156 of file sam_variant_input_iterator.hpp.
Public Member Functions | |
Iterator (self_type &&)=default | |
Iterator (self_type const &)=default | |
~Iterator ()=default | |
bool | operator!= (self_type const &it) const |
value_type & | operator* () |
const value_type & | operator* () const |
self_type & | operator++ () |
value_type * | operator-> () |
const value_type * | operator-> () const |
Iterator & | operator= (self_type &&)=default |
Iterator & | operator= (self_type const &)=default |
bool | operator== (self_type const &it) const |
Compare two iterators for equality. More... | |
std::vector< std::string > | rg_tags (bool all_header_tags=false) const |
Get the list of read group RG tags as used in the iteration, or as found in the SAM/BAM/CRAM file. More... | |
size_t | sample_size () const |
Return the size of the Variant::sample vector of BaseCounts that is produced by the iterator. More... | |
Public Types | |
using | iterator_category = std::input_iterator_tag |
using | pointer = value_type const * |
using | reference = value_type const & |
using | self_type = SamVariantInputIterator::Iterator |
using | value_type = Variant |
Public Attributes | |
friend | SamFileHandle |
friend | SamVariantInputIterator |
|
default |
|
inline |
Definition at line 241 of file sam_variant_input_iterator.hpp.
|
inline |
Definition at line 207 of file sam_variant_input_iterator.hpp.
|
inline |
Definition at line 202 of file sam_variant_input_iterator.hpp.
|
inline |
Definition at line 216 of file sam_variant_input_iterator.hpp.
|
inline |
Definition at line 197 of file sam_variant_input_iterator.hpp.
|
inline |
Definition at line 192 of file sam_variant_input_iterator.hpp.
|
inline |
Compare two iterators for equality.
Any two iterators that are created by calling begin() on the same SamVariantInputIterator instance will compare equal, as long as neither of them is past-the-end. A valid (not past-the-end) iterator and an end() iterator will not compare equal.
Definition at line 236 of file sam_variant_input_iterator.hpp.
std::vector< std::string > rg_tags | ( | bool | all_header_tags = false | ) | const |
Get the list of read group RG
tags as used in the iteration, or as found in the SAM/BAM/CRAM file.
This function is useful when split_by_rg() is set to true
, so that the reads are split by their read group tags. The function then returns the RG read group tag names, in the same order that the BaseCounts objects are stored in the resulting Variant of this iterator.
When additionally with_unaccounted_rg() is set to true
, an additional RG tag "unaccounted" is added to the result as a last element, which is the same position that the unaccounted reads go in the Variant.
When using rg_tag_filter() to sub-set the RG tags (samples) being processed, this function by default only returnes those sample names (RG tags) that represent the final BaseCounts samples of the resulting Variant when iterating the data (and potentially including the "unaccounted" group).
If split_by_rg() is false
, we are not splitting by read group tags, so then this function returns an empty vector. Note that the Variant that is produced during iteration still contains one BaseCounts sample, which collects all counts from all reads.
All of the above is ignored if the argument all_header_tags
is set to true
. In that case, the function instead simply returns those RG tags that are present in the SAM/BAM/CRAM header, without the "unaccounted", and without any filtering. Note that in this case, this function needs to fill the vector when called. Hence, if this list is needed often, it is recommended to call this function once and store the result.
Definition at line 698 of file sam_variant_input_iterator.cpp.
size_t sample_size | ( | ) | const |
Return the size of the Variant::sample vector of BaseCounts that is produced by the iterator.
Definition at line 732 of file sam_variant_input_iterator.cpp.
using iterator_category = std::input_iterator_tag |
Definition at line 168 of file sam_variant_input_iterator.hpp.
using pointer = value_type const* |
Definition at line 166 of file sam_variant_input_iterator.hpp.
using reference = value_type const& |
Definition at line 167 of file sam_variant_input_iterator.hpp.
Definition at line 164 of file sam_variant_input_iterator.hpp.
using value_type = Variant |
Definition at line 165 of file sam_variant_input_iterator.hpp.
friend SamFileHandle |
Definition at line 186 of file sam_variant_input_iterator.hpp.
friend SamVariantInputIterator |
Definition at line 185 of file sam_variant_input_iterator.hpp.