A library for working with phylogenetic and population genetic data.
v0.32.0
VariantParallelInputStream::Iterator Class Reference

#include <genesis/population/stream/variant_parallel_input_stream.hpp>

Detailed Description

Iterator over loci of the input sources.

This is the class that does the actual work. Use the dereference operator*() and operator->() or the access functions variants() and variant_at() to get the set of variants at the current locus() of the iteration, or use joined_variant() to get one Variant that has all sample SampleCounts joined into it.

Definition at line 259 of file variant_parallel_input_stream.hpp.

Public Member Functions

 Iterator ()=default
 
 Iterator (self_type &&)=default
 
 Iterator (self_type const &)=default
 
 ~Iterator ()=default
 
VariantInputStream const & input_at (size_t index) const
 Get access to an input stream that has been added to this parallel stream. More...
 
std::vector< VariantInputStream > const & inputs () const
 Get access to the input streams that have been added to this parallel stream. More...
 
Variant joined_variant (JoinedVariantParams const &params=JoinedVariantParams{})
 Create a single Variant instance that combines all Variants from the input sources at the current locus. More...
 
GenomeLocus const & locus () const
 Return the current locus where the iteration is at. More...
 
 operator bool () const
 
bool operator!= (self_type const &it) const
 
std::vector< utils::Optional< Variant > > & operator* ()
 
const std::vector< utils::Optional< Variant > > & operator* () const
 
self_typeoperator++ ()
 
self_type operator++ (int)
 
std::vector< utils::Optional< Variant > > * operator-> ()
 
const std::vector< utils::Optional< Variant > > * operator-> () const
 
Iteratoroperator= (self_type &&)=default
 
Iteratoroperator= (self_type const &)=default
 
bool operator== (self_type const &it) const
 Compare two iterators for equality. More...
 
utils::Optional< Variant > & variant_at (size_t index)
 Return the data of the input streams at the given index at the current locus. More...
 
utils::Optional< Variant > const & variant_at (size_t index) const
 Return the data of the input streams at the given index at the current locus. More...
 
std::vector< utils::Optional< Variant > > & variants ()
 Return the data of all input streams at the current locus. More...
 
std::vector< utils::Optional< Variant > > const & variants () const
 Return the data of all input streams at the current locus. More...
 

Public Types

using iterator_category = std::input_iterator_tag
 
using pointer = value_type const *
 
using reference = value_type const &
 
using self_type = VariantParallelInputStream::Iterator
 
using value_type = std::vector< utils::Optional< Variant > >
 

Public Attributes

friend VariantParallelInputStream
 

Constructor & Destructor Documentation

◆ Iterator() [1/3]

Iterator ( )
default

◆ ~Iterator()

~Iterator ( )
default

◆ Iterator() [2/3]

Iterator ( self_type const &  )
default

◆ Iterator() [3/3]

Iterator ( self_type &&  )
default

Member Function Documentation

◆ input_at()

VariantInputStream const& input_at ( size_t  index) const
inline

Get access to an input stream that has been added to this parallel stream.

This is just a concenience function that forwards the input_at() function of VariantParallelInputStream. See there for details.

Definition at line 357 of file variant_parallel_input_stream.hpp.

◆ inputs()

std::vector<VariantInputStream> const& inputs ( ) const
inline

Get access to the input streams that have been added to this parallel stream.

This is just a concenience function that forwards the inputs() function of VariantParallelInputStream. See there for details.

Definition at line 343 of file variant_parallel_input_stream.hpp.

◆ joined_variant()

Variant joined_variant ( JoinedVariantParams const &  params = JoinedVariantParams{})

Create a single Variant instance that combines all Variants from the input sources at the current locus.

This joins all SampleCounts of all Variants of the input sources at the current locus. For sources that have no data at the current position, as many empty SampleCounts (with all zero counts) are inserted as the iterator has samples; hence, the number of SampleCounts in the Variant::samples of the returned Variant (as indicated by Variant.samples.size()) is kept consistent at each locus.

