1 // ***************************************************************************
2 // bamtools_pileup_engine.h (c) 2010 Derek Barnett, Erik Garrison
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 18 September 2010
6 // ---------------------------------------------------------------------------
7 // Provides pileup at position functionality for various tools.
8 // ***************************************************************************
10 #ifndef BAMTOOLS_PILEUP_ENGINE_H
11 #define BAMTOOLS_PILEUP_ENGINE_H
13 #include <api/BamAlignment.h>
14 #include <utils/utils_global.h>
19 // contains auxiliary data about a single BamAlignment
20 // at current position considered
21 struct UTILS_EXPORT PileupAlignment {
24 BamAlignment Alignment;
25 int32_t PositionInAlignment;
26 bool IsCurrentDeletion;
35 PileupAlignment(const BamAlignment& al)
37 , PositionInAlignment(-1)
38 , IsCurrentDeletion(false)
39 , IsNextDeletion(false)
40 , IsNextInsertion(false)
43 , IsSegmentBegin(false)
48 // contains all data at a position
49 struct UTILS_EXPORT PileupPosition {
54 std::vector<PileupAlignment> PileupAlignments;
57 PileupPosition(const int& refId = 0,
58 const int& position = 0,
59 const std::vector<PileupAlignment>& alignments = std::vector<PileupAlignment>())
62 , PileupAlignments(alignments)
66 class UTILS_EXPORT PileupVisitor {
69 PileupVisitor(void) { }
70 virtual ~PileupVisitor(void) { }
73 virtual void Visit(const PileupPosition& pileupData) =0;
76 class UTILS_EXPORT PileupEngine {
83 bool AddAlignment(const BamAlignment& al);
84 void AddVisitor(PileupVisitor* visitor);
88 struct PileupEnginePrivate;
89 PileupEnginePrivate* d;
92 } // namespace BamTools
94 #endif // BAMTOOLS_PILEUP_ENGINE_H