Python wrapper for the bwtool library.
Project description
Python wrapper for the bwtool library. Please take a look to the bwtool wiki for notes on the installation process and to the known issues listed below within this readme.
How do I install this package?
As usual, just download it using pip:
pip install pybwtool
Tests Coverage
Since some software handling coverages sometimes get slightly different results, here’s three of them:
Extract
The extract
method returns a tuple of pandas Dataframes
with the data from the regions of a bed file extracted from the given bigwig.
from pybwtool import extract
bed, scores = extract(
bed_path="path/to/my/bed_file.bed",
bigwig_path="path/to/my/bigwig_file.bigwig"
)
The obtained dataframes look as follows:
chrom |
chromStart |
chromEnd |
---|---|---|
chr11 |
14606206 |
14606406 |
chr1 |
1336296 |
1336496 |
chr11 |
47745644 |
47745844 |
chr11 |
62609072 |
62609272 |
chr14 |
21523971 |
21524171 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0.22 |
0.22 |
0.21 |
0.22 |
0.21 |
0.22 |
0.24 |
0.25 |
0.28 |
0.28 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.31 |
0.31 |
0.31 |
0.32 |
0.33 |
0.33 |
0.33 |
0.32 |
0.35 |
0.36 |
0.36 |
0.36 |
0.36 |
0.36 |
0.36 |
0.37 |
0.37 |
0.36 |
0.37 |
0.37 |
0.37 |
0.36 |
0.32 |
0.32 |
0.32 |
0.33 |
0.33 |
0.33 |
0.33 |
0.35 |
0.35 |
0.35 |
0.35 |
0.35 |
0.35 |
0.36 |
0.39 |
0.39 |
0.37 |
0.37 |
0.36 |
0.35 |
0.33 |
0.31 |
0.31 |
0.29 |
0.29 |
0.29 |
0.29 |
0.29 |
0.25 |
0.24 |
0.28 |
0.26 |
0.25 |
0.25 |
0.25 |
0.24 |
0.19 |
0.18 |
0.18 |
0.17 |
0.17 |
0.18 |
0.19 |
0.18 |
0.18 |
0.18 |
0.17 |
0.18 |
0.18 |
0.18 |
0.18 |
0.18 |
0.18 |
0.17 |
0.24 |
0.25 |
0.25 |
0.24 |
0.22 |
0.22 |
0.25 |
0.25 |
0.25 |
0.24 |
0.21 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.24 |
0.24 |
0.24 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.21 |
0.21 |
0.21 |
0.19 |
0.19 |
0.19 |
0.22 |
0.22 |
0.22 |
0.22 |
0.24 |
0.25 |
0.25 |
0.26 |
0.26 |
0.26 |
0.19 |
0.18 |
0.18 |
0.18 |
0.18 |
0.18 |
0.15 |
0.15 |
0.15 |
0.15 |
0.15 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.18 |
0.17 |
0.17 |
0.17 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.18 |
0.18 |
0.18 |
0.18 |
0.18 |
0.15 |
0.15 |
0.15 |
0.14 |
0.12 |
0.11 |
0.12 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
0.11 |
1.25 |
1.26 |
1.32 |
1.43 |
1.42 |
1.36 |
1.36 |
1.37 |
1.37 |
1.32 |
1.31 |
1.31 |
1.35 |
1.35 |
1.43 |
1.5 |
1.56 |
1.56 |
1.64 |
1.67 |
1.67 |
1.64 |
1.68 |
1.67 |
1.68 |
1.69 |
1.71 |
1.71 |
1.74 |
1.71 |
1.67 |
1.65 |
1.58 |
1.56 |
1.43 |
1.36 |
1.24 |
1.24 |
1.28 |
1.26 |
1.33 |
1.36 |
1.44 |
1.42 |
1.44 |
1.46 |
1.5 |
1.49 |
1.47 |
1.47 |
1.54 |
1.54 |
1.54 |
1.47 |
1.49 |
1.53 |
1.51 |
1.5 |
1.51 |
1.57 |
1.57 |
1.57 |
1.53 |
1.54 |
1.49 |
1.46 |
1.43 |
1.43 |
1.39 |
1.39 |
1.4 |
1.42 |
1.39 |
1.37 |
1.37 |
1.4 |
1.4 |
1.43 |
1.4 |
1.42 |
1.44 |
1.44 |
1.4 |
1.37 |
1.36 |
1.32 |
1.29 |
1.31 |
1.29 |
1.29 |
1.19 |
1.24 |
1.19 |
1.19 |
1.25 |
1.24 |
1.26 |
1.28 |
1.26 |
1.37 |
1.33 |
1.33 |
1.28 |
1.24 |
1.25 |
1.25 |
1.25 |
1.26 |
1.24 |
1.22 |
1.28 |
1.28 |
1.32 |
1.37 |
1.39 |
1.36 |
1.32 |
1.31 |
1.36 |
1.33 |
1.5 |
1.5 |
1.5 |
1.5 |
1.5 |
1.47 |
1.46 |
1.49 |
1.57 |
1.58 |
1.58 |
1.62 |
1.64 |
1.64 |
1.67 |
1.67 |
1.68 |
1.74 |
1.81 |
1.93 |
1.93 |
1.87 |
1.85 |
1.83 |
1.76 |
1.76 |
1.72 |
1.75 |
1.92 |
1.83 |
1.82 |
1.79 |
1.85 |
1.86 |
1.83 |
1.83 |
1.82 |
1.81 |
1.89 |
1.89 |
1.92 |
1.93 |
1.96 |
1.92 |
1.86 |
1.86 |
1.86 |
1.93 |
1.87 |
1.85 |
1.72 |
1.71 |
1.71 |
1.72 |
1.75 |
1.81 |
1.82 |
1.75 |
1.71 |
1.67 |
1.68 |
1.65 |
1.65 |
1.65 |
1.67 |
1.69 |
1.75 |
1.64 |
1.57 |
1.44 |
1.6 |
1.69 |
1.68 |
1.72 |
1.69 |
1.71 |
1.67 |
1.64 |
1.49 |
1.46 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.03 |
0.03 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.03 |
0.03 |
0.03 |
0.03 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.04 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.01 |
0.01 |
0.01 |
0.01 |
0.03 |
0.03 |
0.03 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.01 |
0.01 |
0.01 |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.04 |
0.15 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.15 |
0.14 |
0.17 |
0.18 |
0.18 |
0.18 |
0.18 |
0.18 |
0.19 |
0.19 |
0.19 |
0.19 |
0.21 |
0.21 |
0.21 |
0.19 |
0.21 |
0.22 |
0.22 |
0.24 |
0.24 |
0.24 |
0.24 |
0.24 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.25 |
0.25 |
0.25 |
0.26 |
0.26 |
0.28 |
0.28 |
0.29 |
0.25 |
0.25 |
0.24 |
0.22 |
0.22 |
0.21 |
0.21 |
0.21 |
0.21 |
0.21 |
0.19 |
0.21 |
0.21 |
0.21 |
0.01 |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
nan |
0.01 |
0.01 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.06 |
0.04 |
0.04 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.04 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.01 |
0.03 |
0.03 |
0.03 |
0.03 |
0.03 |
0.01 |
0.31 |
0.25 |
0.21 |
0.19 |
0.19 |
0.19 |
0.19 |
0.18 |
0.19 |
0.21 |
0.21 |
0.21 |
0.21 |
0.22 |
0.26 |
0.26 |
0.26 |
0.26 |
0.29 |
0.28 |
0.26 |
0.26 |
0.26 |
0.26 |
0.28 |
0.26 |
0.24 |
0.24 |
0.22 |
0.24 |
0.25 |
0.25 |
0.25 |
0.26 |
0.29 |
0.28 |
0.28 |
0.28 |
0.29 |
0.29 |
0.29 |
0.29 |
0.29 |
0.29 |
0.25 |
0.25 |
0.25 |
0.25 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.26 |
0.28 |
0.28 |
0.26 |
0.26 |
0.26 |
0.26 |
0.25 |
0.24 |
0.19 |
0.19 |
0.19 |
0.19 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.15 |
0.14 |
0.15 |
0.15 |
0.15 |
0.18 |
0.17 |
0.15 |
0.15 |
0.15 |
0.12 |
0.11 |
0.12 |
0.14 |
0.14 |
0.14 |
0.15 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.18 |
0.18 |
0.18 |
0.17 |
0.17 |
0.17 |
0.17 |
0.18 |
0.18 |
0.18 |
0.18 |
0.17 |
0.17 |
0.18 |
0.17 |
0.18 |
0.18 |
0.18 |
0.18 |
0.19 |
0.19 |
0.21 |
0.21 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.22 |
0.21 |
0.21 |
0.22 |
0.21 |
0.21 |
0.21 |
0.21 |
0.21 |
0.21 |
0.21 |
0.19 |
0.18 |
0.18 |
0.17 |
0.15 |
0.15 |
0.15 |
0.15 |
0.15 |
0.15 |
0.14 |
0.14 |
0.14 |
0.14 |
0.14 |
0.17 |
0.18 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.17 |
0.15 |
0.15 |
0.14 |
0.14 |
0.14 |
0.14 |
0.12 |
0.12 |
0.11 |
0.11 |
0.1 |
0.1 |
0.1 |
0.1 |
0.1 |
0.1 |
0.12 |
0.12 |
0.12 |
0.12 |
0.11 |
0.11 |
0.12 |
0.12 |
0.12 |
0.12 |
0.12 |
0.12 |
0.12 |
0.12 |
0.12 |
0.14 |
0.12 |
0.14 |
0.15 |
0.15 |
0.15 |
0.15 |
0.17 |
0.17 |
0.17 |
0.17 |
You can also run the extraction directly to a file, a thing that can get handy when you have to run a very big bed file. You just need to specify a target file.
from pybwtool import extract
extract(
bed_path="path/to/my/bed_file.bed",
bigwig_path="path/to/my/bigwig_file.bigwig",
target="target.bed"
)
Common fixes for getting bwtool to work
Consider looking at the Travis-CI configuration. If it works there, it should also work for you.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pybwtool-1.0.6.tar.gz
.
File metadata
- Download URL: pybwtool-1.0.6.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e80ea243ffb407b7bc5d72a71db26c5d258aec8b76d1b3c38ee6591bfb9d1a36 |
|
MD5 | 02fe343ec0bd8b16c81ee59f9477856b |
|
BLAKE2b-256 | efde891f6ce86afc56e415d50092d357dd52b744f633927a279bbd5ef059d406 |