#include <genesis/population/format/vcf_input_stream.hpp>
Iterate an input source and parse it as a VCF/BCF file.
This simple wrapper allows easy iteration through the records/lines of a VCF/BCF file, and takes care of setting up the HtsFile, VcfHeader, and VcfRecord.
Basic usage:
auto it = VcfInputStream( infile ); while( it ) { // work with it.record() or it->... ++it; }
or
for( auto it = VcfInputStream( infile ); it; ++it ) { // work with it }
For details on working with the records/lines, see VcfRecord and VcfFormatIterator.
Definition at line 76 of file vcf_input_stream.hpp.
Public Member Functions | |
VcfInputStream ()=default | |
Create a default instance, with no input. This is also the past-the-end iterator. More... | |
VcfInputStream (self_type &&)=default | |
VcfInputStream (self_type const &)=default | |
VcfInputStream (std::string const &filename, bool expect_ordered=true) | |
Create an instance that reads from an input file name. More... | |
VcfInputStream (std::string const &filename, std::vector< std::string > const &sample_names, bool inverse_sample_names=false, bool expect_ordered=true) | |
Create an instance that reads from an input file name. More... | |
~VcfInputStream ()=default | |
std::string const & | filename () const |
bool | good () const |
VcfHeader & | header () |
VcfHeader const & | header () const |
HtsFile & | hts_file () |
HtsFile const & | hts_file () const |
operator bool () const | |
Return true iff dereferencing is valid, i.e., iff there is a VCF record available. More... | |
bool | operator!= (self_type const &other) const |
VcfRecord & | operator* () |
VcfRecord const & | operator* () const |
self_type & | operator++ () |
self_type & | operator++ (int) |
VcfRecord * | operator-> () |
VcfRecord const * | operator-> () const |
self_type & | operator= (self_type &&)=default |
self_type & | operator= (self_type const &)=default |
bool | operator== (self_type const &other) const |
VcfRecord & | record () |
VcfRecord const & | record () const |
Public Types | |
using | difference_type = std::ptrdiff_t |
using | iterator_category = std::input_iterator_tag |
using | pointer = value_type const * |
using | reference = value_type const & |
using | self_type = VcfInputStream |
using | value_type = VcfRecord |
|
default |
Create a default instance, with no input. This is also the past-the-end iterator.
|
inlineexplicit |
Create an instance that reads from an input file name.
By default, we expect the input to be ordered by chromosome and position, and throw an exception if this is not the case. Set expect_ordered
to false
to deactivate this check, and instead allow VcfRecords to appear in any order of chromosomes and positions.
Definition at line 107 of file vcf_input_stream.hpp.
|
inline |
Create an instance that reads from an input file name.
Additionally, this constructor takes a list of sample_names
which are used as filter so that only those samples (columns of the VCF records) are evaluated and accessible - or, if inverse_sample_names
is set to true
, instead all but those samples.
By default, we expect the input to be ordered by chromosome and position, and throw an exception if this is not the case. Set expect_ordered
to false
to deactivate this check, and instead allow VcfRecords to appear in any order of chromosomes and positions.
Definition at line 124 of file vcf_input_stream.hpp.
|
default |
|
default |
|
default |
|
inline |
Definition at line 174 of file vcf_input_stream.hpp.
|
inline |
Definition at line 165 of file vcf_input_stream.hpp.
|
inline |
Definition at line 202 of file vcf_input_stream.hpp.
|
inline |
Definition at line 196 of file vcf_input_stream.hpp.
|
inline |
Definition at line 190 of file vcf_input_stream.hpp.
|
inline |
Definition at line 179 of file vcf_input_stream.hpp.
|
inlineexplicit |
Return true iff dereferencing is valid, i.e., iff there is a VCF record available.
Definition at line 160 of file vcf_input_stream.hpp.
|
inline |
Definition at line 268 of file vcf_input_stream.hpp.
|
inline |
Definition at line 238 of file vcf_input_stream.hpp.
|
inline |
Definition at line 232 of file vcf_input_stream.hpp.
|
inline |
Definition at line 248 of file vcf_input_stream.hpp.
|
inline |
Definition at line 254 of file vcf_input_stream.hpp.
|
inline |
Definition at line 226 of file vcf_input_stream.hpp.
|
inline |
Definition at line 220 of file vcf_input_stream.hpp.
|
inline |
Definition at line 260 of file vcf_input_stream.hpp.
|
inline |
Definition at line 214 of file vcf_input_stream.hpp.
|
inline |
Definition at line 208 of file vcf_input_stream.hpp.
using difference_type = std::ptrdiff_t |
Definition at line 88 of file vcf_input_stream.hpp.
using iterator_category = std::input_iterator_tag |
Definition at line 89 of file vcf_input_stream.hpp.
using pointer = value_type const* |
Definition at line 86 of file vcf_input_stream.hpp.
using reference = value_type const& |
Definition at line 87 of file vcf_input_stream.hpp.
using self_type = VcfInputStream |
Definition at line 84 of file vcf_input_stream.hpp.
using value_type = VcfRecord |
Definition at line 85 of file vcf_input_stream.hpp.