1 #ifndef GENESIS_POPULATION_WINDOW_POSITION_WINDOW_STREAM_H_
2 #define GENESIS_POPULATION_WINDOW_POSITION_WINDOW_STREAM_H_
44 #include <type_traits>
45 #include <unordered_set>
49 namespace population {
85 template<
class InputStreamIterator,
class DataType =
typename InputStreamIterator::value_type>
99 using InputType =
typename InputStreamIterator::value_type;
145 using InputType =
typename InputStreamIterator::value_type;
171 throw std::runtime_error(
172 "Need to set BaseWindowStream::entry_selection_function "
173 "before iterating over Windows with a PositionWindowStream."
199 void increment_() override final
209 base_iterator_type::current_ != base_iterator_type::end_ &&
212 ++base_iterator_type::current_;
216 if( base_iterator_type::current_ == base_iterator_type::end_ ) {
220 assert( base_iterator_type::current_ != base_iterator_type::end_ );
225 auto const cur_pos = parent_->
position_function( *base_iterator_type::current_ );
229 base_iterator_type::is_first_window_ = ( cur_chr != window_.
chromosome() );
239 window_.
entries().emplace_back(
250 ++base_iterator_type::current_;
252 base_iterator_type::current_ != base_iterator_type::end_ &&
255 ++base_iterator_type::current_;
260 base_iterator_type::is_last_window_ = (
261 base_iterator_type::current_ == base_iterator_type::end_ ||
266 value_type& get_current_window_() const override final
271 base_type const* get_parent_() const override final
283 size_t next_index_ = 0;
296 InputStreamIterator
begin, InputStreamIterator
end
317 std::unique_ptr<typename base_type::BaseIterator>
326 std::unique_ptr<typename base_type::BaseIterator>
329 return std::unique_ptr<DerivedIterator>(
new DerivedIterator(
nullptr ));
343 template<
class InputStreamIterator,
class DataType =
typename InputStreamIterator::value_type>
344 PositionWindowStream<InputStreamIterator, DataType>
346 InputStreamIterator begin, InputStreamIterator end
371 template<
class InputStreamIterator>
372 PositionWindowStream<InputStreamIterator>
374 InputStreamIterator begin, InputStreamIterator end
376 using DataType =
typename InputStreamIterator::value_type;
380 it.entry_input_function = []( DataType
const& variant ) {
383 it.chromosome_function = []( DataType
const& variant ) {
384 return variant.chromosome;
386 it.position_function = []( DataType
const& variant ) {
387 return variant.position;
389 it.entry_selection_function = []( DataType
const& variant ) {
408 template<
class InputStreamIterator>
409 WindowViewStream<InputStreamIterator>
411 InputStreamIterator begin, InputStreamIterator end
431 template<
class InputStreamIterator>
432 PositionWindowStream<InputStreamIterator>
434 InputStreamIterator begin, InputStreamIterator end
436 using DataType =
typename InputStreamIterator::value_type;
440 it.entry_input_function = []( DataType
const& variant ) {
443 it.chromosome_function = []( DataType
const& variant ) {
444 return variant.chromosome;
446 it.position_function = []( DataType
const& variant ) {
447 return variant.position;
449 it.entry_selection_function = []( DataType
const& variant ) {
450 return variant.status.passing();
467 template<
class InputStreamIterator>
468 WindowViewStream<InputStreamIterator>
470 InputStreamIterator begin, InputStreamIterator end
480 #endif // include guard