]> git.donarmstrong.com Git - samtools.git/blobdiff - bam.h
* samtools-0.1.3-7 (r246)
[samtools.git] / bam.h
diff --git a/bam.h b/bam.h
index 76f3e0f99f783a1779df83fc4b1be7c88ec6aaf8..4045684230a7cba886a0ed0fa390db3340866f91 100644 (file)
--- a/bam.h
+++ b/bam.h
@@ -179,7 +179,6 @@ typedef struct {
   @field  data_len   current length of bam1_t::data
   @field  m_data     maximum length of bam1_t::data
   @field  data       all variable-length data, concatenated; structure: cigar-qname-seq-qual-aux
-  @field  hash       hash table for fast retrieval of tag-value pairs; private
 
   @discussion Notes:
  
@@ -191,7 +190,6 @@ typedef struct {
        bam1_core_t core;
        int l_aux, data_len, m_data;
        uint8_t *data;
-       void *hash;
 } bam1_t;
 
 #define bam1_strand(b) (((b)->core.flag&BAM_FREVERSE) != 0)
@@ -401,8 +399,8 @@ extern "C" {
          @abstract  Free the memory allocated for an alignment.
          @param  b  pointer to an alignment
         */
-#define bam_destroy1(b) do {                                                                                   \
-               if ((b)->hash) bam_aux_destroy(b); free((b)->data); free(b);    \
+#define bam_destroy1(b) do {           \
+               free((b)->data); free(b);       \
        } while (0)
 
        /*!
@@ -600,11 +598,42 @@ extern "C" {
         */
        void bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *begin, int *end);
 
-       int32_t bam_aux_geti(bam1_t *b, const char tag[2], int *err);
-       float bam_aux_getf(bam1_t *b, const char tag[2], int *err);
-       char bam_aux_getc(bam1_t *b, const char tag[2], int *err);
-       char *bam_aux_getZH(bam1_t *b, const char tag[2], int *err);
-       void bam_aux_destroy(bam1_t *b);
+       void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data);
+       uint8_t *bam_aux_get(bam1_t *b, const char tag[2]);
+       int32_t bam_aux2i(const uint8_t *s);
+       float bam_aux2f(const uint8_t *s);
+       double bam_aux2d(const uint8_t *s);
+       char bam_aux2A(const uint8_t *s);
+       char *bam_aux2Z(const uint8_t *s);
+
+       /*!
+        @abstract     Get the color encoding the previous and current base
+        @param b      pointer to an alignment
+        @param i      The i-th position, 0-based
+        @return       color
+
+        @discussion   Returns 0 no color information is found.
+        */
+       char bam_aux_getCSi(bam1_t *b, int i);
+
+       /*!
+        @abstract     Get the color quality of the color encoding the previous and current base
+        @param b      pointer to an alignment
+        @param i      The i-th position, 0-based
+        @return       color quality
+
+        @discussion   Returns 0 no color information is found.
+        */
+       char bam_aux_getCQi(bam1_t *b, int i);
+
+       /*!
+        @abstract     Get the color error profile at the give position    
+        @param b      pointer to an alignment
+        @return       the original color if the color was an error, '-' (dash) otherwise
+
+        @discussion   Returns 0 no color information is found.
+        */
+       char bam_aux_getCEi(bam1_t *b, int i);
 
        /*!  
          @abstract Calculate the rightmost coordinate of an alignment on the