Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
gamgee::SyncedVariantReader< ITERATOR > Class Template Reference

Utility class to read multiple VCF.GZ/BCF files with an appropriate iterator in a for-each loop. More...

#include <synced_variant_reader.h>

Public Member Functions

 SyncedVariantReader (const std::vector< std::string > &filenames, const std::string &interval_list)
 opens multiple files (vcf or bcf) and allows an iterator to parse them More...
 
 SyncedVariantReader (SyncedVariantReader &&other)=default
 a SyncedVariantReader should never be copied, but it can be moved around More...
 
SyncedVariantReaderoperator= (SyncedVariantReader &&other)=default
 
 SyncedVariantReader (const SyncedVariantReader &)=delete
 a SyncedVariantReader cannot be copied safely, as it is iterating over streams. More...
 
SyncedVariantReaderoperator= (const SyncedVariantReader &)=delete
 
ITERATOR begin () const
 creates a ITERATOR pointing at the start of the input stream (needed by for-each loop) More...
 
ITERATOR end () const
 creates a ITERATOR with a nullified input stream (needed by for-each loop) More...
 

Detailed Description

template<class ITERATOR>
class gamgee::SyncedVariantReader< ITERATOR >

Utility class to read multiple VCF.GZ/BCF files with an appropriate iterator in a for-each loop.

Note
This reader requires all input files to be indexed
Output vectors have the same size and the same order as the input filename vector, but not all files will have a variant at every location, so it's necessary to check using missing()

This class is designed to parse the files in for-each loops with the following signatures:

over whole files:

for (auto& record : SyncedVariantReader<SyncedVariantIterator>{filenames, ""})
if (!missing(record))
do_something_with_record(record);

over intervals:

for (auto& record : SyncedVariantReader<SyncedVariantIterator>{filenames, interval_string})
if (!missing(record))
do_something_with_record(record);

Constructor & Destructor Documentation

template<class ITERATOR >
gamgee::SyncedVariantReader< ITERATOR >::SyncedVariantReader ( const std::vector< std::string > &  filenames,
const std::string &  interval_list 
)
inline

opens multiple files (vcf or bcf) and allows an iterator to parse them

Parameters
filenamesthe names of the variant files
interval_lista comma-separated string of the intervals to traverse. Empty string for all intervals.
Exceptions
willthrow std::runtime_error if the htslib structure cannot be initialized
template<class ITERATOR >
gamgee::SyncedVariantReader< ITERATOR >::SyncedVariantReader ( SyncedVariantReader< ITERATOR > &&  other)
default

a SyncedVariantReader should never be copied, but it can be moved around

template<class ITERATOR >
gamgee::SyncedVariantReader< ITERATOR >::SyncedVariantReader ( const SyncedVariantReader< ITERATOR > &  )
delete

a SyncedVariantReader cannot be copied safely, as it is iterating over streams.

Member Function Documentation

template<class ITERATOR >
ITERATOR gamgee::SyncedVariantReader< ITERATOR >::begin ( ) const
inline

creates a ITERATOR pointing at the start of the input stream (needed by for-each loop)

Returns
a ITERATOR ready to start parsing the files
template<class ITERATOR >
ITERATOR gamgee::SyncedVariantReader< ITERATOR >::end ( ) const
inline

creates a ITERATOR with a nullified input stream (needed by for-each loop)

Returns
a ITERATOR that will match the end status of the iterator at the end of the stream
template<class ITERATOR >
SyncedVariantReader& gamgee::SyncedVariantReader< ITERATOR >::operator= ( SyncedVariantReader< ITERATOR > &&  other)
default
template<class ITERATOR >
SyncedVariantReader& gamgee::SyncedVariantReader< ITERATOR >::operator= ( const SyncedVariantReader< ITERATOR > &  )
delete

The documentation for this class was generated from the following file: