dhtslib 0.5.1

D bindings for htslib

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:



D bindings and convenience wrappers for htslib


Add dhtslib as a dependency to dub.json:

    "dependencies": {
        "dhtslib": "~>0.5.0",

(version number 0.5.0 is example but current as of today)


Convenience Wrappers

Object-oriented, idomatic(ish) D wrappers are available for:

  • BGZF compressed files (dhtslib.bgzf)
  • FASTA indexes (dhtslib.faidx)
  • SAM/BAM/CRAM files and streams (dhtslib.sam)
  • Tabix-indexed files (dhtslib.tabix)
  • VCF/BCF files (dhtslib.vcf)

For example, this provides access to BGZF files by line as a consumable InputRange. Or, for BAM files, the ability to query for a range (e.g. "chr1:1000000-2000000") and obtain an InputRange over the BAM records.

htslib API

Direct bindings to htslib C API are available as submodules under dhtslib.htslib. Naming remains the same as the original .h include files. For example, import dhtslib.htslib.faidx for direct access to the C function calls. The current compatible versions are 1.7-1.9.

Currently implemented fully or partially:

  • bgzf
  • faidx
  • hts
  • hts_log
  • kstring
  • regidx
  • sam
  • tbx
  • vcf

Missing (so far):

  • Some CRAM specific functions, although much CRAM functionality works with sam_ functions
  • hfile
  • kbitset, kfunc, khash, klist, knetfile, kseq, ksort (mostly used internally anyway)
  • syncedbcfreader
  • thread_pool
  • vcf_sweep
  • vcfutils

Bugs and Warnings

Do not call htslog htslog_* from a destructor, as it is potentialy allocating via toStringz

  • James S. Blachly, MD
0.14.0+htslib-1.13 2022-Mar-02
0.13.3+htslib-1.13 2021-Oct-01
0.13.2+htslib-1.13 2021-Oct-01
0.13.1+htslib-1.13 2021-Sep-30
0.13.0+htslib-1.13 2021-Sep-30
Show all 43 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 3 downloads this month

  • 824 downloads total

Short URL: