Ignore:
Timestamp:
Apr 17, 2015, 3:07:04 AM (8 years ago)
Author:
Peter
Message:

refs #817. Fix bug that struct was not updated in text(1) function (in libbam mode); add test to catch bug.

File:
1 edited

Legend:

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

    r3408 r3409  
    2525
    2626#include "yat/utility/Exception.h"
     27
     28// we need to include 'sam_header.h' when compiling against libbam
     29#ifndef YAT_HAVE_HTSLIB
     30  #if YAT_HAVE_SAM_H
     31  #include <sam_header.h>
     32  #elif YAT_HAVE_BAM_BAM_H
     33  #include <bam/sam_header.h>
     34  #elif YAT_HAVE_SAMTOOLS_SAM_H
     35  #include <samtools/sam_header.h>
     36  #else
     37  #error cannot end up here
     38  #endif
     39#endif
    2740
    2841#include <cassert>
     
    118131  }
    119132
     133
    120134  void BamHeader::text(const std::string& txt)
    121135  {
     
    130144    memcpy(header_->text, txt.c_str(), txt.size()+1);
    131145#ifndef YAT_HAVE_HTSLIB
     146    // destroy dict to ensure that things are updated during parsing
     147    if (header_->dict) {
     148      sam_header_free(header_->dict);
     149      header_->dict = 0;
     150    }
    132151    sam_header_parse(header_);
    133152#endif
Note: See TracChangeset for help on using the changeset viewer.