bwamem 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. bwamem-0.0.1/LICENSE.md +364 -0
  2. bwamem-0.0.1/MANIFEST.in +11 -0
  3. bwamem-0.0.1/PKG-INFO +230 -0
  4. bwamem-0.0.1/README.md +192 -0
  5. bwamem-0.0.1/bwa/QSufSort.c +402 -0
  6. bwamem-0.0.1/bwa/QSufSort.h +45 -0
  7. bwamem-0.0.1/bwa/QSufSort.o +0 -0
  8. bwamem-0.0.1/bwa/bamlite.c +210 -0
  9. bwamem-0.0.1/bwa/bamlite.h +114 -0
  10. bwamem-0.0.1/bwa/bntseq.c +451 -0
  11. bwamem-0.0.1/bwa/bntseq.h +92 -0
  12. bwamem-0.0.1/bwa/bntseq.o +0 -0
  13. bwamem-0.0.1/bwa/bwa.c +502 -0
  14. bwamem-0.0.1/bwa/bwa.h +97 -0
  15. bwamem-0.0.1/bwa/bwa.o +0 -0
  16. bwamem-0.0.1/bwa/bwamem.c +1264 -0
  17. bwamem-0.0.1/bwa/bwamem.h +213 -0
  18. bwamem-0.0.1/bwa/bwamem.o +0 -0
  19. bwamem-0.0.1/bwa/bwamem_extra.c +172 -0
  20. bwamem-0.0.1/bwa/bwamem_extra.o +0 -0
  21. bwamem-0.0.1/bwa/bwamem_pair.c +419 -0
  22. bwamem-0.0.1/bwa/bwamem_pair.o +0 -0
  23. bwamem-0.0.1/bwa/bwape.c +784 -0
  24. bwamem-0.0.1/bwa/bwase.c +606 -0
  25. bwamem-0.0.1/bwa/bwase.h +29 -0
  26. bwamem-0.0.1/bwa/bwaseqio.c +235 -0
  27. bwamem-0.0.1/bwa/bwashm.c +217 -0
  28. bwamem-0.0.1/bwa/bwt.c +469 -0
  29. bwamem-0.0.1/bwa/bwt.h +132 -0
  30. bwamem-0.0.1/bwa/bwt.o +0 -0
  31. bwamem-0.0.1/bwa/bwt_gen.c +1623 -0
  32. bwamem-0.0.1/bwa/bwt_gen.o +0 -0
  33. bwamem-0.0.1/bwa/bwt_lite.c +98 -0
  34. bwamem-0.0.1/bwa/bwt_lite.h +29 -0
  35. bwamem-0.0.1/bwa/bwtaln.c +321 -0
  36. bwamem-0.0.1/bwa/bwtaln.h +153 -0
  37. bwamem-0.0.1/bwa/bwtgap.c +264 -0
  38. bwamem-0.0.1/bwa/bwtgap.h +40 -0
  39. bwamem-0.0.1/bwa/bwtindex.c +323 -0
  40. bwamem-0.0.1/bwa/bwtindex.o +0 -0
  41. bwamem-0.0.1/bwa/bwtsw2.h +69 -0
  42. bwamem-0.0.1/bwa/bwtsw2_aux.c +776 -0
  43. bwamem-0.0.1/bwa/bwtsw2_chain.c +112 -0
  44. bwamem-0.0.1/bwa/bwtsw2_core.c +619 -0
  45. bwamem-0.0.1/bwa/bwtsw2_main.c +89 -0
  46. bwamem-0.0.1/bwa/bwtsw2_pair.c +274 -0
  47. bwamem-0.0.1/bwa/example.c +60 -0
  48. bwamem-0.0.1/bwa/fastmap.c +483 -0
  49. bwamem-0.0.1/bwa/is.c +223 -0
  50. bwamem-0.0.1/bwa/is.o +0 -0
  51. bwamem-0.0.1/bwa/kbtree.h +388 -0
  52. bwamem-0.0.1/bwa/khash.h +614 -0
  53. bwamem-0.0.1/bwa/kopen.c +374 -0
  54. bwamem-0.0.1/bwa/kseq.h +239 -0
  55. bwamem-0.0.1/bwa/ksort.h +273 -0
  56. bwamem-0.0.1/bwa/kstring.c +37 -0
  57. bwamem-0.0.1/bwa/kstring.h +131 -0
  58. bwamem-0.0.1/bwa/kstring.o +0 -0
  59. bwamem-0.0.1/bwa/ksw.c +749 -0
  60. bwamem-0.0.1/bwa/ksw.h +114 -0
  61. bwamem-0.0.1/bwa/ksw.o +0 -0
  62. bwamem-0.0.1/bwa/kthread.c +147 -0
  63. bwamem-0.0.1/bwa/kthread.o +0 -0
  64. bwamem-0.0.1/bwa/kvec.h +94 -0
  65. bwamem-0.0.1/bwa/libbwa.a +0 -0
  66. bwamem-0.0.1/bwa/main.c +130 -0
  67. bwamem-0.0.1/bwa/malloc_wrap.c +57 -0
  68. bwamem-0.0.1/bwa/malloc_wrap.h +47 -0
  69. bwamem-0.0.1/bwa/malloc_wrap.o +0 -0
  70. bwamem-0.0.1/bwa/maxk.c +67 -0
  71. bwamem-0.0.1/bwa/neon_sse.h +33 -0
  72. bwamem-0.0.1/bwa/pemerge.c +291 -0
  73. bwamem-0.0.1/bwa/rle.c +191 -0
  74. bwamem-0.0.1/bwa/rle.h +77 -0
  75. bwamem-0.0.1/bwa/rle.o +0 -0
  76. bwamem-0.0.1/bwa/rope.c +318 -0
  77. bwamem-0.0.1/bwa/rope.h +58 -0
  78. bwamem-0.0.1/bwa/rope.o +0 -0
  79. bwamem-0.0.1/bwa/scalar_sse.h +119 -0
  80. bwamem-0.0.1/bwa/utils.c +306 -0
  81. bwamem-0.0.1/bwa/utils.h +111 -0
  82. bwamem-0.0.1/bwa/utils.o +0 -0
  83. bwamem-0.0.1/bwamem/__init__.py +12 -0
  84. bwamem-0.0.1/bwamem/fastq_reader.py +119 -0
  85. bwamem-0.0.1/bwamem/libbwa.py +786 -0
  86. bwamem-0.0.1/bwamem/libbwamem.c +143 -0
  87. bwamem-0.0.1/bwamem/memopts.c +146 -0
  88. bwamem-0.0.1/bwamem.egg-info/PKG-INFO +230 -0
  89. bwamem-0.0.1/bwamem.egg-info/SOURCES.txt +104 -0
  90. bwamem-0.0.1/bwamem.egg-info/dependency_links.txt +1 -0
  91. bwamem-0.0.1/bwamem.egg-info/entry_points.txt +2 -0
  92. bwamem-0.0.1/bwamem.egg-info/requires.txt +11 -0
  93. bwamem-0.0.1/bwamem.egg-info/top_level.txt +2 -0
  94. bwamem-0.0.1/pyproject.toml +82 -0
  95. bwamem-0.0.1/setup.cfg +22 -0
  96. bwamem-0.0.1/setup.py +83 -0
  97. bwamem-0.0.1/tests/create_demo_files.py +69 -0
  98. bwamem-0.0.1/tests/example.py +134 -0
  99. bwamem-0.0.1/tests/fastq_reader.py +207 -0
  100. bwamem-0.0.1/tests/quick_demo.py +47 -0
  101. bwamem-0.0.1/tests/test_bwamem.py +201 -0
  102. bwamem-0.0.1/tests/test_paired_mapping.py +167 -0
