Changeset 3672


Ignore:
Timestamp:
Jul 31, 2017, 10:12:05 AM (6 years ago)
Author:
Peter
Message:

for convenience add constructor that creates an iterator that iterates over whole chromosome (or from start until end of chr). Same thing can be accomplished by using constructor taking 4 arguments with 4th as bf::header().target_length(tid), where bf is first arg and tid is 2nd arg.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/bam_region_iterator.cc

    r3210 r3672  
    9999  }
    100100
     101  {
     102    BamReadIterator begin(bam_stream, 1);
     103    BamReadIterator end;
     104    if (begin == end) {
     105      suite.add(false);
     106      suite.err() << "error: BamReadIterator(2): begin == end\n";
     107    }
     108  }
     109
    101110#endif
    102111}
  • trunk/yat/omic/BamReadIterator.cc

    r3362 r3672  
    5252  {
    5353    actor_ = boost::shared_ptr<Actor>(new IndexActor(bf, tid, start, end));
     54    assert(actor_);
     55    increment();
     56  }
     57
     58
     59  BamReadIterator::BamReadIterator(InBamFile& bf, int32_t tid, int32_t start)
     60  {
     61    actor_ =
     62      boost::shared_ptr<Actor>(new IndexActor(bf, tid, start,
     63                                              bf.header().target_length(tid)));
    5464    assert(actor_);
    5565    increment();
  • trunk/yat/omic/BamReadIterator.h

    r3360 r3672  
    9595     */
    9696    BamReadIterator(InBamFile& in, int32_t tid, int32_t start, int32_t end);
     97
     98    /**
     99       Iterator that walks from tid:start to end of chromosome and
     100       then it turns into an end-of-region iterator.
     101
     102       This function requires an index file is available, see
     103       InBamFile::index().
     104
     105       All reads iterated over overlap with defined region, in other
     106       words, iter->tid == \a tid; iter->end() > start
     107
     108       \param in file to iterate over
     109       \param tid segment (chromosome) to iterate over
     110       \param start left most position of specified region
     111
     112       \since New in yat 0.15
     113     */
     114    BamReadIterator(InBamFile& in, int32_t tid, int32_t start=0);
    97115  private:
    98116    friend class boost::iterator_core_access;
Note: See TracChangeset for help on using the changeset viewer.