Changeset 3302


Ignore:
Timestamp:
Aug 20, 2014, 8:55:24 AM (8 years ago)
Author:
Peter
Message:

add test for BamRead::end(). Use samtools' bam_calend if HAVE_BAM_CALEND is #defined. refs #810

Location:
branches/0.12-stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.12-stable/test/bam.cc

    r3222 r3302  
    120120
    121121
     122void test_end(test::Suite& suite, BamRead bam)
     123{
     124  suite.out() << "test end:\n";
     125  suite.out() << bam.pos() << "-" << bam.end() << " " << bam.cigar_str()
     126              << "\n";
     127  uint32_t end = bam.end();
     128  if (!suite.add(end==24093)) {
     129    suite.err() << "error: incorrect end: " << end << "\n";
     130  }
     131
     132  // change the cigar to include a DIFF and EQUAL
     133  utility::Aligner::Cigar cig;
     134  cig.push_back(BAM_CEQUAL, 55);
     135  cig.push_back(BAM_CDIFF, 1);
     136  cig.push_back(BAM_CEQUAL, 44);
     137  bam.cigar(cig);
     138  suite.out() << bam.pos() << "-" << bam.end() << " " << bam.cigar_str()
     139              << "\n";
     140  end = bam.end();
     141  if (!suite.add(end==24093)) {
     142    suite.err() << "error: incorrect end: " << end << "\n";
     143  }
     144}
     145
     146
    122147void test_sequence(test::Suite& suite, const BamRead& b)
    123148{
     
    234259  in.read(bam);
    235260  // test that functions are implemented
    236   bam.end();
     261  test_end(suite, bam);
    237262  bam.flag();
    238263  bam.mpos();
  • branches/0.12-stable/yat/omic/BamRead.cc

    r3300 r3302  
    112112  uint32_t BamRead::calend(const bam1_core_t *c, const uint32_t *cigar) const
    113113  {
     114#ifdef HAVE_BAM_CALEND
     115    return bam_calend(&core(), bam1_cigar(bam_));
     116#endif
    114117    int k, end = c->pos;
    115118    for (k = 0; k < c->n_cigar; ++k) {
  • branches/0.12-stable/yat/omic/BamRead.h

    r3300 r3302  
    309309    friend class OutBamFile;
    310310    friend class BamReadIterator;
    311     // FIXME guard out this
    312311    uint32_t calend(const bam1_core_t *c, const uint32_t *cigar) const;
    313312  };
Note: See TracChangeset for help on using the changeset viewer.