Definition at line 142 of file variant_parallel_input_stream.cpp.

◆ locus()

GenomeLocus const& locus ( ) const
inline

Return the current locus where the iteration is at.

Definition at line 401 of file variant_parallel_input_stream.hpp.

◆ operator bool()

operator bool ( ) const
inline

Definition at line 423 of file variant_parallel_input_stream.hpp.

◆ operator!=()

bool operator!= ( self_type const &  it) const
inline

Definition at line 441 of file variant_parallel_input_stream.hpp.

◆ operator*() [1/2]

std::vector<utils::Optional<Variant> >& operator* ( )
inline

Definition at line 312 of file variant_parallel_input_stream.hpp.

◆ operator*() [2/2]

const std::vector<utils::Optional<Variant> >& operator* ( ) const
inline

Definition at line 307 of file variant_parallel_input_stream.hpp.

◆ operator++() [1/2]

self_type& operator++ ( )
inline

Definition at line 410 of file variant_parallel_input_stream.hpp.

◆ operator++() [2/2]

self_type operator++ ( int  )
inline

Definition at line 416 of file variant_parallel_input_stream.hpp.

◆ operator->() [1/2]

std::vector<utils::Optional<Variant> >* operator-> ( )
inline

Definition at line 302 of file variant_parallel_input_stream.hpp.

◆ operator->() [2/2]

const std::vector<utils::Optional<Variant> >* operator-> ( ) const
inline

Definition at line 297 of file variant_parallel_input_stream.hpp.

◆ operator=() [1/2]

Iterator& operator= ( self_type &&  )
default

◆ operator=() [2/2]

Iterator& operator= ( self_type const &  )
default

◆ operator==()

bool operator== ( self_type const &  it) const
inline

Compare two iterators for equality.

Any two iterators that are created by calling begin() on the same GenericInputStream 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, no matter from which GenericInputStream they were created.

Definition at line 436 of file variant_parallel_input_stream.hpp.

◆ variant_at() [1/2]

utils::Optional<Variant>& variant_at ( size_t  index)
inline

Return the data of the input streams at the given index at the current locus.

The indexing follows the order in which inputs have been added to the VariantParallelInputStream. See also VariantParallelInputStream::input_size() to get their count.

An input source that do not have data at the current locus() has an empty optional.

Definition at line 380 of file variant_parallel_input_stream.hpp.

◆ variant_at() [2/2]

utils::Optional<Variant> const& variant_at ( size_t  index) const
inline

Return the data of the input streams at the given index at the current locus.

The indexing follows the order in which inputs have been added to the VariantParallelInputStream. See also VariantParallelInputStream::input_size() to get their count.

An input source that do not have data at the current locus() has an empty optional.

Definition at line 371 of file variant_parallel_input_stream.hpp.

◆ variants() [1/2]

std::vector<utils::Optional<Variant> >& variants ( )
inline

Return the data of all input streams at the current locus.

Any input sources that do not have data at the current locus() have an empty optional in the vector.

Definition at line 331 of file variant_parallel_input_stream.hpp.

◆ variants() [2/2]

std::vector<utils::Optional<Variant> > const& variants ( ) const
inline

Return the data of all input streams at the current locus.

Any input sources that do not have data at the current locus() have an empty optional in the vector.

Definition at line 323 of file variant_parallel_input_stream.hpp.

Member Typedef Documentation

◆ iterator_category

using iterator_category = std::input_iterator_tag

Definition at line 271 of file variant_parallel_input_stream.hpp.

◆ pointer

using pointer = value_type const*

Definition at line 269 of file variant_parallel_input_stream.hpp.

◆ reference

using reference = value_type const&

Definition at line 270 of file variant_parallel_input_stream.hpp.

◆ self_type

◆ value_type

using value_type = std::vector<utils::Optional<Variant> >

Definition at line 268 of file variant_parallel_input_stream.hpp.

Member Data Documentation

◆ VariantParallelInputStream


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