All Classes Namespaces Functions Pages
halColumnIterator.h
/*
* Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu)
*
* Released under the MIT license, see LICENSE.txt
*/
#ifndef _HALCOLUMNITERATOR_H
#define _HALCOLUMNITERATOR_H
#include <list>
#include <map>
#include <set>
#include "halDefs.h"
#include "halDNAIterator.h"
#include "halSequence.h"
namespace hal {
class ColumnIterator
{
public:
// we can compare genomes by pointers (because they are persistent
// and unique, though it's still hacky) but we can't do the same
// for anything else, including sequences.
struct SequenceLess { bool operator()(const hal::Sequence* s1,
const hal::Sequence* s2) const {
return s1->getGenome() < s2->getGenome() || (
s1->getGenome() == s2->getGenome() &&
s1->getStartPosition() < s2->getStartPosition()); }
};
typedef std::vector<hal::DNAIteratorConstPtr> DNASet;
typedef std::map<const hal::Sequence*, DNASet*, SequenceLess> ColumnMap;
virtual void toRight() const = 0;
virtual void toSite(hal_index_t columnIndex,
hal_index_t lastIndex,
bool clearCache = false) const = 0;
virtual bool lastColumn() const = 0;
virtual const hal::Genome* getReferenceGenome() const = 0;
virtual const hal::Sequence* getReferenceSequence() const = 0;
virtual hal_index_t getReferenceSequencePosition() const = 0;
virtual const ColumnMap* getColumnMap() const = 0;
virtual hal_index_t getArrayIndex() const = 0;
virtual void defragment() const = 0;
virtual bool isCanonicalOnRef() const = 0;
virtual void print(std::ostream& os) const = 0;
protected:
friend class counted_ptr<ColumnIterator>;
friend class counted_ptr<const ColumnIterator>;
virtual ~ColumnIterator() = 0;
};
inline ColumnIterator::~ColumnIterator() {}
inline std::ostream& operator<<(std::ostream& os, const ColumnIterator& cit)
{
cit.print(os);
return os;
}
}
#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