libBigWig
libBigWig

Introduction

libBigWig is a C library for parsing local/remote bigWig and bigBed files. This is similar to Kent's library from UCSC, except

  • The license is much more liberal
  • This code doesn't call exit() on error, thereby killing the calling application.

External files are accessed using curl.

Please submit issues and pull requests here.

Compilation

Assuming you already have the curl libraries installed (not just the curl binary!):

make install prefix=/some/path

bigWig files

There are three methods for storing values in a bigWig file, further described in the wiggle format. The entries within the file are grouped into "blocks" and each such block is limited to storing entries of a single type. So, it is unwise to use a single bedGraph-like endtry followed by a single fixed-step entry followed by a variable-step entry, as that would require three separate blocks, with additional space required for each.

file types

As of version 0.3.0, libBigWig supports reading bigBed files. If an application needs to support both bigBed and bigWig input, then the bwIsBigWig and bbIsBigBed functions can be used to determine the file type. These both use the "magic" number at the beginning of the file to determine the file type.

and entry iterators

As of version 0.3.0, libBigWig supports iterating over intervals in bigWig files and entries in bigBed files. The number of intervals/entries returned with each iteration can be controlled by setting the number of blocks processed in each iteration (intervals and entries are group inside of bigWig and bigBed files into blocks of entries). See test/testIterator.c for an example.

Examples

Please see README.md and the files under test/ for examples.