X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam.h;h=4d30dcc2e494a3bf1477751b1176afc682e47282;hb=d0e30eec1158752010659982342a611fc91ae8e3;hp=a33006d617093cc07a334de7cc74eeb37d880a63;hpb=941542dfbedf4ba4850d3c1d6b96981234fd6560;p=samtools.git diff --git a/bam.h b/bam.h index a33006d..4d30dcc 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; @@ -113,6 +114,10 @@ typedef struct { /*! @abstract optical or PCR duplicate */ #define BAM_FDUP 1024 +#define BAM_OFDEC 0 +#define BAM_OFHEX 1 +#define BAM_OFSTR 2 + /*! @abstract defautl mask for pileup */ #define BAM_DEF_MASK (BAM_FUNMAP | BAM_FSECONDARY | BAM_FQCFAIL | BAM_FDUP) @@ -419,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) /*! @@ -431,7 +436,9 @@ extern "C" { */ char *bam_format1(const bam_header_t *header, const bam1_t *b); - char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int is_hex); + char *bam_format1_core(const bam_header_t *header, const bam1_t *b, int of); + + const char *bam_get_library(const bam_header_t *header, const bam1_t *b); /*! @typedef @abstract Structure for one alignment covering the pileup position. @@ -628,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