Codebase list pybigwig / be779e3
Update upstream source from tag 'upstream/0.3.17' Update to upstream version '0.3.17' with Debian dir e0802d0735ae9e87fc37188cba219f1108b46d6a Diane Trout 4 years ago
4 changed file(s) with 24 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
143143 0.22213841940688142
144144 >>> bw.stats('chr1', 89294, 91629, exact=True)
145145 [0.22213841940688142]
146 Additionally, `values()` can directly output a numpy vector:
147
148 >>> bw = bw.open("
149146
150147 ## Retrieve values for individual bases in a range
151148
217214
218215 >>> bw.addHeader([("chr1", 1000000), ("chr2", 1500000)], maxZooms=0)
219216
217 If you set `maxTooms=0`, please note that IGV and many other tools WILL NOT WORK as they assume that at least one zoom level will be present. You are advised to use the default unless you do not expect the bigWig files to be used by other packages.
218
220219 ## Adding entries to a bigWig file
221220
222221 Assuming you've opened a file for writing and added a header, you can then add entries. Note that the entries **must** be added in order, as bigWig files always contain ordered intervals. There are three formats that bigWig files can use internally to store entries. The most commonly observed format is identical to a [bedGraph](https://genome.ucsc.edu/goldenpath/help/bedgraph.html) file:
275275 PyErr_SetString(PyExc_RuntimeError, "The bigWig file handle is not opened!");
276276 return NULL;
277277 }
278 if(bw->isWrite == 1) {
279 PyErr_SetString(PyExc_RuntimeError, "The header cannot be accessed in files opened for writing!");
280 return NULL;
281 }
278282
279283 ret = PyDict_New();
280284 val = PyLong_FromUnsignedLong(bw->hdr->version);
320324 return NULL;
321325 }
322326
327 if(bw->isWrite == 1) {
328 PyErr_SetString(PyExc_RuntimeError, "Chromosomes cannot be accessed in files opened for writing!");
329 return NULL;
330 }
331
323332 if(!(PyArg_ParseTuple(args, "|s", &chrom)) || !chrom) {
324333 ret = PyDict_New();
325334 for(i=0; i<bw->cl->nKeys; i++) {
379388 return NULL;
380389 }
381390
391 if(bw->isWrite == 1) {
392 PyErr_SetString(PyExc_RuntimeError, "Statistics cannot be accessed in files opened for writing!");
393 return NULL;
394 }
395
382396 if(bw->type == 1) {
383397 PyErr_SetString(PyExc_RuntimeError, "bigBed files have no statistics!");
384398 return NULL;
620634 return NULL;
621635 }
622636
637 if(bw->isWrite == 1) {
638 PyErr_SetString(PyExc_RuntimeError, "Intervals cannot be accessed in files opened for writing!");
639 return NULL;
640 }
641
623642 if(bw->type == 1) {
624643 PyErr_SetString(PyExc_RuntimeError, "bigBed files have no intervals! Use 'entries()' instead.");
625644 return NULL;
723742
724743 //I don't know what happens if PyBytes_AsString(NULL) is used...
725744 char *PyString_AsString(PyObject *obj) {
726 return PyBytes_AsString(PyUnicode_AsASCIIString(obj));
745 return PyUnicode_AsUTF8(obj);
727746 }
728747 #endif
729748
11 #include <structmember.h>
22 #include "bigWig.h"
33
4 #define pyBigWigVersion "0.3.16"
4 #define pyBigWigVersion "0.3.17"
55
66 typedef struct {
77 PyObject_HEAD
6161 include_dirs = include_dirs)
6262
6363 setup(name = 'pyBigWig',
64 version = '0.3.16',
64 version = '0.3.17',
6565 description = 'A package for accessing bigWig files using libBigWig',
6666 author = "Devon P. Ryan",
6767 author_email = "ryan@ie-freiburg.mpg.de",