Changeset 3028


Ignore:
Timestamp:
Apr 21, 2013, 2:37:31 AM (10 years ago)
Author:
Peter
Message:

functions to access, append, and remove aux field. refs #746

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/bam.cc

    r3026 r3028  
    5151#ifdef HAVE_LIBBAM
    5252using namespace omic;
     53
     54void test_aux(test::Suite& suite, const BamRead& b)
     55{
     56  suite.out() << "test aux\n";
     57  BamRead bam(b);
     58
     59  char c = 'h';
     60  int size = bam.aux_size();
     61  bam.aux_append("ZZ", 'A', 1, (uint8_t*)(&c));
     62  suite.out() << "size: " << size << " " << bam.aux_size() << "\n";
     63  suite.add(bam.aux_size() == size+4);
     64  bam.aux("ZZ");
     65  char c1 = bam_aux2A(bam.aux("ZZ"));
     66  suite.out() << c << "==" << c1 << "\n";
     67  suite.add(c==c1);
     68  bam.aux_del("ZZ");
     69  if (!suite.add(bam.aux_size() == size))
     70    suite.err() << "error: incorrect size: " << bam.aux_size() << "\n";
     71}
     72
    5373
    5474void test_cigar(test::Suite& suite, const BamRead& b, const BamHeader& hdr)
     
    144164  }
    145165  test_cigar(suite, bam, in.header());
     166  test_aux(suite, bam);
    146167}
    147168#endif
  • trunk/yat/omic/BamRead.cc

    r3026 r3028  
    1 
    21// $Id$
    32
     
    7069  const uint8_t* BamRead::aux(void) const
    7170  {
     71    assert(bam_);
    7272    return bam1_aux(bam_);
     73  }
     74
     75
     76  const uint8_t* BamRead::aux(const char tag[2]) const
     77  {
     78    assert(bam_);
     79    return bam_aux_get(bam_, tag);
     80  }
     81
     82
     83  void BamRead::aux_append(const char tag[2], char type,int len,uint8_t* data)
     84  {
     85    assert(bam_);
     86    bam_aux_append(bam_, tag, type, len, data);
     87  }
     88
     89
     90  void BamRead::aux_del(const char tag[2])
     91  {
     92    assert(bam_);
     93    bam_aux_del(bam_, bam_aux_get(bam_, tag));
     94  }
     95
     96
     97  int BamRead::aux_size(void) const
     98  {
     99    assert(bam_);
     100    return bam_->l_aux;
    73101  }
    74102
  • trunk/yat/omic/BamRead.h

    r3026 r3028  
    118118
    119119    /**
     120       \since New in yat 0.11
     121     */
     122    const uint8_t* aux(const char tag[2]) const;
     123
     124    /**
     125       \since New in yat 0.11
     126     */
     127    void aux(const char tag[2], char type, int len, uint8_t* data);
     128
     129    /**
     130       \since New in yat 0.11
     131     */
     132    void aux_append(const char tag[2], char type, int len, uint8_t* data);
     133
     134    /**
     135       \since New in yat 0.11
     136     */
     137    void aux_del(const char tag[2]);
     138
     139    /**
     140       \since New in yat 0.11
     141     */
     142    int aux_size(void) const;
     143
     144    /**
    120145       \brief access core data struct
    121146
Note: See TracChangeset for help on using the changeset viewer.