#include <genesis/population/format/sam_variant_input_stream.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 SampleCounts samples. Use the dereference operator*()
and operator->()
to get the Variant at the current locus of the iteration.
Definition at line 157 of file sam_variant_input_stream.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 SampleCounts 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 = SamVariantInputStream::Iterator |
using | value_type = Variant |
Public Attributes | |
friend | SamFileHandle |
friend | SamVariantInputStream |
|
default |
|
inline |
Definition at line 242 of file sam_variant_input_stream.hpp.
|
inline |
Definition at line 208 of file sam_variant_input_stream.hpp.
|
inline |
Definition at line 203 of file sam_variant_input_stream.hpp.
|
inline |
Definition at line 217 of file sam_variant_input_stream.hpp.
|
inline |
Definition at line 198 of file sam_variant_input_stream.hpp.
|
inline |
Definition at line 193 of file sam_variant_input_stream.hpp.
|
inline |
Compare two iterators for equality.
Any two iterators that are created by calling begin() on the same SamVariantInputStream 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 237 of file sam_variant_input_stream.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 SampleCounts 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 SampleCounts 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 SampleCounts 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_stream.cpp.
size_t sample_size | ( | ) | const |
Return the size of the Variant::sample vector of SampleCounts that is produced by the iterator.
Definition at line 732 of file sam_variant_input_stream.cpp.
using iterator_category = std::input_iterator_tag |
Definition at line 169 of file sam_variant_input_stream.hpp.
using pointer = value_type const* |
Definition at line 167 of file sam_variant_input_stream.hpp.
using reference = value_type const& |
Definition at line 168 of file sam_variant_input_stream.hpp.
Definition at line 165 of file sam_variant_input_stream.hpp.
using value_type = Variant |
Definition at line 166 of file sam_variant_input_stream.hpp.
friend SamFileHandle |
Definition at line 187 of file sam_variant_input_stream.hpp.
friend SamVariantInputStream |
Definition at line 186 of file sam_variant_input_stream.hpp.