A library for working with phylogenetic and population genetic data.
SamVariantInputIterator::Iterator Class Reference

#include <genesis/population/formats/sam_variant_input_iterator.hpp>

Detailed Description

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_typeoperator* ()
const value_typeoperator* () const
self_typeoperator++ ()
value_typeoperator-> ()
const value_typeoperator-> () const
Iteratoroperator= (self_type &&)=default
Iteratoroperator= (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

Constructor & Destructor Documentation

◆ ~Iterator()

~Iterator ( )

◆ Iterator() [1/2]

Iterator ( self_type const &  )

◆ Iterator() [2/2]

Iterator ( self_type &&  )

Member Function Documentation

◆ operator!=()

bool operator!= ( self_type const &  it) const

Definition at line 241 of file sam_variant_input_iterator.hpp.

◆ operator*() [1/2]

value_type& operator* ( )

Definition at line 207 of file sam_variant_input_iterator.hpp.

◆ operator*() [2/2]

const value_type& operator* ( ) const

Definition at line 202 of file sam_variant_input_iterator.hpp.

◆ operator++()

self_type& operator++ ( )

Definition at line 216 of file sam_variant_input_iterator.hpp.

◆ operator->() [1/2]

value_type* operator-> ( )

Definition at line 197 of file sam_variant_input_iterator.hpp.

◆ operator->() [2/2]

const value_type* operator-> ( ) const

Definition at line 192 of file sam_variant_input_iterator.hpp.

◆ operator=() [1/2]

Iterator& operator= ( self_type &&  )

◆ operator=() [2/2]

Iterator& operator= ( self_type const &  )

◆ operator==()

bool operator== ( self_type const &  it) const

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.

◆ rg_tags()

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.

◆ sample_size()

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.

Member Typedef Documentation

◆ iterator_category

using iterator_category = std::input_iterator_tag

Definition at line 168 of file sam_variant_input_iterator.hpp.

◆ pointer

using pointer = value_type const*

Definition at line 166 of file sam_variant_input_iterator.hpp.

◆ reference

using reference = value_type const&

Definition at line 167 of file sam_variant_input_iterator.hpp.

◆ self_type

◆ value_type

Definition at line 165 of file sam_variant_input_iterator.hpp.

Member Data Documentation

◆ SamFileHandle

friend SamFileHandle

Definition at line 186 of file sam_variant_input_iterator.hpp.

◆ SamVariantInputIterator

Definition at line 185 of file sam_variant_input_iterator.hpp.

The documentation for this class was generated from the following files: