Skip to content

Commit

Permalink
Use hts_get_format() rather than direct access to htsFile internals
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarshall committed Nov 3, 2014
1 parent 3d5d3d9 commit c415df1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion reheader.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ args_t;
static void init_data(args_t *args)
{
htsFile *fp = hts_open(args->fname,"r");
args->type = fp->type;
args->type = *hts_get_format(fp);
hts_close(fp);
}

Expand Down
2 changes: 1 addition & 1 deletion vcfannotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ int main_vcfannotate(int argc, char *argv[])
if ( args->targets_fname )
{
htsFile *fp = hts_open(args->targets_fname,"r");
htsFormat type = fp->type;
htsFormat type = *hts_get_format(fp);
hts_close(fp);

if ( type.format==vcf || type.format==bcf )
Expand Down
6 changes: 3 additions & 3 deletions vcfindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ int vcf_index_stats(char *fname, int stats)
bcf_hdr_t *hdr = bcf_hdr_read(fp);
if ( !hdr ) { fprintf(stderr,"Could not read the header: %s\n", fname); return 1; }

if ( fp->type.format==vcf )
if ( hts_get_format(fp)->format==vcf )
{
tbx = tbx_index_load(fname);
if ( !tbx ) { fprintf(stderr,"Could not load TBI index: %s\n", fname); return 1; }
}
else if ( fp->type.format==bcf )
else if ( hts_get_format(fp)->format==bcf )
{
idx = bcf_index_load(fname);
if ( !idx ) { fprintf(stderr,"Could not load CSI index: %s\n", fname); return 1; }
Expand Down Expand Up @@ -178,7 +178,7 @@ int main_vcfindex(int argc, char *argv[])
if (stats) return vcf_index_stats(fname, stats);

htsFile *fp = hts_open(fname,"r");
htsFormat type = fp->type;
htsFormat type = *hts_get_format(fp);
hts_close(fp);

if ( (type.format!=bcf && type.format!=vcf) || type.compression!=bgzf )
Expand Down

0 comments on commit c415df1

Please sign in to comment.