Skip to content

Commit

Permalink
* BUGGY VERSION
Browse files Browse the repository at this point in the history
 * improved the interface a bit
 * bug unfixed
  • Loading branch information
Heng Li committed Oct 24, 2009
1 parent ed9cedc commit b188ebc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
6 changes: 4 additions & 2 deletions bam.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,11 @@ void bam_view1(const bam_header_t *header, const bam1_t *b)
free(s);
}

const char *bam_get_library(const bam_header_t *header, const bam1_t *b)
const char *bam_get_library(bam_header_t *h, const bam1_t *b)
{
const uint8_t *rg;
if (h->dict == 0) h->dict = sam_header_parse2(h->text);
if (h->rg2lib) h->rg2lib = sam_header2tbl(h->dict, "RG", "ID", "LB");
rg = bam_aux_get(b, "RG");
return (rg == 0)? 0 : sam_tbl_get(header->rg2lib, (const char*)(rg + 1));
return (rg == 0)? 0 : sam_tbl_get(h->rg2lib, (const char*)(rg + 1));
}
2 changes: 1 addition & 1 deletion bam.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ extern "C" {

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);
const char *bam_get_library(bam_header_t *header, const bam1_t *b);

/*! @typedef
@abstract Structure for one alignment covering the pileup position.
Expand Down
7 changes: 0 additions & 7 deletions bam_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,6 @@ static inline void append_text(bam_header_t *header, kstring_t *str)
header->text[header->l_text] = 0;
}

int sam_header_parse_rg(bam_header_t *h)
{
if (h->dict == 0) h->dict = sam_header_parse2(h->text);
if (h->rg2lib) h->rg2lib = sam_header2tbl(h->dict, "RG", "ID", "LB");
return sam_tbl_size(h->rg2lib);
}

int sam_header_parse(bam_header_t *h)
{
char **tmp;
Expand Down
1 change: 0 additions & 1 deletion sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ samfile_t *samopen(const char *fn, const char *mode, const void *aux)
fprintf(stderr, "[samopen] no @SQ lines in the header.\n");
} else fprintf(stderr, "[samopen] SAM header is present: %d sequences.\n", fp->header->n_targets);
}
sam_header_parse_rg(fp->header);
} else if (mode[0] == 'w') { // write
fp->header = bam_header_dup((const bam_header_t*)aux);
if (mode[1] == 'b') { // binary
Expand Down

0 comments on commit b188ebc

Please sign in to comment.