// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright 2009 Illumina, Inc. // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). // // /// \file /// /// \author Chris Saunders /// #ifndef __INDEL_BUFFER_HH #define __INDEL_BUFFER_HH #include "indel.hh" #include #include // holds the complete set of candidate indels in buffer // // TODO make structure more efficient by only holding right-side keys for deletions // struct indel_buffer { typedef std::map idata_t; typedef idata_t::iterator iterator; typedef idata_t::const_iterator const_iterator; // position iterators based on left-most indel position: iterator pos_iter(const pos_t pos) { return _idata.lower_bound(indel_key(pos)); } const_iterator pos_iter(const pos_t pos) const { return _idata.lower_bound(indel_key(pos)); } // position iterators which return (at least) all indels with a // left or right breakpoint in the range. // // Note: // 1) indels which encompass the range are not returned // 2) some non-intersecting indels may be returned in the // iteration range // std::pair pos_range_iter(const pos_t begin_pos, const pos_t end_pos); std::pair pos_range_iter(const pos_t begin_pos, const pos_t end_pos) const; // return NULL if no indel found: indel_data* get_indel_data(const indel_key& ik) { const iterator i(_idata.find(ik)); return ((i==_idata.end()) ? NULL : (&(i->second)) ); } const indel_data* get_indel_data(const indel_key& ik) const { const const_iterator i(_idata.find(ik)); return ((i==_idata.end()) ? NULL : (&(i->second)) ); } // returns true if this indel is novel to the buffer bool insert_indel(const indel& in); void clear_pos(const pos_t pos); // debug dumpers: void dump_pos(const pos_t pos, std::ostream& os) const; void dump(std::ostream& os) const; private: indel_key leftmost_rightkey(const indel_key& begin_range_key, const indel_key& end_range_key) const; typedef std::set rightkey_t; typedef rightkey_t::const_iterator riter; idata_t _idata; // primary indel data structure based on left-most coordinate of indel range rightkey_t _rightkey; // secondary key set sorted on deletion's right-most position }; #endif