@@ -0,0 +1,364 @@
1
+ This Source Code Form is subject to the terms of the Mozilla Public
2
+ License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
+
5
+ (c) 2016 Oxford Nanopore Technologies Ltd.
6
+
7
+
8
+ Mozilla Public License Version 2.0
9
+ ==================================
10
+
11
+ ### 1. Definitions
12
+
13
+ **1.1. “Contributor”**
14
+ means each individual or legal entity that creates, contributes to
15
+ the creation of, or owns Covered Software.
16
+
17
+ **1.2. “Contributor Version”**
18
+ means the combination of the Contributions of others (if any) used
19
+ by a Contributor and that particular Contributor's Contribution.
20
+
21
+ **1.3. “Contribution”**
22
+ means Covered Software of a particular Contributor.
23
+
24
+ **1.4. “Covered Software”**
25
+ means Source Code Form to which the initial Contributor has attached
26
+ the notice in Exhibit A, the Executable Form of such Source Code
27
+ Form, and Modifications of such Source Code Form, in each case
28
+ including portions thereof.
29
+
30
+ **1.5. “Incompatible With Secondary Licenses”**
31
+ means
32
+
33
+ * **(a)** that the initial Contributor has attached the notice described
34
+ in Exhibit B to the Covered Software; or
35
+ * **(b)** that the Covered Software was made available under the terms of
36
+ version 1.1 or earlier of the License, but not also under the
37
+ terms of a Secondary License.
38
+
39
+ **1.6. “Executable Form”**
40
+ means any form of the work other than Source Code Form.
41
+
42
+ **1.7. “Larger Work”**
43
+ means a work that combines Covered Software with other material, in
44
+ a separate file or files, that is not Covered Software.
45
+
46
+ **1.8. “License”**
47
+ means this document.
48
+
49
+ **1.9. “Licensable”**
50
+ means having the right to grant, to the maximum extent possible,
51
+ whether at the time of the initial grant or subsequently, any and
52
+ all of the rights conveyed by this License.
53
+
54
+ **1.10. “Modifications”**
55
+ means any of the following:
56
+
57
+ * **(a)** any file in Source Code Form that results from an addition to,
58
+ deletion from, or modification of the contents of Covered
59
+ Software; or
60
+ * **(b)** any new file in Source Code Form that contains any Covered
61
+ Software.
62
+
63
+ **1.11. “Patent Claims” of a Contributor**
64
+ means any patent claim(s), including without limitation, method,
65
+ process, and apparatus claims, in any patent Licensable by such
66
+ Contributor that would be infringed, but for the grant of the
67
+ License, by the making, using, selling, offering for sale, having
68
+ made, import, or transfer of either its Contributions or its
69
+ Contributor Version.
70
+
71
+ **1.12. “Secondary License”**
72
+ means either the GNU General Public License, Version 2.0, the GNU
73
+ Lesser General Public License, Version 2.1, the GNU Affero General
74
+ Public License, Version 3.0, or any later versions of those
75
+ licenses.
76
+
77
+ **1.13. “Source Code Form”**
78
+ means the form of the work preferred for making modifications.
79
+
80
+ **1.14. “You” (or “Your”)**
81
+ means an individual or a legal entity exercising rights under this
82
+ License. For legal entities, “You” includes any entity that
83
+ controls, is controlled by, or is under common control with You. For
84
+ purposes of this definition, “control” means **(a)** the power, direct
85
+ or indirect, to cause the direction or management of such entity,
86
+ whether by contract or otherwise, or **(b)** ownership of more than
87
+ fifty percent (50%) of the outstanding shares or beneficial
88
+ ownership of such entity.
89
+
90
+
91
+ ### 2. License Grants and Conditions
92
+
93
+ #### 2.1. Grants
94
+
95
+ Each Contributor hereby grants You a world-wide, royalty-free,
96
+ non-exclusive license:
97
+
98
+ * **(a)** under intellectual property rights (other than patent or trademark)
99
+ Licensable by such Contributor to use, reproduce, make available,
100
+ modify, display, perform, distribute, and otherwise exploit its
101
+ Contributions, either on an unmodified basis, with Modifications, or
102
+ as part of a Larger Work; and
103
+ * **(b)** under Patent Claims of such Contributor to make, use, sell, offer
104
+ for sale, have made, import, and otherwise transfer either its
105
+ Contributions or its Contributor Version.
106
+
107
+ #### 2.2. Effective Date
108
+
109
+ The licenses granted in Section 2.1 with respect to any Contribution
110
+ become effective for each Contribution on the date the Contributor first
111
+ distributes such Contribution.
112
+
113
+ #### 2.3. Limitations on Grant Scope
114
+
115
+ The licenses granted in this Section 2 are the only rights granted under
116
+ this License. No additional rights or licenses will be implied from the
117
+ distribution or licensing of Covered Software under this License.
118
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
119
+ Contributor:
120
+
121
+ * **(a)** for any code that a Contributor has removed from Covered Software;
122
+ or
123
+ * **(b)** for infringements caused by: **(i)** Your and any other third party's
124
+ modifications of Covered Software, or **(ii)** the combination of its
125
+ Contributions with other software (except as part of its Contributor
126
+ Version); or
127
+ * **(c)** under Patent Claims infringed by Covered Software in the absence of
128
+ its Contributions.
129
+
130
+ This License does not grant any rights in the trademarks, service marks,
131
+ or logos of any Contributor (except as may be necessary to comply with
132
+ the notice requirements in Section 3.4).
133
+
134
+ #### 2.4. Subsequent Licenses
135
+
136
+ No Contributor makes additional grants as a result of Your choice to
137
+ distribute the Covered Software under a subsequent version of this
138
+ License (see Section 10.2) or under the terms of a Secondary License (if
139
+ permitted under the terms of Section 3.3).
140
+
141
+ #### 2.5. Representation
142
+
143
+ Each Contributor represents that the Contributor believes its
144
+ Contributions are its original creation(s) or it has sufficient rights
145
+ to grant the rights to its Contributions conveyed by this License.
146
+
147
+ #### 2.6. Fair Use
148
+
149
+ This License is not intended to limit any rights You have under
150
+ applicable copyright doctrines of fair use, fair dealing, or other
151
+ equivalents.
152
+
153
+ #### 2.7. Conditions
154
+
155
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
156
+ in Section 2.1.
157
+
158
+
159
+ ### 3. Responsibilities
160
+
161
+ #### 3.1. Distribution of Source Form
162
+
163
+ All distribution of Covered Software in Source Code Form, including any
164
+ Modifications that You create or to which You contribute, must be under
165
+ the terms of this License. You must inform recipients that the Source
166
+ Code Form of the Covered Software is governed by the terms of this
167
+ License, and how they can obtain a copy of this License. You may not
168
+ attempt to alter or restrict the recipients' rights in the Source Code
169
+ Form.
170
+
171
+ #### 3.2. Distribution of Executable Form
172
+
173
+ If You distribute Covered Software in Executable Form then:
174
+
175
+ * **(a)** such Covered Software must also be made available in Source Code
176
+ Form, as described in Section 3.1, and You must inform recipients of
177
+ the Executable Form how they can obtain a copy of such Source Code
178
+ Form by reasonable means in a timely manner, at a charge no more
179
+ than the cost of distribution to the recipient; and
180
+
181
+ * **(b)** You may distribute such Executable Form under the terms of this
182
+ License, or sublicense it under different terms, provided that the
183
+ license for the Executable Form does not attempt to limit or alter
184
+ the recipients' rights in the Source Code Form under this License.
185
+
186
+ #### 3.3. Distribution of a Larger Work
187
+
188
+ You may create and distribute a Larger Work under terms of Your choice,
189
+ provided that You also comply with the requirements of this License for
190
+ the Covered Software. If the Larger Work is a combination of Covered
191
+ Software with a work governed by one or more Secondary Licenses, and the
192
+ Covered Software is not Incompatible With Secondary Licenses, this
193
+ License permits You to additionally distribute such Covered Software
194
+ under the terms of such Secondary License(s), so that the recipient of
195
+ the Larger Work may, at their option, further distribute the Covered
196
+ Software under the terms of either this License or such Secondary
197
+ License(s).
198
+
199
+ #### 3.4. Notices
200
+
201
+ You may not remove or alter the substance of any license notices
202
+ (including copyright notices, patent notices, disclaimers of warranty,
203
+ or limitations of liability) contained within the Source Code Form of
204
+ the Covered Software, except that You may alter any license notices to
205
+ the extent required to remedy known factual inaccuracies.
206
+
207
+ #### 3.5. Application of Additional Terms
208
+
209
+ You may choose to offer, and to charge a fee for, warranty, support,
210
+ indemnity or liability obligations to one or more recipients of Covered
211
+ Software. However, You may do so only on Your own behalf, and not on
212
+ behalf of any Contributor. You must make it absolutely clear that any
213
+ such warranty, support, indemnity, or liability obligation is offered by
214
+ You alone, and You hereby agree to indemnify every Contributor for any
215
+ liability incurred by such Contributor as a result of warranty, support,
216
+ indemnity or liability terms You offer. You may include additional
217
+ disclaimers of warranty and limitations of liability specific to any
218
+ jurisdiction.
219
+
220
+
221
+ ### 4. Inability to Comply Due to Statute or Regulation
222
+
223
+ If it is impossible for You to comply with any of the terms of this
224
+ License with respect to some or all of the Covered Software due to
225
+ statute, judicial order, or regulation then You must: **(a)** comply with
226
+ the terms of this License to the maximum extent possible; and **(b)**
227
+ describe the limitations and the code they affect. Such description must
228
+ be placed in a text file included with all distributions of the Covered
229
+ Software under this License. Except to the extent prohibited by statute
230
+ or regulation, such description must be sufficiently detailed for a
231
+ recipient of ordinary skill to be able to understand it.
232
+
233
+
234
+ ### 5. Termination
235
+
236
+ **5.1.** The rights granted under this License will terminate automatically
237
+ if You fail to comply with any of its terms. However, if You become
238
+ compliant, then the rights granted under this License from a particular
239
+ Contributor are reinstated **(a)** provisionally, unless and until such
240
+ Contributor explicitly and finally terminates Your grants, and **(b)** on an
241
+ ongoing basis, if such Contributor fails to notify You of the
242
+ non-compliance by some reasonable means prior to 60 days after You have
243
+ come back into compliance. Moreover, Your grants from a particular
244
+ Contributor are reinstated on an ongoing basis if such Contributor
245
+ notifies You of the non-compliance by some reasonable means, this is the
246
+ first time You have received notice of non-compliance with this License
247
+ from such Contributor, and You become compliant prior to 30 days after
248
+ Your receipt of the notice.
249
+
250
+ **5.2.** If You initiate litigation against any entity by asserting a patent
251
+ infringement claim (excluding declaratory judgment actions,
252
+ counter-claims, and cross-claims) alleging that a Contributor Version
253
+ directly or indirectly infringes any patent, then the rights granted to
254
+ You by any and all Contributors for the Covered Software under Section
255
+ 2.1 of this License shall terminate.
256
+
257
+ **5.3.** In the event of termination under Sections 5.1 or 5.2 above, all
258
+ end user license agreements (excluding distributors and resellers) which
259
+ have been validly granted by You or Your distributors under this License
260
+ prior to termination shall survive termination.
261
+
262
+
263
+ ### 6. Disclaimer of Warranty
264
+
265
+ > Covered Software is provided under this License on an “as is”
266
+ > basis, without warranty of any kind, either expressed, implied, or
267
+ > statutory, including, without limitation, warranties that the
268
+ > Covered Software is free of defects, merchantable, fit for a
269
+ > particular purpose or non-infringing. The entire risk as to the
270
+ > quality and performance of the Covered Software is with You.
271
+ > Should any Covered Software prove defective in any respect, You
272
+ > (not any Contributor) assume the cost of any necessary servicing,
273
+ > repair, or correction. This disclaimer of warranty constitutes an
274
+ > essential part of this License. No use of any Covered Software is
275
+ > authorized under this License except under this disclaimer.
276
+
277
+ ### 7. Limitation of Liability
278
+
279
+ > Under no circumstances and under no legal theory, whether tort
280
+ > (including negligence), contract, or otherwise, shall any
281
+ > Contributor, or anyone who distributes Covered Software as
282
+ > permitted above, be liable to You for any direct, indirect,
283
+ > special, incidental, or consequential damages of any character
284
+ > including, without limitation, damages for lost profits, loss of
285
+ > goodwill, work stoppage, computer failure or malfunction, or any
286
+ > and all other commercial damages or losses, even if such party
287
+ > shall have been informed of the possibility of such damages. This
288
+ > limitation of liability shall not apply to liability for death or
289
+ > personal injury resulting from such party's negligence to the
290
+ > extent applicable law prohibits such limitation. Some
291
+ > jurisdictions do not allow the exclusion or limitation of
292
+ > incidental or consequential damages, so this exclusion and
293
+ > limitation may not apply to You.
294
+
295
+
296
+ ### 8. Litigation
297
+
298
+ Any litigation relating to this License may be brought only in the
299
+ courts of a jurisdiction where the defendant maintains its principal
300
+ place of business and such litigation shall be governed by laws of that
301
+ jurisdiction, without reference to its conflict-of-law provisions.
302
+ Nothing in this Section shall prevent a party's ability to bring
303
+ cross-claims or counter-claims.
304
+
305
+
306
+ ### 9. Miscellaneous
307
+
308
+ This License represents the complete agreement concerning the subject
309
+ matter hereof. If any provision of this License is held to be
310
+ unenforceable, such provision shall be reformed only to the extent
311
+ necessary to make it enforceable. Any law or regulation which provides
312
+ that the language of a contract shall be construed against the drafter
313
+ shall not be used to construe this License against a Contributor.
314
+
315
+
316
+ ### 10. Versions of the License
317
+
318
+ #### 10.1. New Versions
319
+
320
+ Mozilla Foundation is the license steward. Except as provided in Section
321
+ 10.3, no one other than the license steward has the right to modify or
322
+ publish new versions of this License. Each version will be given a
323
+ distinguishing version number.
324
+
325
+ #### 10.2. Effect of New Versions
326
+
327
+ You may distribute the Covered Software under the terms of the version
328
+ of the License under which You originally received the Covered Software,
329
+ or under the terms of any subsequent version published by the license
330
+ steward.
331
+
332
+ #### 10.3. Modified Versions
333
+
334
+ If you create software not governed by this License, and you want to
335
+ create a new license for such software, you may create and use a
336
+ modified version of this License if you rename the license and remove
337
+ any references to the name of the license steward (except to note that
338
+ such modified license differs from this License).
339
+
340
+ #### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
341
+
342
+ If You choose to distribute Source Code Form that is Incompatible With
343
+ Secondary Licenses under the terms of this version of the License, the
344
+ notice described in Exhibit B of this License must be attached.
345
+
346
+ ## Exhibit A - Source Code Form License Notice
347
+
348
+ This Source Code Form is subject to the terms of the Mozilla Public
349
+ License, v. 2.0. If a copy of the MPL was not distributed with this
350
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
351
+
352
+ If it is not possible or desirable to put the notice in a particular
353
+ file, then You may include the notice in a location (such as a LICENSE
354
+ file in a relevant directory) where a recipient would be likely to look
355
+ for such a notice.
356
+
357
+ You may add additional accurate notices of copyright ownership.
358
+
359
+ ## Exhibit B - “Incompatible With Secondary Licenses” Notice
360
+
361
+ This Source Code Form is "Incompatible With Secondary Licenses", as
362
+ defined by the Mozilla Public License, v. 2.0.
363
+
364
+
@@ -0,0 +1,11 @@
1
+ include README.md
2
+ include LICENSE.md
3
+ include pyproject.toml
4
+ include setup.py
5
+ include MANIFEST.in
6
+ recursive-include bwa *.h *.c *.a *.o
7
+ recursive-include bwamem *.py *.c
8
+ recursive-include tests *.py
9
+ global-exclude *.pyc
10
+ global-exclude __pycache__
11
+ global-exclude .git*
bwamem-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,230 @@
1
+ Metadata-Version: 2.4
2
+ Name: bwamem
3
+ Version: 0.0.1
4
+ Summary: Bindings to bwa aligner
5
+ Author-email: Chang Ye <yech1990@gmail.com>
6
+ Maintainer-email: Chang Ye <yech1990@gmail.com>
7
+ License-Expression: MPL-2.0
8
+ Project-URL: Homepage, https://github.com/y9c/bwamem
9
+ Project-URL: Repository, https://github.com/y9c/bwamem
10
+ Project-URL: Documentation, https://y9c.github.io/bwamem/
11
+ Project-URL: Bug Tracker, https://github.com/y9c/bwamem/issues
12
+ Keywords: bioinformatics,alignment,bwa,genomics
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Programming Language :: C
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE.md
28
+ Requires-Dist: cffi>=1.0.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=6.0; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Requires-Dist: ruff; extra == "dev"
33
+ Requires-Dist: twine; extra == "dev"
34
+ Provides-Extra: docs
35
+ Requires-Dist: sphinx; extra == "docs"
36
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
37
+ Dynamic: license-file
38
+
39
+ bwamem
40
+ ======
41
+
42
+ Python bindings to `bwa mem` aligner; sufficient to load and index and perform
43
+ alignments of sequences to the index to obtain basic statistics.
44
+
45
+ These python bindings are licensed under Mozilla Public License 2.0, bwa is licenced
46
+ under GNU General Public License v3.0.
47
+
48
+ Documentation can be found at https://y9c.github.io/bwamem/.
49
+
50
+ Installation
51
+ ------------
52
+
53
+ The git source repository contains bwa as a submodule. The repository should therefore
54
+ be cloned using the recursive option.
55
+
56
+ The package `setup.py` script requires `libbwa.a` to have been built in the submodule
57
+ directory before running. This can be performed via the `libbwa.a` target, which first
58
+ makes some amendments to the bwa/Makefile. To build and install the package one should
59
+ therefore run:
60
+
61
+ git clone --recursive https://github.com/y9c/bwamem.git
62
+ cd bwamem
63
+ make bwa/libbwa.a
64
+ python setup.py install
65
+
66
+
67
+ Building BWA Indexes
68
+ --------------------
69
+
70
+ The `BwaIndexer` class provides a pythonic interface to build BWA indexes from
71
+ FASTA files. It supports different BWT construction algorithms:
72
+
73
+ ```python
74
+ from bwamem import BwaIndexer
75
+
76
+ # Create indexer with default settings (auto algorithm)
77
+ indexer = BwaIndexer()
78
+
79
+ # Build index from FASTA file
80
+ index_path = indexer.build_index('reference.fa')
81
+ print(f'Index built at: {index_path}')
82
+
83
+ # Use specific algorithm
84
+ indexer = BwaIndexer(algorithm='is') # or 'rb2', 'bwtsw', 'auto'
85
+ index_path = indexer.build_index('reference.fa', prefix='my_index')
86
+ ```
87
+
88
+ Available algorithms:
89
+ - `auto`: Automatically choose algorithm based on genome size
90
+ - `rb2`: RB2 algorithm (good for medium genomes)
91
+ - `bwtsw`: BWT-SW algorithm (good for large genomes)
92
+ - `is`: IS algorithm (good for small genomes)
93
+
94
+ Performing Alignments
95
+ ---------------------
96
+
97
+ The `BwaAligner` class provides a pythonic interface to `bwa mem` aligner. It
98
+ takes as input a bwa index fileset on construction and can then be used to find
99
+ alignments of sequences given as strings.
100
+
101
+ ### Single-End Alignment
102
+
103
+ For single-end reads, use the `align()` method with one sequence:
104
+
105
+ ```python
106
+ from bwamem import BwaAligner, Alignment
107
+ index = 'path/to/index' # the path given to bwa index
108
+ seq = 'ACGATCGCGATCGA'
109
+
110
+ aligner = BwaAligner(index)
111
+ alignments = aligner.align(seq) # Returns tuple of Alignment objects
112
+ print('Found {} alignments.'.format(len(alignments)))
113
+ for aln in alignments:
114
+ print(f' {aln.rname}:{aln.pos} {aln.orient} {aln.cigar} (mapq={aln.mapq}, score={aln.score})')
115
+ ```
116
+
117
+ ### Paired-End Alignment
118
+
119
+ For paired-end reads, use the `align()` method with two sequences:
120
+
121
+ ```python
122
+ from bwamem import BwaAligner, PairedAlignment
123
+ index = 'path/to/index'
124
+ read1 = 'ACGATCGCGATCGA'
125
+ read2 = 'TTCGATCGATCGAT'
126
+
127
+ aligner = BwaAligner(index)
128
+ paired_alignments = aligner.align(read1, read2) # Returns tuple of PairedAlignment objects
129
+ print('Found {} paired alignments.'.format(len(paired_alignments)))
130
+ for pe_aln in paired_alignments:
131
+ print(f' Read1: {pe_aln.read1.rname}:{pe_aln.read1.pos} {pe_aln.read1.orient}')
132
+ print(f' Read2: {pe_aln.read2.rname}:{pe_aln.read2.pos} {pe_aln.read2.orient}')
133
+ print(f' Proper pair: {pe_aln.is_proper_pair}, Insert size: {pe_aln.insert_size}')
134
+ ```
135
+
136
+ ### Custom Insert Size Distribution
137
+
138
+ For paired-end reads, you can specify the expected insert size distribution:
139
+
140
+ ```python
141
+ # With custom insert size parameters
142
+ paired_alignments = aligner.align(read1, read2, insert_size=500, insert_std=50)
143
+ ```
144
+
145
+ ### Data Structures
146
+
147
+ **Alignment** (for single-end reads):
148
+ ```python
149
+ Alignment(rname='chr1', orient='+', pos=1000, mapq=60, cigar='100M', NM=0, score=100, is_primary=True)
150
+ ```
151
+
152
+ **PairedAlignment** (for paired-end reads):
153
+ ```python
154
+ PairedAlignment(read1=Alignment(...), read2=Alignment(...), is_proper_pair=True, insert_size=500)
155
+ ```
156
+
157
+ ### Alignment Parameters
158
+
159
+ Alignment parameters can be given as they are on the `bwa mem` command line:
160
+
161
+ ```python
162
+ from bwamem import BwaAligner
163
+ index = 'path/to/index'
164
+ options = '-x ont2d -A 1 -B 0'
165
+ aligner = BwaAligner(index, options=options)
166
+ ```
167
+
168
+ The package now supports all BWA MEM options including paired-end specific parameters like insert size distribution (`-I` option).
169
+
170
+ Complete Workflow Example
171
+ -------------------------
172
+
173
+ Here's a complete example showing how to build an index and perform both single-end and paired-end alignments:
174
+
175
+ ```python
176
+ from bwamem import BwaIndexer, BwaAligner, Alignment, PairedAlignment
177
+
178
+ # Step 1: Build index from FASTA file
179
+ indexer = BwaIndexer(algorithm='auto')
180
+ index_path = indexer.build_index('reference.fa')
181
+ print(f'Index built at: {index_path}')
182
+
183
+ # Step 2: Create aligner with the index
184
+ aligner = BwaAligner(index_path)
185
+
186
+ # Step 3a: Single-end alignment
187
+ print("Single-end alignments:")
188
+ se_sequences = ['ACGATCGCGATCGA', 'GCTAGCTAGCTAG']
189
+ for i, seq in enumerate(se_sequences, 1):
190
+ alignments = aligner.align(seq)
191
+ print(f'Found {len(alignments)} alignments for sequence {i}')
192
+ for aln in alignments:
193
+ print(f' {aln.rname}:{aln.pos} {aln.orient} {aln.cigar} (mapq={aln.mapq})')
194
+
195
+ # Step 3b: Paired-end alignment
196
+ print("\nPaired-end alignments:")
197
+ pe_reads = [
198
+ ('ACGATCGCGATCGA', 'TTCGATCGATCGAT'),
199
+ ('GCTAGCTAGCTAG', 'CGATCGATCGATC')
200
+ ]
201
+ for i, (read1, read2) in enumerate(pe_reads, 1):
202
+ paired_alignments = aligner.align(read1, read2)
203
+ print(f'Found {len(paired_alignments)} paired alignments for read pair {i}')
204
+ for pe_aln in paired_alignments:
205
+ print(f' Read1: {pe_aln.read1.rname}:{pe_aln.read1.pos} {pe_aln.read1.orient}')
206
+ print(f' Read2: {pe_aln.read2.rname}:{pe_aln.read2.pos} {pe_aln.read2.orient}')
207
+ print(f' Proper pair: {pe_aln.is_proper_pair}, Insert size: {pe_aln.insert_size}')
208
+
209
+ # Step 3c: Paired-end with custom insert size
210
+ print("\nPaired-end with custom insert size:")
211
+ pe_alignments = aligner.align('ACGATCGCGATCGA', 'TTCGATCGATCGAT',
212
+ insert_size=500, insert_std=50)
213
+ print(f'Found {len(pe_alignments)} alignments with custom insert size')
214
+ ```
215
+
216
+ ### Advanced Paired-End Features
217
+
218
+ ```python
219
+ # Filter for proper pairs only
220
+ proper_pairs = [pe for pe in pe_alignments if pe.is_proper_pair]
221
+ print(f'Found {len(proper_pairs)} proper pairs')
222
+
223
+ # Access individual read alignments
224
+ for pe_aln in pe_alignments:
225
+ read1_aln = pe_aln.read1
226
+ read2_aln = pe_aln.read2
227
+ if read1_aln.is_primary and read2_aln.is_primary:
228
+ print(f'Primary alignment: {read1_aln.rname}:{read1_aln.pos}-{read2_aln.pos}')
229
+
230
+ ```