X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam.h;h=c635e72767e31852ddf8b2759a3d9493d13e58bc;hb=78de989ec56e7c17e1fa854cb8c1c4f9ae08856c;hp=4045684230a7cba886a0ed0fa390db3340866f91;hpb=41586185b43962c1ffb3f82e93066a480254aa17;p=samtools.git diff --git a/bam.h b/bam.h index 4045684..c635e72 100644 --- a/bam.h +++ b/bam.h @@ -100,7 +100,7 @@ typedef struct { int32_t n_targets; char **target_name; uint32_t *target_len; - void *hash; + void *hash, *rg2lib; int l_text; char *text; } bam_header_t; @@ -315,8 +315,18 @@ extern "C" { */ bam_header_t *sam_header_read2(const char *fn_list); + bam_header_t *sam_header_read(tamFile fp); + int sam_header_parse(bam_header_t *h); + int sam_header_parse_rg(bam_header_t *h); + #define sam_write1(header, b) bam_view1(header, b) + int bam_strmap_put(void *strmap, const char *rg, const char *lib); + const char *bam_strmap_get(const void *strmap, const char *rg); + void *bam_strmap_dup(const void*); + void *bam_strmap_init(); + void bam_strmap_destroy(void *strmap); + /*! @abstract Initialize a header structure. @return the pointer to the header structure @@ -404,11 +414,12 @@ extern "C" { } while (0) /*! - @abstract Print an alignment to the standard output in TAM format. + @abstract Format a BAM record in the SAM format @param header pointer to the header structure @param b alignment to print + @return a pointer to the SAM string */ - void bam_view1(const bam_header_t *header, const bam1_t *b); + char *bam_format1(const bam_header_t *header, const bam1_t *b); /*! @abstract Merge multiple sorted BAM. @@ -511,17 +522,6 @@ extern "C" { */ int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf); - /*! - @abstract A more convenient interface to bam_plbuf_push() - @param fp BAM file handler - @param func user defined function - @param func_data user provided data - - @discussion The file position indicator must be placed right - before the start of an alignment. See also bam_plbuf_push(). - */ - int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data); - struct __bam_lplbuf_t; typedef struct __bam_lplbuf_t bam_lplbuf_t; @@ -599,7 +599,8 @@ extern "C" { void bam_parse_region(bam_header_t *header, const char *str, int *ref_id, int *begin, int *end); 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]); + // uint8_t *bam_aux_get_core(bam1_t *b, const char tag[2]); // an alias of bam_aux_get() + uint8_t *bam_aux_get(const 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);