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
143 | 143 |
0.22213841940688142
|
144 | 144 |
>>> bw.stats('chr1', 89294, 91629, exact=True)
|
145 | 145 |
[0.22213841940688142]
|
146 | |
Additionally, `values()` can directly output a numpy vector:
|
147 | |
|
148 | |
>>> bw = bw.open("
|
149 | 146 |
|
150 | 147 |
## Retrieve values for individual bases in a range
|
151 | 148 |
|
|
217 | 214 |
|
218 | 215 |
>>> bw.addHeader([("chr1", 1000000), ("chr2", 1500000)], maxZooms=0)
|
219 | 216 |
|
|
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 |
|
220 | 219 |
## Adding entries to a bigWig file
|
221 | 220 |
|
222 | 221 |
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:
|
275 | 275 |
PyErr_SetString(PyExc_RuntimeError, "The bigWig file handle is not opened!");
|
276 | 276 |
return NULL;
|
277 | 277 |
}
|
|
278 |
if(bw->isWrite == 1) {
|
|
279 |
PyErr_SetString(PyExc_RuntimeError, "The header cannot be accessed in files opened for writing!");
|
|
280 |
return NULL;
|
|
281 |
}
|
278 | 282 |
|
279 | 283 |
ret = PyDict_New();
|
280 | 284 |
val = PyLong_FromUnsignedLong(bw->hdr->version);
|
|
320 | 324 |
return NULL;
|
321 | 325 |
}
|
322 | 326 |
|
|
327 |
if(bw->isWrite == 1) {
|
|
328 |
PyErr_SetString(PyExc_RuntimeError, "Chromosomes cannot be accessed in files opened for writing!");
|
|
329 |
return NULL;
|
|
330 |
}
|
|
331 |
|
323 | 332 |
if(!(PyArg_ParseTuple(args, "|s", &chrom)) || !chrom) {
|
324 | 333 |
ret = PyDict_New();
|
325 | 334 |
for(i=0; i<bw->cl->nKeys; i++) {
|
|
379 | 388 |
return NULL;
|
380 | 389 |
}
|
381 | 390 |
|
|
391 |
if(bw->isWrite == 1) {
|
|
392 |
PyErr_SetString(PyExc_RuntimeError, "Statistics cannot be accessed in files opened for writing!");
|
|
393 |
return NULL;
|
|
394 |
}
|
|
395 |
|
382 | 396 |
if(bw->type == 1) {
|
383 | 397 |
PyErr_SetString(PyExc_RuntimeError, "bigBed files have no statistics!");
|
384 | 398 |
return NULL;
|
|
620 | 634 |
return NULL;
|
621 | 635 |
}
|
622 | 636 |
|
|
637 |
if(bw->isWrite == 1) {
|
|
638 |
PyErr_SetString(PyExc_RuntimeError, "Intervals cannot be accessed in files opened for writing!");
|
|
639 |
return NULL;
|
|
640 |
}
|
|
641 |
|
623 | 642 |
if(bw->type == 1) {
|
624 | 643 |
PyErr_SetString(PyExc_RuntimeError, "bigBed files have no intervals! Use 'entries()' instead.");
|
625 | 644 |
return NULL;
|
|
723 | 742 |
|
724 | 743 |
//I don't know what happens if PyBytes_AsString(NULL) is used...
|
725 | 744 |
char *PyString_AsString(PyObject *obj) {
|
726 | |
return PyBytes_AsString(PyUnicode_AsASCIIString(obj));
|
|
745 |
return PyUnicode_AsUTF8(obj);
|
727 | 746 |
}
|
728 | 747 |
#endif
|
729 | 748 |
|
1 | 1 |
#include <structmember.h>
|
2 | 2 |
#include "bigWig.h"
|
3 | 3 |
|
4 | |
#define pyBigWigVersion "0.3.16"
|
|
4 |
#define pyBigWigVersion "0.3.17"
|
5 | 5 |
|
6 | 6 |
typedef struct {
|
7 | 7 |
PyObject_HEAD
|
61 | 61 |
include_dirs = include_dirs)
|
62 | 62 |
|
63 | 63 |
setup(name = 'pyBigWig',
|
64 | |
version = '0.3.16',
|
|
64 |
version = '0.3.17',
|
65 | 65 |
description = 'A package for accessing bigWig files using libBigWig',
|
66 | 66 |
author = "Devon P. Ryan",
|
67 | 67 |
author_email = "ryan@ie-freiburg.mpg.de",
|