X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sam.c;h=fa11df6c12b1abc589415d4d11fe269067ecd765;hb=70c740facc966321754c6bfcc6d61ea056480638;hp=f026bc80864dbc75557bf632c760978e54acc453;hpb=50706bea83d8a1518485283876333279f4ae7137;p=samtools.git diff --git a/sam.c b/sam.c index f026bc8..fa11df6 100644 --- a/sam.c +++ b/sam.c @@ -36,6 +36,13 @@ static void append_header_text(bam_header_t *header, char* text, int len) header->text[header->l_text] = 0; } +int samthreads(samfile_t *fp, int n_threads, int n_sub_blks) +{ + if (!(fp->type&1) || (fp->type&2)) return -1; + bgzf_mt(fp->x.bam, n_threads, n_sub_blks); + return 0; +} + samfile_t *samopen(const char *fn, const char *mode, const void *aux) { samfile_t *fp; @@ -79,7 +86,7 @@ samfile_t *samopen(const char *fn, const char *mode, const void *aux) } else { // text // open file fp->x.tamw = strcmp(fn, "-")? fopen(fn, "w") : stdout; - if (fp->x.tamr == 0) goto open_err_ret; + if (fp->x.tamw == 0) goto open_err_ret; if (strchr(mode, 'X')) fp->type |= BAM_OFSTR<<2; else if (strchr(mode, 'x')) fp->type |= BAM_OFHEX<<2; else fp->type |= BAM_OFDEC<<2;