X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=samtools.git;a=blobdiff_plain;f=bam.h;h=291b30314f75d3d882b1d5dc9960e7b709a50c02;hp=ec983dfdd183042ef67a019e215a6dff6724c71f;hb=8af6e7eac6605aab3bd8b1a1f874309b59789b08;hpb=4a17fa7e1f91b2fe04ad334a63fc2b0d5e859d8a diff --git a/bam.h b/bam.h index ec983df..291b303 100644 --- a/bam.h +++ b/bam.h @@ -73,6 +73,7 @@ typedef gzFile bamFile; @field n_targets number of reference sequences @field target_name names of the reference sequences @field target_len lengths of the referene sequences + @field dict header dictionary @field hash hash table for fast name lookup @field rg2lib hash table for @RG-ID -> LB lookup @field l_text length of the plain text in the header @@ -85,7 +86,7 @@ typedef struct { int32_t n_targets; char **target_name; uint32_t *target_len; - void *hash, *rg2lib; + void *dict, *hash, *rg2lib; int l_text; char *text; } bam_header_t; @@ -423,8 +424,8 @@ extern "C" { @abstract Free the memory allocated for an alignment. @param b pointer to an alignment */ -#define bam_destroy1(b) do { \ - free((b)->data); free(b); \ +#define bam_destroy1(b) do { \ + if (b) { free((b)->data); free(b); } \ } while (0) /*! @@ -437,6 +438,8 @@ extern "C" { char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of); + const char *bam_get_library(bam_header_t *header, const bam1_t *b); + /*! @typedef @abstract Structure for one alignment covering the pileup position. @field b pointer to the alignment @@ -632,14 +635,6 @@ extern "C" { */ int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar); - typedef struct { - int32_t qbeg, qend; - int32_t tbeg, tend; - int32_t cbeg, cend; - } bam_segreg_t; - - int bam_segreg(int32_t pos, const bam1_core_t *c, const uint32_t *cigar, bam_segreg_t *reg); - #ifdef __cplusplus } #endif