Loading .appveyor.yml +0 −4 Original line number Diff line number Diff line Loading @@ -5,10 +5,6 @@ version: 'vers.{build}' # branches to build branches: # Whitelist only: - develop # Blacklist except: - gh-pages Loading Makefile +7 −4 Original line number Diff line number Diff line Loading @@ -175,8 +175,9 @@ cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $( cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h) cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h $(htslib_khash_h) cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h hfile_internal_h = hfile_internal.h $(htslib_hfile_h) hts_internal_h = hts_internal.h $(htslib_hts_h) hfile_internal_h = hfile_internal.h $(htslib_hfile_h) $(textutils_internal_h) hts_internal_h = hts_internal.h $(htslib_hts_h) $(textutils_internal_h) textutils_internal_h = textutils_internal.h $(htslib_kstring_h) thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h) Loading @@ -195,6 +196,7 @@ config.h: echo '/* Default config.h generated by Makefile */' > $@ echo '#define HAVE_LIBBZ2 1' >> $@ echo '#define HAVE_LIBLZMA 1' >> $@ echo '#define HAVE_LZMA_H 1' >> $@ echo '#define HAVE_FSEEKO 1' >> $@ echo '#define HAVE_DRAND48 1' >> $@ Loading Loading @@ -293,8 +295,9 @@ hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h) hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hfile_net.o hfile_net.pico: hfile_net.c config.h $(hfile_internal_h) $(htslib_knetfile_h) hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hts_internal_h) $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hts.o hts.pico: hts.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(cram_h) $(hfile_internal_h) $(htslib_hfile_h) version.h $(hts_internal_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_ksort_h) hts_os.o hts_os.pico: hts_os.c config.h os/rand.c vcf.o vcf.pico: vcf.c config.h $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_tbx_h) $(htslib_hfile_h) $(hts_internal_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_hts_endian_h) sam.o sam.pico: sam.c config.h $(htslib_sam_h) $(htslib_bgzf_h) $(cram_h) $(hts_internal_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_kstring_h) $(htslib_hts_endian_h) tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(hts_internal_h) $(htslib_khash_h) Loading @@ -317,7 +320,7 @@ cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_hts_endian_h) cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h) cram/cram_index.o cram/cram_index.pico: cram/cram_index.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hts_internal_h) $(cram_h) $(cram_os_h) cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h) cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h) cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h) cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h) cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h) Loading NEWS +42 −0 Original line number Diff line number Diff line Noteworthy changes in release 1.7 (26th January 2018) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BAM: HTSlib now supports BAMs which include CIGARs with more than 65535 operations as per HTS-Specs 18th November (dab57f4 and 2f915a8). * BCF/VCF: - Removed the need for long double in pileup calculations. - Sped up the synced reader in some situations. - Bug fixing: removed memory leak in bcf_copy. * CRAM: - Added support for HTS_IDX_START in cram iterators. - Easier to build when lzma header files are absent. - Bug fixing: a region query with REQUIRED_FIELDS option to disable sequence retrieval now gives correct results. - Bug fixing: stop queries to regions starting after the last read on a chromosome from incorrectly reporting errors (#651, #653; reported by Imran Haque and @egafni via pysam). * Multi-region iterator: The new structure takes a list of regions and iterates over all, deduplicating reads in the process, and producing a full list of file offset intervals. This is usually much faster than repeatedly using the old single-region iterator on a series of regions. * Curl improvements: - Add Bearer token support via HTS_AUTH_LOCATION env (#600). - Use CURL_CA_BUNDLE environment variable to override the CA (#622; thanks to Garret Kelly & David Alexander). - Speed up (removal of excessive waiting) for both http(s) and ftp. - Avoid repeatedly reconnecting by removal of unnecessary seeks. - Bug fixing: double free when libcurl_open fails. * BGZF block caching, if enabled, now performs far better (#629; reported by Ram Yalamanchili). * Added an hFILE layer for in-memory I/O buffers (#590; thanks to Thomas Hickman). * Tidied up the drand48 support (intended for systems that do not provide this function). Noteworthy changes in release 1.6 (28th September 2017) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Loading bcf_sr_sort.c +34 −21 Original line number Diff line number Diff line Loading @@ -327,6 +327,20 @@ char *grp_create_key(sr_sort_t *srt) } return ret; } int bcf_sr_sort_set_active(sr_sort_t *srt, int idx) { hts_expand(int,idx+1,srt->mactive,srt->active); srt->nactive = 1; srt->active[srt->nactive - 1] = idx; return 0; } int bcf_sr_sort_add_active(sr_sort_t *srt, int idx) { hts_expand(int,idx+1,srt->mactive,srt->active); srt->nactive++; srt->active[srt->nactive - 1] = idx; return 0; } static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int min_pos) { if ( !srt->grp_str2int ) Loading Loading @@ -357,11 +371,11 @@ static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, memset(&grp,0,sizeof(grp_t)); // group VCFs into groups, each with a unique combination of variants in the duplicate lines int ireader,ivar,irec,igrp,ivset; for (ireader=0; ireader<readers->nreaders; ireader++) int ireader,ivar,irec,igrp,ivset,iact; for (ireader=0; ireader<readers->nreaders; ireader++) srt->vcf_buf[ireader].nrec = 0; for (iact=0; iact<srt->nactive; iact++) { srt->vcf_buf[ireader].nrec = 0; ireader = srt->active[iact]; bcf_sr_t *reader = &readers->readers[ireader]; int rid = bcf_hdr_name2id(reader->header, chr); grp.nvar = 0; Loading Loading @@ -546,23 +560,8 @@ static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int min_pos) { int i,j; if ( readers->nreaders == 1 ) { srt->nsr = 1; if ( !srt->msr ) { srt->vcf_buf = (vcf_buf_t*) calloc(1,sizeof(vcf_buf_t)); // first time here srt->msr = 1; } bcf_sr_t *reader = &readers->readers[0]; assert( reader->buffer[1]->pos==min_pos ); bcf1_t *tmp = reader->buffer[0]; for (j=1; j<=reader->nbuffer; j++) reader->buffer[j-1] = reader->buffer[j]; reader->buffer[ reader->nbuffer ] = tmp; reader->nbuffer--; readers->has_line[0] = 1; return 1; } assert( srt->nactive>0 ); if ( srt->nsr != readers->nreaders ) { srt->sr = readers; Loading @@ -575,6 +574,19 @@ int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int mi srt->nsr = readers->nreaders; srt->chr = NULL; } if ( srt->nactive == 1 ) { if ( readers->nreaders>1 ) memset(readers->has_line, 0, readers->nreaders*sizeof(*readers->has_line)); bcf_sr_t *reader = &readers->readers[srt->active[0]]; assert( reader->buffer[1]->pos==min_pos ); bcf1_t *tmp = reader->buffer[0]; for (j=1; j<=reader->nbuffer; j++) reader->buffer[j-1] = reader->buffer[j]; reader->buffer[ reader->nbuffer ] = tmp; reader->nbuffer--; readers->has_line[srt->active[0]] = 1; return 1; } if ( !srt->chr || srt->pos!=min_pos || strcmp(srt->chr,chr) ) bcf_sr_sort_set(readers, srt, chr, min_pos); if ( !srt->vcf_buf[0].nrec ) return 0; Loading Loading @@ -629,6 +641,7 @@ sr_sort_t *bcf_sr_sort_init(sr_sort_t *srt) } void bcf_sr_sort_destroy(sr_sort_t *srt) { free(srt->active); if ( srt->var_str2int ) khash_str2int_destroy_free(srt->var_str2int); if ( srt->grp_str2int ) khash_str2int_destroy_free(srt->grp_str2int); int i; Loading bcf_sr_sort.h +3 −0 Original line number Diff line number Diff line Loading @@ -92,11 +92,14 @@ typedef struct const char *chr; int pos, nsr, msr; int pair; int nactive, mactive, *active; // list of readers with lines at the current pos } sr_sort_t; sr_sort_t *bcf_sr_sort_init(sr_sort_t *srt); int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int pos); int bcf_sr_sort_set_active(sr_sort_t *srt, int i); int bcf_sr_sort_add_active(sr_sort_t *srt, int i); void bcf_sr_sort_destroy(sr_sort_t *srt); void bcf_sr_sort_remove_reader(bcf_srs_t *readers, sr_sort_t *srt, int i); Loading Loading
.appveyor.yml +0 −4 Original line number Diff line number Diff line Loading @@ -5,10 +5,6 @@ version: 'vers.{build}' # branches to build branches: # Whitelist only: - develop # Blacklist except: - gh-pages Loading
Makefile +7 −4 Original line number Diff line number Diff line Loading @@ -175,8 +175,9 @@ cram_sam_header_h = cram/sam_header.h cram/string_alloc.h cram/pooled_alloc.h $( cram_samtools_h = cram/cram_samtools.h $(htslib_sam_h) $(cram_sam_header_h) cram_structs_h = cram/cram_structs.h $(htslib_thread_pool_h) cram/string_alloc.h $(htslib_khash_h) cram_open_trace_file_h = cram/open_trace_file.h cram/mFILE.h hfile_internal_h = hfile_internal.h $(htslib_hfile_h) hts_internal_h = hts_internal.h $(htslib_hts_h) hfile_internal_h = hfile_internal.h $(htslib_hfile_h) $(textutils_internal_h) hts_internal_h = hts_internal.h $(htslib_hts_h) $(textutils_internal_h) textutils_internal_h = textutils_internal.h $(htslib_kstring_h) thread_pool_internal_h = thread_pool_internal.h $(htslib_thread_pool_h) Loading @@ -195,6 +196,7 @@ config.h: echo '/* Default config.h generated by Makefile */' > $@ echo '#define HAVE_LIBBZ2 1' >> $@ echo '#define HAVE_LIBLZMA 1' >> $@ echo '#define HAVE_LZMA_H 1' >> $@ echo '#define HAVE_FSEEKO 1' >> $@ echo '#define HAVE_DRAND48 1' >> $@ Loading Loading @@ -293,8 +295,9 @@ hfile.o hfile.pico: hfile.c config.h $(htslib_hfile_h) $(hfile_internal_h) $(hts hfile_gcs.o hfile_gcs.pico: hfile_gcs.c config.h $(htslib_hts_h) $(htslib_kstring_h) $(hfile_internal_h) hfile_libcurl.o hfile_libcurl.pico: hfile_libcurl.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hfile_net.o hfile_net.pico: hfile_net.c config.h $(hfile_internal_h) $(htslib_knetfile_h) hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hts_internal_h) $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hfile_s3.o hfile_s3.pico: hfile_s3.c config.h $(hfile_internal_h) $(htslib_hts_h) $(htslib_kstring_h) hts.o hts.pico: hts.c config.h $(htslib_hts_h) $(htslib_bgzf_h) $(cram_h) $(hfile_internal_h) $(htslib_hfile_h) version.h $(hts_internal_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_ksort_h) hts_os.o hts_os.pico: hts_os.c config.h os/rand.c vcf.o vcf.pico: vcf.c config.h $(htslib_vcf_h) $(htslib_bgzf_h) $(htslib_tbx_h) $(htslib_hfile_h) $(hts_internal_h) $(htslib_khash_str2int_h) $(htslib_kstring_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_hts_endian_h) sam.o sam.pico: sam.c config.h $(htslib_sam_h) $(htslib_bgzf_h) $(cram_h) $(hts_internal_h) $(htslib_hfile_h) $(htslib_khash_h) $(htslib_kseq_h) $(htslib_kstring_h) $(htslib_hts_endian_h) tbx.o tbx.pico: tbx.c config.h $(htslib_tbx_h) $(htslib_bgzf_h) $(hts_internal_h) $(htslib_khash_h) Loading @@ -317,7 +320,7 @@ cram/cram_decode.o cram/cram_decode.pico: cram/cram_decode.c config.h $(cram_h) cram/cram_encode.o cram/cram_encode.pico: cram/cram_encode.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(htslib_hts_endian_h) cram/cram_external.o cram/cram_external.pico: cram/cram_external.c config.h $(htslib_hfile_h) $(cram_h) cram/cram_index.o cram/cram_index.pico: cram/cram_index.c config.h $(htslib_bgzf_h) $(htslib_hfile_h) $(hts_internal_h) $(cram_h) $(cram_os_h) cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h) cram/cram_io.o cram/cram_io.pico: cram/cram_io.c config.h os/lzma_stub.h $(cram_h) $(cram_os_h) $(htslib_hts_h) $(cram_open_trace_file_h) cram/rANS_static.h $(htslib_hfile_h) $(htslib_bgzf_h) $(htslib_faidx_h) $(hts_internal_h) cram/cram_samtools.o cram/cram_samtools.pico: cram/cram_samtools.c config.h $(cram_h) $(htslib_sam_h) cram/cram_stats.o cram/cram_stats.pico: cram/cram_stats.c config.h $(cram_h) $(cram_os_h) cram/files.o cram/files.pico: cram/files.c config.h $(cram_misc_h) Loading
NEWS +42 −0 Original line number Diff line number Diff line Noteworthy changes in release 1.7 (26th January 2018) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BAM: HTSlib now supports BAMs which include CIGARs with more than 65535 operations as per HTS-Specs 18th November (dab57f4 and 2f915a8). * BCF/VCF: - Removed the need for long double in pileup calculations. - Sped up the synced reader in some situations. - Bug fixing: removed memory leak in bcf_copy. * CRAM: - Added support for HTS_IDX_START in cram iterators. - Easier to build when lzma header files are absent. - Bug fixing: a region query with REQUIRED_FIELDS option to disable sequence retrieval now gives correct results. - Bug fixing: stop queries to regions starting after the last read on a chromosome from incorrectly reporting errors (#651, #653; reported by Imran Haque and @egafni via pysam). * Multi-region iterator: The new structure takes a list of regions and iterates over all, deduplicating reads in the process, and producing a full list of file offset intervals. This is usually much faster than repeatedly using the old single-region iterator on a series of regions. * Curl improvements: - Add Bearer token support via HTS_AUTH_LOCATION env (#600). - Use CURL_CA_BUNDLE environment variable to override the CA (#622; thanks to Garret Kelly & David Alexander). - Speed up (removal of excessive waiting) for both http(s) and ftp. - Avoid repeatedly reconnecting by removal of unnecessary seeks. - Bug fixing: double free when libcurl_open fails. * BGZF block caching, if enabled, now performs far better (#629; reported by Ram Yalamanchili). * Added an hFILE layer for in-memory I/O buffers (#590; thanks to Thomas Hickman). * Tidied up the drand48 support (intended for systems that do not provide this function). Noteworthy changes in release 1.6 (28th September 2017) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Loading
bcf_sr_sort.c +34 −21 Original line number Diff line number Diff line Loading @@ -327,6 +327,20 @@ char *grp_create_key(sr_sort_t *srt) } return ret; } int bcf_sr_sort_set_active(sr_sort_t *srt, int idx) { hts_expand(int,idx+1,srt->mactive,srt->active); srt->nactive = 1; srt->active[srt->nactive - 1] = idx; return 0; } int bcf_sr_sort_add_active(sr_sort_t *srt, int idx) { hts_expand(int,idx+1,srt->mactive,srt->active); srt->nactive++; srt->active[srt->nactive - 1] = idx; return 0; } static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int min_pos) { if ( !srt->grp_str2int ) Loading Loading @@ -357,11 +371,11 @@ static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, memset(&grp,0,sizeof(grp_t)); // group VCFs into groups, each with a unique combination of variants in the duplicate lines int ireader,ivar,irec,igrp,ivset; for (ireader=0; ireader<readers->nreaders; ireader++) int ireader,ivar,irec,igrp,ivset,iact; for (ireader=0; ireader<readers->nreaders; ireader++) srt->vcf_buf[ireader].nrec = 0; for (iact=0; iact<srt->nactive; iact++) { srt->vcf_buf[ireader].nrec = 0; ireader = srt->active[iact]; bcf_sr_t *reader = &readers->readers[ireader]; int rid = bcf_hdr_name2id(reader->header, chr); grp.nvar = 0; Loading Loading @@ -546,23 +560,8 @@ static void bcf_sr_sort_set(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int min_pos) { int i,j; if ( readers->nreaders == 1 ) { srt->nsr = 1; if ( !srt->msr ) { srt->vcf_buf = (vcf_buf_t*) calloc(1,sizeof(vcf_buf_t)); // first time here srt->msr = 1; } bcf_sr_t *reader = &readers->readers[0]; assert( reader->buffer[1]->pos==min_pos ); bcf1_t *tmp = reader->buffer[0]; for (j=1; j<=reader->nbuffer; j++) reader->buffer[j-1] = reader->buffer[j]; reader->buffer[ reader->nbuffer ] = tmp; reader->nbuffer--; readers->has_line[0] = 1; return 1; } assert( srt->nactive>0 ); if ( srt->nsr != readers->nreaders ) { srt->sr = readers; Loading @@ -575,6 +574,19 @@ int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int mi srt->nsr = readers->nreaders; srt->chr = NULL; } if ( srt->nactive == 1 ) { if ( readers->nreaders>1 ) memset(readers->has_line, 0, readers->nreaders*sizeof(*readers->has_line)); bcf_sr_t *reader = &readers->readers[srt->active[0]]; assert( reader->buffer[1]->pos==min_pos ); bcf1_t *tmp = reader->buffer[0]; for (j=1; j<=reader->nbuffer; j++) reader->buffer[j-1] = reader->buffer[j]; reader->buffer[ reader->nbuffer ] = tmp; reader->nbuffer--; readers->has_line[srt->active[0]] = 1; return 1; } if ( !srt->chr || srt->pos!=min_pos || strcmp(srt->chr,chr) ) bcf_sr_sort_set(readers, srt, chr, min_pos); if ( !srt->vcf_buf[0].nrec ) return 0; Loading Loading @@ -629,6 +641,7 @@ sr_sort_t *bcf_sr_sort_init(sr_sort_t *srt) } void bcf_sr_sort_destroy(sr_sort_t *srt) { free(srt->active); if ( srt->var_str2int ) khash_str2int_destroy_free(srt->var_str2int); if ( srt->grp_str2int ) khash_str2int_destroy_free(srt->grp_str2int); int i; Loading
bcf_sr_sort.h +3 −0 Original line number Diff line number Diff line Loading @@ -92,11 +92,14 @@ typedef struct const char *chr; int pos, nsr, msr; int pair; int nactive, mactive, *active; // list of readers with lines at the current pos } sr_sort_t; sr_sort_t *bcf_sr_sort_init(sr_sort_t *srt); int bcf_sr_sort_next(bcf_srs_t *readers, sr_sort_t *srt, const char *chr, int pos); int bcf_sr_sort_set_active(sr_sort_t *srt, int i); int bcf_sr_sort_add_active(sr_sort_t *srt, int i); void bcf_sr_sort_destroy(sr_sort_t *srt); void bcf_sr_sort_remove_reader(bcf_srs_t *readers, sr_sort_t *srt, int i); Loading