|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_POPULATION_FORMAT_SYNC_INPUT_STREAM_H_
2 #define GENESIS_POPULATION_FORMAT_SYNC_INPUT_STREAM_H_
41 namespace population {
104 std::shared_ptr< utils::BaseInputSource > source,
107 : input_stream_( std::make_shared<utils::InputStream>( source ))
115 sample_names_ = reader_.
read_header( *input_stream_ );
116 sample_size_ = sample_names_.size();
128 std::shared_ptr< utils::BaseInputSource > source,
129 std::vector<bool>
const& sample_filter,
132 : input_stream_( std::make_shared<utils::InputStream>( source ))
134 , sample_filter_( sample_filter )
135 , use_sample_filter_(
true )
138 sample_names_ = reader_.
read_header( *input_stream_, sample_filter_ );
139 sample_size_ = sample_names_.size();
158 explicit operator bool()
const
174 return sample_names_;
241 variant_.
samples.resize( sample_size_ );
242 if( use_sample_filter_ ) {
243 good_ = reader_.
parse_line( *input_stream_, variant_, sample_filter_ );
245 good_ = reader_.
parse_line( *input_stream_, variant_ );
247 sample_size_ = variant_.
samples.size();
252 return good_ == it.good_;
257 return !(*
this == it);
268 std::shared_ptr<utils::InputStream> input_stream_;
272 std::vector<std::string> sample_names_;
273 size_t sample_size_ = 0;
277 std::vector<bool> sample_filter_;
278 bool use_sample_filter_ =
false;
284 #endif // include guard
bool parse_line(utils::InputStream &input_stream, Variant &sample_set) const
Read a single line into the provided Variant.
A single variant at a position in a chromosome, along with SampleCounts for a set of samples.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::vector< std::string > read_header(utils::InputStream &input_stream) const
Read the header line, if there is one. Do nothing if there is not.
std::vector< SampleCounts > samples
Reader for PoPoolation2's "synchronized" files.