A python extension, written in C, for quick access to and creation of bigWig files. This extension uses [libBigWig](https://github.com/dpryan79/libBigWig) for local and remote file access.
A python extension, written in C, for quick access to bigBed files and access to and creation of bigWig files. This extension uses [libBigWig](https://github.com/dpryan79/libBigWig) for local and remote file access.
Table of Contents
=================
@@ -21,7 +21,9 @@ Table of Contents
*[Add a header to a bigWig file](#add-a-header-to-a-bigwig-file)
*[Adding entries to a bigWig file](#adding-entries-to-a-bigwig-file)
*[Close a bigWig or bigBed file](#close-a-bigwig-or-bigbed-file)
*[Numpy](#Numpy)
*[Numpy](#numpy)
*[Remote file access](#remote-file-access)
*[Empty files](#empty-files)
*[A note on coordinates](#a-note-on-coordinates)
*[Galaxy](#galaxy)
@@ -296,6 +298,16 @@ Additionally, `values()` can directly output a numpy vector:
>>> type(bw.values('1', 0, 10, numpy=True))
<type 'numpy.ndarray'>
# Remote file access
If you do not have curl installed, pyBigWig will be installed without the ability to access remote files. You can determine if you will be able to access remote files with `pyBigWig.remote`. If that returns 1, then you can access remote files. If it returns 0 then you can't.
# Empty files
As of version 0.3.5, pyBigWig is able to read and write bigWig files lacking entries. Please note that such files are generally not compatible with other programs, since there's no definition of how a bigWig file with no entries should look. For such a file, the `intervals()` accessor will return `None`, the `stats()` function will return a list of `None` of the desired length, and `values()` will return `[]` (an empty list). This should generally allow programs utilizing pyBigWig to continue without issue.
For those wishing to mimic the functionality of pyBigWig/libBigWig in this regard, please note that it looks at the number of bases covered (as reported in the file header) to check for "empty" files.
# A note on coordinates
Wiggle, bigWig, and bigBed files use 0-based half-open coordinates, which are also used by this extension. So to access the value for the first base on `chr1`, one would specify the starting position as `0` and the end position as `1`. Similarly, bases 100 to 115 would have a start of `99` and an end of `115`. This is simply for the sake of consistency with the underlying bigWig file and may change in the future.