Changeset 3029


Ignore:
Timestamp:
Apr 21, 2013, 3:04:41 AM (9 years ago)
Author:
Peter
Message:

refs #746. Add docs and throw in aux_del if tag is absent (rather than undefined behaviour)

Location:
trunk/yat/omic
Files:
2 edited

Legend:

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

    r3028 r3029  
    2626
    2727#include YAT_BAM_HEADER
     28
     29#include "yat/utility/Exception.h"
    2830
    2931#include <algorithm>
     
    9193  {
    9294    assert(bam_);
    93     bam_aux_del(bam_, bam_aux_get(bam_, tag));
     95    uint8_t* s = bam_aux_get(bam_, tag);
     96    if (s)
     97      bam_aux_del(bam_, s);
     98    std::stringstream msg("BamRead::aux_del: absent tag: ");
     99    msg << "'" << tag << "'";
     100    throw utility::runtime_error(msg.str());
    94101  }
    95102
  • trunk/yat/omic/BamRead.h

    r3028 r3029  
    114114    /**
    115115       \return pointer to auxiliary data
     116
     117       \see aux_size(void)
    116118     */
    117119    const uint8_t* aux(void) const;
    118120
    119121    /**
     122       Use bam_aux2? functions (in samtools C api) to convert returned
     123       pointer to corresponding type.
     124
     125       \return pointer to field associated with \a tag, NULL if \a tag
     126       doesn't exist.
     127
     128       \see bam_aux_get
     129
    120130       \since New in yat 0.11
    121131     */
     
    123133
    124134    /**
    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
     135       \brief append a new tag to aux field
     136
     137       \param tag two-charcter tag to append
     138       \param type describes which type and can be 'iIsScCdfAZH'
     139       \param len length of data
     140       \param data pointer to data
     141
     142       \since New in yat 0.11
     143
     144       \see SAM specification
    131145     */
    132146    void aux_append(const char tag[2], char type, int len, uint8_t* data);
    133147
    134148    /**
     149       \brief remove a tag in aux field
     150
     151       \throw utility::runtime_error if \a tag is not present in read
     152
    135153       \since New in yat 0.11
    136154     */
     
    138156
    139157    /**
     158       \return length of aux field
     159
    140160       \since New in yat 0.11
    141161     */
Note: See TracChangeset for help on using the changeset viewer.