halapi hierarchichalalignmentformatapi

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Pages
halColumnIterator.h
1 /*
2 * Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
3 *
4 * Released under the MIT license, see LICENSE.txt
5 */
6
7 #ifndef _HALCOLUMNITERATOR_H
8 #define _HALCOLUMNITERATOR_H
9
10 #include <list>
11 #include <map>
12 #include <set>
13 #include "halDefs.h"
14 #include "halDNAIterator.h"
15 #include "halSequence.h"
16
17 namespace hal {
18
26 class ColumnIterator
27 {
28 public:
29
31 // we can compare genomes by pointers (because they are persistent
32 // and unique, though it's still hacky) but we can't do the same
33 // for anything else, including sequences.
34 struct SequenceLess { bool operator()(const hal::Sequence* s1,
35 const hal::Sequence* s2) const {
36 return s1->getGenome() < s2->getGenome() || (
37 s1->getGenome() == s2->getGenome() &&
38 s1->getStartPosition() < s2->getStartPosition()); }
39 };
41
42 typedef std::vector<hal::DNAIteratorConstPtr> DNASet;
43 typedef std::map<const hal::Sequence*, DNASet*, SequenceLess> ColumnMap;
44
47 virtual void toRight() const = 0;
48
58 virtual void toSite(hal_index_t columnIndex,
59 hal_index_t lastIndex,
60 bool clearCache = false) const = 0;
61
65 virtual bool lastColumn() const = 0;
66
68 virtual const hal::Genome* getReferenceGenome() const = 0;
69
71 virtual const hal::Sequence* getReferenceSequence() const = 0;
72
77 virtual hal_index_t getReferenceSequencePosition() const = 0;
78
80 virtual const ColumnMap* getColumnMap() const = 0;
81
83 virtual hal_index_t getArrayIndex() const = 0;
84
93 virtual void defragment() const = 0;
94
100 virtual bool isCanonicalOnRef() const = 0;
101
103 virtual void print(std::ostream& os) const = 0;
104
105 protected:
106 friend class counted_ptr<ColumnIterator>;
107 friend class counted_ptr<const ColumnIterator>;
108 virtual ~ColumnIterator() = 0;
109 };
110
111 inline ColumnIterator::~ColumnIterator() {}
112
113 inline std::ostream& operator<<(std::ostream& os, const ColumnIterator& cit)
114 {
115 cit.print(os);
116 return os;
117 }
118
119 }
120
121
122 #endif
hal::ColumnIterator::lastColumn
virtual bool lastColumn() const =0
hal::Sequence::getGenome
virtual const Genome * getGenome() const =0
hal::Genome
Definition: halGenome.h:24
hal::Sequence::getStartPosition
virtual hal_index_t getStartPosition() const =0
hal::ColumnIterator::isCanonicalOnRef
virtual bool isCanonicalOnRef() const =0
hal::ColumnIterator::defragment
virtual void defragment() const =0
hal::ColumnIterator
Definition: halColumnIterator.h:26
hal::ColumnIterator::getReferenceGenome
virtual const hal::Genome * getReferenceGenome() const =0
hal::ColumnIterator::print
virtual void print(std::ostream &os) const =0
hal::ColumnIterator::getReferenceSequencePosition
virtual hal_index_t getReferenceSequencePosition() const =0
hal::ColumnIterator::getColumnMap
virtual const ColumnMap * getColumnMap() const =0
hal::ColumnIterator::getArrayIndex
virtual hal_index_t getArrayIndex() const =0
hal::ColumnIterator::toRight
virtual void toRight() const =0
hal::Sequence
Definition: halSequence.h:20
hal::ColumnIterator::getReferenceSequence
virtual const hal::Sequence * getReferenceSequence() const =0
hal::ColumnIterator::toSite
virtual void toSite(hal_index_t columnIndex, hal_index_t lastIndex, bool clearCache=false) const =0