Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
sam_pair_iterator.h
Go to the documentation of this file.
1 #ifndef __gamgee__sam_pair_iterator__
2 #define __gamgee__sam_pair_iterator__
3 
4 #include "sam.h"
5 
6 #include "htslib/sam.h"
7 
8 #include <fstream>
9 #include <queue>
10 #include <memory>
11 
12 namespace gamgee {
13 
18  public:
19 
24 
31  SamPairIterator(samFile * sam_file_ptr, const std::shared_ptr<bam_hdr_t>& sam_header_ptr);
32 
37 
46  bool operator!=(const SamPairIterator& rhs);
47 
53  std::pair<Sam,Sam> operator*();
54 
61  std::pair<Sam,Sam> operator++();
62 
63  private:
64  using SamPtrQueue = std::queue<std::shared_ptr<bam1_t>>;
65 
66  SamPtrQueue m_supp_alignments;
67  samFile * m_sam_file_ptr;
68  const std::shared_ptr<bam_hdr_t> m_sam_header_ptr;
69  std::shared_ptr<bam1_t> m_sam_record_ptr1;
70  std::shared_ptr<bam1_t> m_sam_record_ptr2;
71  std::pair<Sam,Sam> m_sam_records;
72 
73  std::pair<Sam,Sam> fetch_next_pair();
74  bool read_sam(std::shared_ptr<bam1_t>& record_ptr);
75  Sam make_sam(std::shared_ptr<bam1_t>& record_ptr);
76  Sam next_primary_alignment(std::shared_ptr<bam1_t>& record_ptr);
77  std::pair<Sam,Sam> next_supplementary_alignment();
78 };
79 
80 } // end namespace gamgee
81 
82 #endif
std::pair< Sam, Sam > operator++()
pre-fetches the next record and tests for end of file
Definition: sam_pair_iterator.cpp:44
std::pair< Sam, Sam > operator*()
dereference operator (needed by for-each loop)
Definition: sam_pair_iterator.cpp:40
bool operator!=(const SamPairIterator &rhs)
inequality operator (needed by for-each loop)
Definition: sam_pair_iterator.cpp:49
Utility class to manipulate a Sam record.
Definition: sam.h:19
SamPairIterator()
creates an empty iterator (used for the end() method)
Definition: sam_pair_iterator.cpp:15
Utility class to enable for-each style iteration by pairs in the SamReader class. ...
Definition: sam_pair_iterator.h:17