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::IndexedSamReader< ITERATOR > Class Template Reference

Utility class to read a BAM/CRAM file with an appropriate Sam iterator from an indexed file in a for-each loop. Intervals are passed in using a vector of string coordinates compatible with Samtools. When iteration begins, the iterations (re-)starts at the beginning of the first interval. More...

#include <indexed_sam_reader.h>

Public Member Functions

 IndexedSamReader (const std::string &filename, const std::vector< std::string > &interval_list)
 reads through all records in a file parsing them into Sam objects More...
 
 IndexedSamReader (IndexedSamReader &&other)=default
 iterators and readers can be moved More...
 
IndexedSamReaderoperator= (IndexedSamReader &&other)=default
 
 IndexedSamReader (const IndexedSamReader &other)=delete
 no copy construction/assignment allowed for input iterators and readers More...
 
IndexedSamReaderoperator= (IndexedSamReader &other)=delete
 
ITERATOR begin ()
 creates a ITERATOR pointing at the start of the input stream (needed by for-each loop) More...
 
ITERATOR end ()
 creates a ITERATOR with a nullified input stream (needed by for-each loop) More...
 
SamHeader header ()
 returns the header More...
 

Detailed Description

template<class ITERATOR>
class gamgee::IndexedSamReader< ITERATOR >

Utility class to read a BAM/CRAM file with an appropriate Sam iterator from an indexed file in a for-each loop. Intervals are passed in using a vector of string coordinates compatible with Samtools. When iteration begins, the iterations (re-)starts at the beginning of the first interval.

This class is designed to parse the file in for-each loops with the following signature:

for (const auto& record : IndexedSamReader<IndexedSamIterator>{filename, interval_list})
do_something_with_sam(record);

Most iterators have aliases defined by this module so you can use it like so:

for (const auto& record : IndexedSingleSamReader{filename, interval_list})
do_something_with_sam(record);

Constructor & Destructor Documentation

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

reads through all records in a file parsing them into Sam objects

Parameters
filenamethe name of the bam/cram file
interval_listSamtools style intervals to look for records
template<class ITERATOR >
gamgee::IndexedSamReader< ITERATOR >::IndexedSamReader ( IndexedSamReader< ITERATOR > &&  other)
default

iterators and readers can be moved

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

no copy construction/assignment allowed for input iterators and readers

Member Function Documentation

template<class ITERATOR >
ITERATOR gamgee::IndexedSamReader< ITERATOR >::begin ( )
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 file
template<class ITERATOR >
ITERATOR gamgee::IndexedSamReader< ITERATOR >::end ( )
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 >
SamHeader gamgee::IndexedSamReader< ITERATOR >::header ( )
inline

returns the header

Returns
the header
template<class ITERATOR >
IndexedSamReader& gamgee::IndexedSamReader< ITERATOR >::operator= ( IndexedSamReader< ITERATOR > &&  other)
default
template<class ITERATOR >
IndexedSamReader& gamgee::IndexedSamReader< ITERATOR >::operator= ( IndexedSamReader< ITERATOR > &  other)
delete


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