Changeset 3352


Ignore:
Timestamp:
Nov 22, 2014, 12:16:53 AM (8 years ago)
Author:
Peter
Message:

implement BamHeader? against htslib, except parse region which requires more love. refs #394

Location:
trunk/yat/omic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/omic/BamHeader.cc

    r3144 r3352  
    4444  {
    4545    assert(header_);
     46#if YAT_HAVE_HTSLIB
     47    assert(0 && "FIXME: parse_region not implement against htslib");
     48#else
    4649    if (!bam_parse_region(header_, reg.c_str(), &tid, &begin, &end))
    4750      return;
     51#endif
    4852    std::ostringstream ss;
    4953    ss << "invalid region: '" << reg << "'";
     
    6872  int32_t BamHeader::tid(const std::string& name) const
    6973  {
     74#if YAT_HAVE_HTSLIB
     75    return bam_name2id(header_, name.c_str());
     76#else
    7077    if (!header_->hash) {
    7178      // We would like to call something like bam_init_header_hash,
     
    8188    }
    8289    return bam_get_tid(header_, name.c_str());
     90#endif
    8391  }
    8492
  • trunk/yat/omic/BamHeader.h

    r3350 r3352  
    3434
    3535  /**
    36      \brief Wrapper around bam_header_t struct.
     36     \brief Wrapper around bam_hdr_t struct.
    3737
    3838     Class is typically created via InBamFile::header().
     
    9393    int32_t n_targets(void) const;
    9494  private:
    95     bam_header_t* header_;
     95#ifndef YAT_HAVE_HTSLIB
     96    typedef bam_header_t bam_hdr_t;
     97#endif
     98    bam_hdr_t* header_;
    9699
    97100    friend class InBamFile;
    98101    friend class OutBamFile;
    99     BamHeader(bam_header_t* h);
    100102
    101103    // using compiler generated copy and assignment
Note: See TracChangeset for help on using the changeset viewer.