#include <genesis/population/formats/variant_parallel_input_iterator.hpp>
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 BaseCounts joined into it.
Definition at line 205 of file variant_parallel_input_iterator.hpp.
Public Member Functions | |
Iterator (self_type &&)=default | |
Iterator (self_type const &)=default | |
~Iterator ()=default | |
VariantInputIterator const & | input_at (size_t index) const |
Get access to an input iterator that has been added to this parallel iterator. More... | |
std::vector< VariantInputIterator > const & | inputs () const |
Get access to the input iterators that have been added to this parallel iterator. More... | |
Variant | joined_variant (bool allow_ref_base_mismatches=false, bool allow_alt_base_mismatches=true, bool move_samples=false) |
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_type & | operator++ () |
self_type | operator++ (int) |
std::vector< utils::Optional< Variant > > * | operator-> () |
const std::vector< utils::Optional< Variant > > * | 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... | |
utils::Optional< Variant > & | variant_at (size_t index) |
Return the data of the input iterators 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 iterators at the given index at the current locus. More... | |
std::vector< utils::Optional< Variant > > & | variants () |
Return the data of all input iterators at the current locus. More... | |
std::vector< utils::Optional< Variant > > const & | variants () const |
Return the data of all input iterators 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 = VariantParallelInputIterator::Iterator |
using | value_type = std::vector< utils::Optional< Variant > > |
Public Attributes | |
friend | VariantParallelInputIterator |
|
default |
|
inline |
Get access to an input iterator that has been added to this parallel iterator.
This is just a concenience function that forwards the input_at() function of VariantParallelInputIterator. See there for details.
Definition at line 300 of file variant_parallel_input_iterator.hpp.
|
inline |
Get access to the input iterators that have been added to this parallel iterator.
This is just a concenience function that forwards the inputs() function of VariantParallelInputIterator. See there for details.
Definition at line 286 of file variant_parallel_input_iterator.hpp.
Variant joined_variant | ( | bool | allow_ref_base_mismatches = false , |
bool | allow_alt_base_mismatches = true , |
||
bool | move_samples = false |
||
) |
Create a single Variant instance that combines all Variants from the input sources at the current locus.
This joins all BaseCounts of all Variants of the input sources at the current locus. For sources that have no data at the current position, as many empty BaseCounts (with all zero counts) are inserted as the iterator has samples; hence, the number of BaseCounts in the Variant::samples of the returned Variant (as indicated by Variant.samples.size()) is kept consistent at each locus.
By default, we expect that the Variants of each iterator have the same Variant::reference_base; if not, the function throws an exception. For the Variant::alternative_base, by default we allow different bases, as not every file format contains alternative bases, meaning that it might be set to ‘'N’` instead of the actual value in those file formats. To change the default behaviour, use allow_ref_base_mismatches
and/or allow_alt_base_mismatches
as needed. When a mismatch is allowed, in cases of a mismatch, the returned Variant will contain an ‘'N’` as the base.
Lastly, by default, we copy the BaseCounts of all Variant::samples into the resulting Variant. If however these are not needed at the current iterator position any more (that is, if this iterator is not dereferenced or the variants() function is not called) after calling this function, we can instead move them, for efficiency.
Definition at line 125 of file variant_parallel_input_iterator.cpp.
|
inline |
Return the current locus where the iteration is at.
Definition at line 362 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 384 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 402 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 255 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 250 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 371 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 377 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 245 of file variant_parallel_input_iterator.hpp.
|
inline |
Definition at line 240 of file variant_parallel_input_iterator.hpp.
|
inline |
Compare two iterators for equality.
Any two iterators that are created by calling begin() on the same LambdaIterator 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 LambdaIterator they were created.
Definition at line 397 of file variant_parallel_input_iterator.hpp.
|
inline |
Return the data of the input iterators at the given index
at the current locus.
The indexing follows the order in which inputs have been added to the VariantParallelInputIterator. See also VariantParallelInputIterator::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 323 of file variant_parallel_input_iterator.hpp.
|
inline |
Return the data of the input iterators at the given index
at the current locus.
The indexing follows the order in which inputs have been added to the VariantParallelInputIterator. See also VariantParallelInputIterator::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 314 of file variant_parallel_input_iterator.hpp.
|
inline |
Return the data of all input iterators 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 274 of file variant_parallel_input_iterator.hpp.
|
inline |
Return the data of all input iterators 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 266 of file variant_parallel_input_iterator.hpp.
using iterator_category = std::input_iterator_tag |
Definition at line 217 of file variant_parallel_input_iterator.hpp.
using pointer = value_type const* |
Definition at line 215 of file variant_parallel_input_iterator.hpp.
using reference = value_type const& |
Definition at line 216 of file variant_parallel_input_iterator.hpp.
Definition at line 213 of file variant_parallel_input_iterator.hpp.
using value_type = std::vector<utils::Optional<Variant> > |
Definition at line 214 of file variant_parallel_input_iterator.hpp.
friend VariantParallelInputIterator |
Definition at line 234 of file variant_parallel_input_iterator.hpp.