├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── amplicov ├── amplicov └── amplicov_pdf ├── requirements.txt ├── setup.py └── tests ├── coverage.txt ├── input.bam ├── input.bed ├── input.bedpe ├── input.gff ├── output.html ├── output.txt └── runTest.sh /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | tests/tmpOut 3 | dist 4 | amplicov.egg-info 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | sudo: false 3 | 4 | python: 5 | - "3.8" 6 | 7 | 8 | install: 9 | - pip install coverage 10 | - pip install -e . 11 | 12 | script: 13 | - coverage run amplicov/amplicov --help 14 | - coverage run amplicov/amplicov --version 15 | - coverage run amplicov/amplicov --bed tests/input.bed --cov tests/coverage.txt --prefix output --outdir tests/output 16 | - coverage run amplicov/amplicov --bed tests/input.bed --bam tests/input.bam --prefix output --outdir tests/output 17 | - coverage run amplicov/amplicov --bedpe tests/input.bedpe --pp --bam tests/input.bam --prefix output --outdir tests/output 18 | - coverage run amplicov/amplicov --depth_lines 5 10 20 50 --mincov 10 --gff tests/input.gff --bed tests/input.bed --bam tests/input.bam --prefix output --outdir tests/output 19 | - coverage run amplicov/amplicov -r "NC_045512_2" --gff tests/input.gff --bed tests/input.bed --bam tests/input.bam --prefix output --outdir tests/output 20 | 21 | after_success: 22 | - bash <(curl -s https://codecov.io/bash) 23 | 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # amplicon_coverage_plot 2 | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14285656.svg)](https://doi.org/10.5281/zenodo.14285656) 3 | [![Anaconda-Server Badge](https://anaconda.org/bioconda/amplicon_coverage_plot/badges/version.svg)](https://anaconda.org/bioconda/amplicon_coverage_plot) 4 | [![Build Status](https://travis-ci.org/chienchi/amplicon_coverage_plot.svg?branch=master)](https://travis-ci.org/chienchi/amplicon_coverage_plot) 5 | [![codecov](https://codecov.io/gh/chienchi/amplicon_coverage_plot/branch/master/graph/badge.svg)](https://codecov.io/gh/chienchi/amplicon_coverage_plot) 6 | [![PyPI version](https://badge.fury.io/py/amplicov.svg)](https://badge.fury.io/py/amplicov) 7 | 8 | The script will generate an [interactive barplot](https://chienchi.github.io/amplicon_coverage_plot/index.html) given amplicon info in [bed6/bedpe](https://bedtools.readthedocs.io/en/latest/content/general-usage.html) format and coverage information in cov/bam file. 9 | 10 | ## Dependencies 11 | 12 | ### Programming/Scripting languages 13 | - [Python >=v3.8](https://www.python.org/) 14 | - The pipeline has been tested in v3.8.10 15 | 16 | ### Python packages 17 | - [numpy >=1.15.1](http://www.numpy.org/) 18 | - [plotly >=4.7.1](https://plotly.com/python/) 19 | - [pysam >= 0.15.4](https://github.com/pysam-developers/pysam) 20 | 21 | ### Third party softwares/packages 22 | - [samtools >=1.9](http://www.htslib.org) - process bam file 23 | 24 | ## Installation 25 | 26 | ### Install by pip 27 | 28 | ``` 29 | pip install amplicov 30 | ``` 31 | 32 | ### Install by conda 33 | 34 | ``` 35 | conda install -c bioconda amplicon_coverage_plot 36 | ``` 37 | 38 | ### Install from source 39 | Clone the `amplicon_coverage_plot` repository. 40 | 41 | ``` 42 | git clone https://github.com/chienchi/amplicon_coverage_plot 43 | ``` 44 | 45 | Then change directory to `amplicon_coverage_plot` and install. 46 | 47 | ``` 48 | cd amplicon_coverage_plot 49 | python setup.py install 50 | ``` 51 | 52 | If the installation was succesful, you should be able to type `amplicov -h` and get a help message on how to use the tool. 53 | 54 | ``` 55 | amplicov -h 56 | ``` 57 | 58 | 59 | ## Usage 60 | ``` 61 | usage: amplicov [-h] (--bed [FILE] | --bedpe [FILE]) 62 | (--bam [FILE] | --cov [FILE]) [-o [PATH]] [-p [STR]] [--pp] 63 | [--mincov [INT]] [--version] 64 | 65 | Script to parse amplicon region coverage and generate barplot in html 66 | 67 | optional arguments: 68 | -h, --help show this help message and exit 69 | --pp process proper paired only reads from bam file 70 | (illumina) 71 | --count_primer count overlapped primer region to unqiue coverage 72 | --mincov [INT] minimum coverage to count as ambiguous N site 73 | [default:10] 74 | -r [STR], --refID [STR] 75 | reference accession (bed file first field) 76 | --depth_lines DEPTH_LINES [DEPTH_LINES ...] 77 | Add option to display lines at these depths (provide depths as a list of integers) [default:5 10 20 50] 78 | --gff [FILE] gff file for data hover info annotation 79 | --version show program's version number and exit 80 | 81 | Amplicon Input (required, mutually exclusive): 82 | --bed [FILE] amplicon bed file (bed6 format) 83 | --bedpe [FILE] amplicon bedpe file 84 | 85 | Coverage Input (required, mutually exclusive): 86 | --bam [FILE] sorted bam file (ex: samtools sort input.bam -o 87 | sorted.bam) 88 | --cov [FILE] coverage file [position coverage] 89 | 90 | Output: 91 | -o [PATH], --outdir [PATH] 92 | output directory 93 | -p [STR], --prefix [STR] 94 | output prefix 95 | ``` 96 | 97 | ## Test 98 | 99 | ``` 100 | cd tests 101 | ./runTest.sh 102 | ``` 103 | 104 | ## Outputs 105 | 106 | -- prefix_amplicon_coverage.txt 107 | 108 | | ID | Whole_Amplicon | Unique | Whole_Amplicon_Ns(cov<10) | Unique_Amplicon_Ns(cov<10) | 109 | |-------------|----------------|---------|---------------------------|----------------------------| 110 | | nCoV-2019_1 | 217.74 | 53.00 | 0.00 | 0.00 | 111 | | nCoV-2019_2 | 1552.83 | 1235.50 | 0.00 | 0.00 | 112 | | nCoV-2019_3 | 3164.22 | 2831.73 | 0.00 | 0.00 | 113 | | nCoV-2019_4 | 2005.16 | 1658.00 | 0.00 | 0.00 | 114 | | etc... | | | | | 115 | 116 | #### Table Header Definition in the amplicon_coverage.txt 117 | 118 | Screen Shot 2020-06-15 at 3 29 53 PM 119 | 120 | * Whole_Amplicon_Ns(cov<10): The number of aligned position with coverage < 10 or (--mincov) in the Whole Amplicon region 121 | 122 | * Unique_Amplicon_Ns(cov<10): The number of aligned position with coverage < 10 or (--mincov) in the Unique region 123 | 124 | -- prefix_amplicon_coverage.html 125 | 126 | ```color black for < 5x and blue for <20x``` 127 | 128 | ![html](https://user-images.githubusercontent.com/737589/105805303-f2ccba80-5f5e-11eb-8338-63bd51bd426d.png) 129 | 130 | -------------------------------------------------------------------------------- /amplicov/amplicov: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import os, errno, sys 3 | import argparse as ap 4 | import numpy as np 5 | import csv 6 | import subprocess 7 | import plotly.graph_objects as go 8 | from plotly.subplots import make_subplots 9 | from pathlib import Path 10 | import pysam 11 | from collections import defaultdict 12 | 13 | # standardize the logging output 14 | import logging 15 | this_script=os.path.basename(__file__) 16 | logging.basicConfig(format='['+this_script+'] %(levelname)s:%(message)s', level=logging.INFO) 17 | 18 | class SmartFormatter(ap.HelpFormatter): 19 | def _split_lines(self, text, width): 20 | if text.startswith('R|'): 21 | return text[2:].splitlines() 22 | # this is the RawTextHelpFormatter._split_lines 23 | return ap.HelpFormatter._split_lines(self, text, width) 24 | 25 | def setup_argparse(): 26 | parser = ap.ArgumentParser(prog='amplicov', 27 | description = '''Script to parse amplicon region coverage and generate barplot in html''', 28 | formatter_class = SmartFormatter) 29 | 30 | inGrp = parser.add_argument_group('Amplicon Input (required, mutually exclusive)') 31 | inGrp_me = inGrp.add_mutually_exclusive_group(required=True) 32 | inGrp_me.add_argument('--bed', metavar='[FILE]', type=str,help='amplicon bed file (bed6 format)') 33 | inGrp_me.add_argument('--bedpe', metavar='[FILE]', type=str,help='amplicon bedpe file') 34 | 35 | covGrp = parser.add_argument_group('Coverage Input (required, mutually exclusive)') 36 | covGrp_me = covGrp.add_mutually_exclusive_group(required=True) 37 | covGrp_me.add_argument('--bam', metavar='[FILE]', type=str,help='sorted bam file (ex: samtools sort input.bam -o sorted.bam)') 38 | covGrp_me.add_argument('--cov', metavar='[FILE]', type=str,help='coverage file [position\tcoverage]') 39 | 40 | outGrp = parser.add_argument_group('Output') 41 | outGrp.add_argument('-o', '--outdir', metavar='[PATH]',type=str, default='.', help='output directory') 42 | outGrp.add_argument('-p', '--prefix', metavar='[STR]',type=str , help='output prefix') 43 | 44 | #optGrp = parser.add_argument_group('Options') 45 | parser.add_argument('--pp', action='store_true', help='process proper paired only reads from bam file (illumina)') 46 | parser.add_argument('--count_primer', action='store_true', help='count overlapped primer region to unqiue coverage') 47 | parser.add_argument('--mincov', metavar='[INT]', type=int, help='minimum coverage to count as ambiguous N site [default:10]', default=10) 48 | parser.add_argument('-r', '--refID', metavar='[STR]',type=str , help='reference accession (bed file first field)') 49 | 50 | parser.add_argument('--depth_lines', default=[5,10,20,50], type=int, nargs='+', help='Add option to display lines at these depths (provide depths as a list of integers) [default:5 10 20 50]') 51 | parser.add_argument('--gff', metavar='[FILE]', type=str, help='gff file for data hover info annotation') 52 | parser.add_argument('--version', action='version', version='%(prog)s 0.3.4') 53 | args_parsed = parser.parse_args() 54 | if not args_parsed.outdir: 55 | args_parsed.outdir = os.getcwd() 56 | 57 | return args_parsed 58 | 59 | def mkdir_p(directory_name): 60 | try: 61 | os.makedirs(directory_name) 62 | except OSError as exc: 63 | if exc.errno == errno.EEXIST and os.path.isdir(directory_name): 64 | pass 65 | 66 | 67 | 68 | def is_bed6(input): 69 | with open(input,'r') as f: 70 | bedline=[] 71 | num=0 72 | for line in f: 73 | bedline = line.rstrip().split("\t") 74 | num += 1 75 | if (len(bedline) != 6 or not bedline[1].isnumeric() or not bedline[2].isnumeric()): 76 | logging.error(f"The input bed file is not in bed6 format.\nline:{num} {line}") 77 | sys.exit(1) 78 | 79 | def convert_bed_to_amplicon_dict(input,cov_array,RefID="",unique=False, count_primer=False): 80 | ## convert bed file to amplicon region dictionary 81 | input_bed = input 82 | cov_zero_array = np.zeros_like(cov_array) 83 | amplicon=defaultdict(dict) 84 | primers_pos=list() 85 | if RefID: 86 | cmd = 'grep -v alt %s | grep -w %s | paste - - | cut -f 2,3,4,8,9 | sed -e "s/_LEFT//g" -e "s/_RIGHT//g" ' % (input_bed, RefID) 87 | else: 88 | cmd = 'grep -v alt %s | paste - - | cut -f 2,3,4,8,9 | sed -e "s/_LEFT//g" -e "s/_RIGHT//g" ' % (input_bed) 89 | 90 | proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) 91 | previous_id='' 92 | outs, errs = proc.communicate() 93 | if proc.returncode == 0: 94 | outs = outs.splitlines() 95 | else: 96 | logging.error("Failed %d %s %s" % (proc.returncode, outs, errs)) 97 | 98 | for i in range(len(outs)): 99 | fstart, fend, id, rstart, rend = outs[i].decode().rstrip().split("\t") 100 | if id in amplicon: 101 | continue 102 | amplicon[id]=range(int(fend),int(rstart)) 103 | primers_pos.extend(range(int(fstart),int(fend))) 104 | primers_pos.extend(range(int(rstart),int(rend))) 105 | for i in range(int(fend),int(rstart)): 106 | cov_zero_array[i] += 1 107 | 108 | if unique: 109 | unique_region_set = set(np.where(cov_zero_array == 1)[0]) if count_primer else set(np.where(cov_zero_array == 1)[0]) - set(primers_pos) 110 | for i in range(len(outs)): 111 | fstart, fend, id, rstart, rend = outs[i].decode().rstrip().split("\t") 112 | unique_region = sorted(unique_region_set.intersection(set(range(int(fend),int(rstart))))) 113 | if unique_region: 114 | amplicon[id] = range(list(unique_region)[0],list(unique_region)[-1]+1) 115 | else: 116 | amplicon[id] = range(0) 117 | 118 | return amplicon 119 | 120 | def convert_bedpe_to_amplicon_dict(input,cov_array,RefID="",unique=False, count_primer=False): 121 | ## convert bed file to amplicon region dictionary 122 | input_bedpe = input 123 | cov_zero_array = np.zeros_like(cov_array) 124 | amplicon=defaultdict(dict) 125 | primers_pos=list() 126 | if RefID: 127 | cmd = 'grep -w %s %s | cut -f 2,3,5,6,7 ' % (RefID, input_bedpe) 128 | else: 129 | cmd = 'cut -f 2,3,5,6,7 %s ' % (input_bedpe) 130 | proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) 131 | previous_id='' 132 | outs, errs = proc.communicate() 133 | if proc.returncode == 0: 134 | outs = outs.splitlines() 135 | else: 136 | logging.error("Failed %d %s %s" % (proc.returncode, outs, errs)) 137 | 138 | for i in range(len(outs)): 139 | fstart, fend, rstart, rend, id = outs[i].decode().rstrip().split("\t") 140 | if id in amplicon: 141 | continue 142 | amplicon[id]=range(int(fend),int(rstart)) 143 | primers_pos.extend(range(int(fstart),int(fend))) 144 | primers_pos.extend(range(int(rstart),int(rend))) 145 | for i in range(int(fend),int(rstart)): 146 | cov_zero_array[i] += 1 147 | 148 | if unique: 149 | unique_region_set = set(np.where(cov_zero_array == 1)[0]) if count_primer else set(np.where(cov_zero_array == 1)[0]) - set(primers_pos) 150 | for i in range(len(outs)): 151 | fstart, fend, rstart, rend, id = outs[i].decode().rstrip().split("\t") 152 | unique_region = sorted(unique_region_set.intersection(set(range(int(fend),int(rstart))))) 153 | if unique_region: 154 | amplicon[id] = range(list(unique_region)[0],list(unique_region)[-1]+1) 155 | else: 156 | amplicon[id] = range(0) 157 | 158 | return amplicon 159 | 160 | def parse_gff_file(input,RefID): 161 | gff_file = input 162 | anno_dict = defaultdict(dict) 163 | f = open(gff_file,'r') 164 | for line in f: 165 | if line.startswith("#"): 166 | continue 167 | else: 168 | gffline = line.rstrip().split("\t") 169 | gff_ref_id = gffline[0].replace(".","_") 170 | if len(gffline) > 2 and gffline[2] == "CDS": 171 | if RefID and (RefID != gff_ref_id and RefID != gffline[0]): 172 | continue 173 | annotations = dict(x.split("=") for x in gffline[8].split(";")) 174 | for i in range(int(gffline[3]),int(gffline[4])+1): 175 | anno_dict[i]['name']= annotations['Name'] if 'Name' in annotations else '' 176 | anno_dict[i]['locus_tag']= annotations['locus_tag'] if 'locus_tag' in annotations else '' 177 | anno_dict[i]['product']= annotations['product'] if 'product' in annotations else '' 178 | anno_dict[i]['protein_id']= annotations['protein_id'] if 'protein_id' in annotations else '' 179 | f.close() 180 | return anno_dict 181 | 182 | def parse_cov_file(input): 183 | ## read the coverage and save in a list 184 | cov_file = input 185 | cov_list = [] 186 | with open(cov_file,'r') as cov_file: 187 | for line in cov_file: 188 | pos, cov = line.rstrip().split("\t") 189 | cov_list.append(int(cov)) 190 | 191 | cov_array=np.array(cov_list) 192 | return cov_array 193 | 194 | def parse_bam_file(bam,pp,outdir,RefID): 195 | 196 | bam_input = bam 197 | if pp: 198 | bam_prefix = Path(bam).stem 199 | bam_input = outdir + os.sep + bam_prefix + ".pp.bam" 200 | samfile = pysam.AlignmentFile(bam, "rb") 201 | ppcount=0; 202 | allcount=0; 203 | proper_pairedreads = pysam.AlignmentFile(bam_input, "wb", template=samfile) 204 | for read in samfile.fetch(until_eof=True): 205 | allcount+=1 206 | if read.is_proper_pair: 207 | ppcount+=1; 208 | proper_pairedreads.write(read) 209 | 210 | proper_pairedreads.close() 211 | samfile.close() 212 | logging.info("Total Reads: %d" % (allcount)) 213 | logging.info("Proper Paired Reads: %d" % (ppcount)) 214 | if ppcount==0: 215 | logging.error("Failed: There is no proper paired reads in your input file %s." % (bam)) 216 | sys.exit() 217 | 218 | cov_list = [] 219 | for line in pysam.samtools.depth("-aa","-d0", bam_input ,split_lines=True): 220 | id, pos, cov = line.rstrip().split("\t") 221 | if RefID and RefID == id: 222 | cov_list.append(int(cov)) 223 | else: 224 | cov_list.append(int(cov)) 225 | cov_array=np.array(cov_list) 226 | return cov_array 227 | 228 | def calculate_mean_cov_per_amplicon(cov_np_array,amplicon_d, anno_d): 229 | mean_dict=defaultdict(dict) 230 | for key in amplicon_d: 231 | if amplicon_d[key]: 232 | start = amplicon_d[key][0] 233 | end = amplicon_d[key][-1] 234 | #print(key,start,end) 235 | mean_dict[key]['cov'] = 0 if start > cov_np_array.size else cov_np_array[start:end+1].mean() 236 | mean_dict[key]['range'] = f"{start + 1} - {end + 1}" 237 | if anno_d: 238 | for i in range(start, end + 1): 239 | if anno_d[i]: 240 | mean_dict[key]['product'] = anno_d[i]['product'] 241 | mean_dict[key]['name'] = anno_d[i]['name'] 242 | mean_dict[key]['locus_tag'] = anno_d[i]['locus_tag'] 243 | mean_dict[key]['protein_id'] = anno_d[i]['protein_id'] 244 | else: 245 | # not have any range in this key region 246 | mean_dict[key]['cov'] = 0 247 | 248 | 249 | 250 | return mean_dict 251 | 252 | def calculate_N_per_amplicon(cov_np_array,amplicon_d, mincov): 253 | num_low_depth=dict() 254 | for key in amplicon_d: 255 | if amplicon_d[key]: 256 | start = amplicon_d[key][0] 257 | end = amplicon_d[key][-1] 258 | if start > cov_np_array.size: 259 | num_low_depth[key] = 0 260 | else: 261 | arr = cov_np_array[start:end+1] 262 | num_low_depth[key] = np.size(np.where(arr < mincov)) 263 | else: 264 | # not have any range in this key region 265 | num_low_depth[key] = 0 266 | return num_low_depth 267 | 268 | def write_dict_to_file(mean_d,uniq_mean_d,ambiguity_d,uniq_ambiguity_d,outdir,prefix,mincov): 269 | output_amplicon_cov_txt = outdir + os.sep + prefix + '_amplicon_coverage.txt' 270 | try: 271 | os.remove(output_amplicon_cov_txt) 272 | except OSError: 273 | pass 274 | with open(output_amplicon_cov_txt,"w") as f: 275 | f.write(f"ID\tWhole_Amplicon\tUnique_Amplicon\tWhole_Amplicon_Ns(cov<{mincov})\tUnique_Amplicon_Ns(cov<{mincov})\n") 276 | for key in mean_d: 277 | f.write("%s\t%.2f\t%.2f\t%.2f\t%.2f\n" % 278 | ( 279 | key, 280 | mean_d[key]['cov'],uniq_mean_d[key]['cov'], 281 | ambiguity_d[key],uniq_ambiguity_d[key] 282 | ) 283 | ) 284 | 285 | 286 | def barplot(mean_dict,uniq_mean_d,ambiguity_d,uniq_ambiguity_d,input_bed,overall_mean,outdir,prefix,mincov,depth_lines=[5,10,20,50]): 287 | #plot bar chart 288 | x_name=Path(input_bed).stem 289 | x=list(mean_dict.keys()) 290 | y=[ mean_dict[k]['cov'] for k in x ] 291 | anno_list=list(mean_dict.keys()) 292 | for i in range(0,len(x)): 293 | k=x[i] 294 | if 'product' in mean_dict[k]: 295 | anno_list[i] = "Product: " + mean_dict[k]['product'] + "
" 296 | if 'name' in mean_dict[k]: 297 | anno_list[i] += "name: " + mean_dict[k]['name'] + "
" 298 | if 'protein_id' in mean_dict[k]: 299 | anno_list[i] += "protein_id: " + mean_dict[k]['protein_id'] + "
" 300 | if 'locus_tag' in mean_dict[k]: 301 | anno_list[i] += "locus_tag: " + mean_dict[k]['locus_tag'] + "
" 302 | if 'range' in mean_dict[k]: 303 | anno_list[i] += "range: " + mean_dict[k]['range'] + "
" 304 | uniq_x=list(uniq_mean_d.keys()) 305 | uniq_y=[ uniq_mean_d[k]['cov'] for k in uniq_x ] 306 | uniq_anno_list=list(uniq_mean_d.keys()) 307 | for i in range(0,len(uniq_x)): 308 | k=uniq_x[i] 309 | if 'product' in uniq_mean_d[k]: 310 | uniq_anno_list[i] = "Product: " + uniq_mean_d[k]['product'] + "
" 311 | if 'name' in uniq_mean_d[k]: 312 | uniq_anno_list[i] += "name: " + uniq_mean_d[k]['name'] + "
" 313 | if 'protein_id' in uniq_mean_d[k]: 314 | uniq_anno_list[i] += "protein_id: " + uniq_mean_d[k]['protein_id'] + "
" 315 | if 'locus_tag' in uniq_mean_d[k]: 316 | uniq_anno_list[i] += "locus_tag: " + uniq_mean_d[k]['locus_tag'] + "
" 317 | if 'range' in uniq_mean_d[k]: 318 | uniq_anno_list[i] += "range: " + uniq_mean_d[k]['range'] + "
" 319 | barcolor1 = ['lightsalmon' if i >= 20 else 'blue' if i >5 else 'black' for i in y] 320 | barcolor2 = ['lightsalmon' if i >= 20 else 'blue' if i >5 else 'black' for i in uniq_y] 321 | fig = make_subplots(specs=[[{"secondary_y": True}]]) 322 | 323 | # coverage levels 324 | if anno_list == x : 325 | fig.add_trace( 326 | go.Bar(x=uniq_x,y=uniq_y,marker_color=barcolor2,visible=True,name="Coverage",showlegend=False, 327 | hovertemplate="Coverage: %{y:.1f}" + ""), 328 | secondary_y=False 329 | ) 330 | fig.add_trace( 331 | go.Bar(x=x, y=y, marker_color=barcolor1,visible=False,name="Coverage",showlegend=False, 332 | hovertemplate="Coverage: %{y:.1f}" + ""), 333 | secondary_y=False 334 | ) 335 | else: 336 | fig.add_trace( 337 | go.Bar(x=uniq_x,y=uniq_y,marker_color=barcolor2,visible=True,name="Coverage",showlegend=False, text=uniq_anno_list, 338 | hovertemplate="Coverage: %{y:.1f}
" + "%{text}" + ""), 339 | secondary_y=False 340 | ) 341 | fig.add_trace( 342 | go.Bar(x=x, y=y, marker_color=barcolor1,visible=False,name="Coverage",showlegend=False, text=anno_list, 343 | hovertemplate="Coverage: %{y:.1f}
" + "%{text}" + ""), 344 | secondary_y=False 345 | ) 346 | #fig = go.Figure(data=[go.Bar(x=x, y=y, marker_color=barcolor1,visible=False)]) 347 | 348 | #fig.add_trace(go.Bar(x=uniq_x,y=uniq_y,marker_color=barcolor2,visible=True)) 349 | 350 | # Add Ns 351 | y2=list(ambiguity_d.values()) 352 | uniq_y2=list(uniq_ambiguity_d.values()) 353 | fig.add_trace( 354 | go.Scatter(x=uniq_x,y=uniq_y2,marker_color='blueviolet',visible=True,name="Num of Ns (cov<" + str(mincov) +")", hovertemplate="Num of Ns: %{y}" ), 355 | secondary_y=True 356 | ) 357 | fig.add_trace( 358 | go.Scatter(x=x,y=y2,marker_color='blueviolet',visible=False,name="Num of Ns (cov<" + str(mincov) +")", hovertemplate="Num of Ns: %{y}" ), 359 | secondary_y=True 360 | ) 361 | 362 | depthMean = [dict(type='line', 363 | xref='paper',x0=0,x1=0.94, 364 | yref='y',y0=overall_mean,y1=overall_mean, 365 | line=dict( 366 | color="red", 367 | width=1, 368 | dash='dot', 369 | ) 370 | )] 371 | 372 | depth_buttons = list([ 373 | dict(label="Mean(" + str(int(overall_mean)) + 'X)', 374 | method="relayout", 375 | args=["shapes", depthMean])]) 376 | 377 | depth_selectors = depthMean[:] 378 | for depth in depth_lines: 379 | name = '{}X'.format(depth) 380 | depth_selector = [dict(type='line', 381 | xref='paper', x0=0, x1=0.94, 382 | yref='y', y0=depth, y1=depth, 383 | line=dict( 384 | color="black", 385 | width=1, 386 | dash='dot', 387 | ))] 388 | depth_selectors.extend(depth_selector) 389 | depth_buttons.append(dict(label=name, 390 | method="relayout", 391 | args=["shapes", depth_selector])) 392 | depth_buttons.append( 393 | dict(label="All", method="relayout", args=["shapes", depth_selectors]) 394 | ) 395 | updatemenus = list([ 396 | dict( 397 | buttons=list([ 398 | dict(label='Linear Scale', 399 | method='relayout', 400 | args=[{'title': '', 401 | 'yaxis.type': 'linear'}]), 402 | dict(label='Log Scale', 403 | method='relayout', 404 | args=[{'title': '', 405 | 'yaxis.type': 'log'}]) 406 | ]), 407 | direction="down", 408 | x=0, 409 | xanchor="left", 410 | y=1.03, 411 | yanchor="top" 412 | ), 413 | dict( 414 | buttons=list([ 415 | dict(label='Unique', 416 | method='update', 417 | args=[{"visible": [True, False, True, False]}]), 418 | dict(label='Whole Amplicon', 419 | method='update', 420 | args=[{"visible": [False, True, False, True]}]) 421 | ]), 422 | direction="down", 423 | x=0.15, 424 | xanchor="left", 425 | y=1.03, 426 | yanchor="top" 427 | ), 428 | dict( 429 | buttons=depth_buttons, 430 | direction="down", 431 | x=0.30, 432 | xanchor="left", 433 | y=1.03, 434 | yanchor="top", 435 | showactive=True 436 | ) 437 | ]) 438 | 439 | fig.update_xaxes( 440 | tickfont=dict(family='Courier New, monospace', size=8), 441 | ticks="outside", 442 | tickwidth=0.5, 443 | ticklen=3 444 | ) 445 | fig.update_yaxes( 446 | tickfont=dict(family='Courier New, monospace', size=8), 447 | ticks="outside", 448 | tickwidth=0.5, 449 | ticklen=3 450 | ) 451 | fig.update_yaxes( 452 | tickfont=dict(family='Courier New, monospace', size=8, color="blueviolet"), 453 | ticks="outside", 454 | tickwidth=0.5, 455 | ticklen=3, 456 | secondary_y=True, 457 | title_text="Num of Ns (cov<" + str(mincov) +")", 458 | titlefont=dict( 459 | color="blueviolet" 460 | ), 461 | ) 462 | fig.update_layout( 463 | updatemenus=updatemenus, 464 | xaxis_title=x_name, 465 | yaxis_title="Mean Coverage(X)", 466 | font=dict( 467 | family="Courier New, monospace", 468 | size=10, 469 | ), 470 | annotations=[ 471 | dict(text="Y-axis:",x=0, xref="paper", 472 | y=1.06, yref="paper", 473 | showarrow=False), 474 | dict(text="Region:",x=0.15, xref="paper", 475 | y=1.06, yref="paper", 476 | showarrow=False), 477 | dict(text="DepthLine:", x=0.30, xref="paper", 478 | y=1.06, yref="paper", 479 | showarrow=False), 480 | ], 481 | shapes=[ 482 | dict(type='line', 483 | xref='paper',x0=0,x1=0.94, 484 | yref='y',y0=overall_mean,y1=overall_mean, 485 | line=dict( 486 | color="red", 487 | width=1, 488 | dash='dashdot', 489 | ), 490 | ), 491 | ], 492 | legend=dict( 493 | orientation="h", 494 | yanchor="bottom", 495 | y=1.02, 496 | xanchor="right", 497 | x=0.95 498 | ), 499 | hovermode="x unified" 500 | ) 501 | 502 | output_html = outdir + os.sep + prefix + '_amplicon_coverage.html' 503 | fig.write_html(output_html) 504 | 505 | def run(argvs): 506 | 507 | if (argvs.cov): 508 | cov_array = parse_cov_file(argvs.cov) 509 | prefix = Path(argvs.cov).stem 510 | if (argvs.bam): 511 | cov_array = parse_bam_file(argvs.bam,argvs.pp, argvs.outdir, argvs.refID) 512 | prefix = Path(argvs.bam).stem 513 | if (argvs.bed): 514 | is_bed6(argvs.bed) 515 | amplicon_dict = convert_bed_to_amplicon_dict(argvs.bed,cov_array,argvs.refID) 516 | uniq_amplicon_dict = convert_bed_to_amplicon_dict(argvs.bed,cov_array,argvs.refID,True,argvs.count_primer) 517 | bedfile = argvs.bed 518 | if (argvs.bedpe): 519 | amplicon_dict = convert_bedpe_to_amplicon_dict(argvs.bedpe,cov_array,argvs.refID) 520 | uniq_amplicon_dict = convert_bedpe_to_amplicon_dict(argvs.bedpe,cov_array,argvs.refID,True,argvs.count_primer) 521 | bedfile = argvs.bedpe 522 | 523 | anno_dict = parse_gff_file(argvs.gff,argvs.refID) if (argvs.gff) else None 524 | 525 | if not argvs.prefix: 526 | argvs.prefix = prefix 527 | 528 | # Count the number of Ns < argvs.mincov per amplicon 529 | ambiguity_d = calculate_N_per_amplicon(cov_array,amplicon_dict, argvs.mincov) 530 | uniq_ambiguity_d = calculate_N_per_amplicon(cov_array,uniq_amplicon_dict,argvs.mincov) 531 | 532 | # Get the coverage per amplicon 533 | amplicon_mean_d = calculate_mean_cov_per_amplicon(cov_array,amplicon_dict,anno_dict) 534 | uniq_amplicon_mean_d = calculate_mean_cov_per_amplicon(cov_array,uniq_amplicon_dict,anno_dict) 535 | 536 | # Write results to a tab-delimited file 537 | write_dict_to_file(amplicon_mean_d,uniq_amplicon_mean_d,ambiguity_d,uniq_ambiguity_d,argvs.outdir,argvs.prefix,argvs.mincov) 538 | 539 | barplot(amplicon_mean_d,uniq_amplicon_mean_d,ambiguity_d,uniq_ambiguity_d,bedfile,cov_array.mean(),argvs.outdir,argvs.prefix,argvs.mincov,argvs.depth_lines) 540 | 541 | if __name__ == '__main__': 542 | argvs = setup_argparse() 543 | mkdir_p(argvs.outdir) 544 | run(argvs) 545 | -------------------------------------------------------------------------------- /amplicov/amplicov_pdf: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | import os, errno 3 | import argparse as ap 4 | import numpy as np 5 | import csv 6 | import subprocess 7 | import plotly.graph_objects as go 8 | from pathlib import Path 9 | import pysam 10 | from collections import defaultdict 11 | import re 12 | 13 | class SmartFormatter(ap.HelpFormatter): 14 | def _split_lines(self, text, width): 15 | if text.startswith('R|'): 16 | return text[2:].splitlines() 17 | # this is the RawTextHelpFormatter._split_lines 18 | return ap.HelpFormatter._split_lines(self, text, width) 19 | 20 | def setup_argparse(): 21 | parser = ap.ArgumentParser(prog='amplicov', 22 | description = '''Script to parse amplicon region coverage and generate barplot in html''', 23 | formatter_class = SmartFormatter) 24 | 25 | inGrp = parser.add_argument_group('Amplicon Input (required, mutually exclusive)') 26 | inGrp_me = inGrp.add_mutually_exclusive_group(required=True) 27 | inGrp_me.add_argument('--bed', metavar='[FILE]', type=str,help='amplicon bed file') 28 | inGrp_me.add_argument('--bedpe', metavar='[FILE]', type=str,help='amplicon bedpe file') 29 | 30 | covGrp = parser.add_argument_group('Coverage Input (required, mutually exclusive)') 31 | covGrp_me = covGrp.add_mutually_exclusive_group(required=True) 32 | covGrp_me.add_argument('--bam', metavar='[FILE]', type=str,help='bam file') 33 | covGrp_me.add_argument('--cov', metavar='[FILE]', type=str,help='coverage file [position\tcoverage]') 34 | 35 | outGrp = parser.add_argument_group('Output') 36 | outGrp.add_argument('-o', '--outdir', metavar='[PATH]',type=str, default='.', help='output directory') 37 | outGrp.add_argument('-p', '--prefix', metavar='[STR]',type=str , help='output prefix') 38 | 39 | parser.add_argument('--version', action='version', version='%(prog)s 0.1.1') 40 | args_parsed = parser.parse_args() 41 | if not args_parsed.outdir: 42 | args_parsed.outdir = os.getcwd() 43 | 44 | return args_parsed 45 | 46 | def mkdir_p(directory_name): 47 | try: 48 | os.makedirs(directory_name) 49 | except OSError as exc: 50 | if exc.errno == errno.EEXIST and os.path.isdir(directory_name): 51 | pass 52 | 53 | def covert_bed_to_amplicon_dict(input,unique=False): 54 | ## convert bed file to amplicon region dictionary 55 | input_bed = input 56 | amplicon=defaultdict(dict) 57 | if unique: 58 | cmd = 'grep -v alt %s | paste - - | awk \'{print $4"\t"$2"\t"$9}\' | sed -e "s/_LEFT//g" -e "s/_RIGHT//g" ' % (input_bed) 59 | else: 60 | cmd = 'grep -v alt %s | paste - - | awk \'{print $4"\t"$3"\t"$8}\' | sed -e "s/_LEFT//g" -e "s/_RIGHT//g" ' % (input_bed) 61 | 62 | proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) 63 | previous_id='' 64 | for line in proc.stdout: 65 | id, start, end = line.decode().rstrip().split("\t") 66 | amplicon[id]=range(int(start),int(end)+1) 67 | if (previous_id and unique): 68 | set_new=set(amplicon[id]) 69 | set_previous=set(amplicon[previous_id]) 70 | set_new_update=sorted(set_new - set_previous) 71 | set_previous_update=sorted(set_previous - set_new) 72 | amplicon[id] = range(set_new_update[0],set_new_update[-1]+1) 73 | amplicon[previous_id] = range(set_previous_update[0],set_previous_update[-1]+1) 74 | previous_id = id 75 | 76 | outs, errs = proc.communicate() 77 | if proc.returncode != 0: 78 | print("Failed %d %s %s" % (proc.returncode, outs, errs)) 79 | 80 | return amplicon 81 | 82 | def covert_bedpe_to_amplicon_dict(input,unique=False): 83 | ## convert bed file to amplicon region dictionary 84 | input_bedpe = input 85 | amplicon=defaultdict(dict) 86 | if unique: 87 | cmd = 'awk \'{print $7"\t"$2"\t"$6}\' %s ' % (input_bedpe) 88 | else: 89 | cmd = 'awk \'{print $7"\t"$3"\t"$5}\' %s ' % (input_bedpe) 90 | proc = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE) 91 | previous_id='' 92 | for line in proc.stdout: 93 | id, start, end = line.decode().rstrip().split("\t") 94 | amplicon[id]=range(int(start),int(end)+1) 95 | if (previous_id and unique): 96 | set_new=set(amplicon[id]) 97 | set_previous=set(amplicon[previous_id]) 98 | set_new_update=sorted(set_new - set_previous) 99 | set_previous_update=sorted(set_previous - set_new) 100 | amplicon[id] = range(set_new_update[0],set_new_update[-1]+1) 101 | amplicon[previous_id] = range(set_previous_update[0],set_previous_update[-1]+1) 102 | previous_id = id 103 | 104 | outs, errs = proc.communicate() 105 | if proc.returncode != 0: 106 | print("Failed %d %s %s" % (proc.returncode, outs, errs)) 107 | 108 | return amplicon 109 | 110 | def parse_cov_file(input): 111 | ## read the coverage and save in a list 112 | cov_file = input 113 | cov_list = [] 114 | with open(cov_file,'r') as cov_file: 115 | for line in cov_file: 116 | pos, cov = line.rstrip().split("\t") 117 | cov_list.append(int(cov)) 118 | 119 | cov_array=np.array(cov_list) 120 | return cov_array 121 | 122 | def parse_bam_file(bam): 123 | cov_list = [] 124 | for line in pysam.samtools.depth("-aa","-d0", "NC_045512.2.sort_sorted.bam",split_lines=True): 125 | id, pos, cov = line.rstrip().split("\t") 126 | cov_list.append(int(cov)) 127 | cov_array=np.array(cov_list) 128 | return cov_array 129 | 130 | def calculate_mean_cov_per_amplicon(cov_np_array,amplicon_d): 131 | mean_dict=dict() 132 | for key in amplicon_d: 133 | start = amplicon_d[key][0] 134 | end = amplicon_d[key][-1] 135 | mean_dict[key] = cov_np_array[start:end].mean() 136 | return mean_dict 137 | 138 | def write_dict_to_file(mean_d,uniq_mean_d,outdir,prefix): 139 | output_amplicon_cov_txt = outdir + os.sep + prefix + '_amplicon_coverage.txt' 140 | try: 141 | os.remove(output_amplicon_cov_txt) 142 | except OSError: 143 | pass 144 | with open(output_amplicon_cov_txt,"w") as f: 145 | f.write("ID\tWhole_Amplicon\tUnique\n") 146 | for key in mean_d: 147 | f.write("%s\t%.2f\t%.2f\n" % (key,mean_d[key],uniq_mean_d[key])) 148 | 149 | 150 | def barplot(mean_dict,uniq_mean_d,input_bed,overall_mean,outdir,prefix): 151 | #plot bar chart 152 | x_name=Path(input_bed).stem 153 | x=list(mean_dict.keys()) 154 | y=list(mean_dict.values()) 155 | uniq_x=list(uniq_mean_d.keys()) 156 | uniq_y=list(uniq_mean_d.values()) 157 | x_tick_names = [re.sub(r'nCoV-2019_', '', x_tick) for x_tick in uniq_x] 158 | barcolor = ['lightsalmon' if y >= 20 else 'black' for y in uniq_y] 159 | fig = go.Figure(data=[go.Bar(x=x_tick_names, y=uniq_y,marker_color=barcolor)]) 160 | #fig.add_trace(go.Bar(x=uniq_x,y=uniq_y,marker_color='lightsalmon',visible=False)) 161 | fig.update_layout(yaxis_type="log") 162 | fig.update_xaxes( 163 | tickfont=dict(family='Courier New, monospace', size=8), 164 | ticks="outside", 165 | tickwidth=0.5, 166 | ticklen=3 167 | ) 168 | fig.update_yaxes( 169 | tickfont=dict(family='Courier New, monospace', size=8), 170 | ticks="outside", 171 | tickwidth=0.5, 172 | ticklen=3 173 | ) 174 | depthMean = [dict(type='line', 175 | xref='paper',x0=0,x1=1, 176 | yref='y',y0=overall_mean,y1=overall_mean, 177 | line=dict( 178 | color="red", 179 | width=1, 180 | dash='dot', 181 | ) 182 | )] 183 | 184 | depth5x = [dict(type='line', 185 | xref='paper',x0=0,x1=1, 186 | yref='y',y0=5,y1=5, 187 | line=dict( 188 | color="black", 189 | width=1, 190 | dash='dot', 191 | ) 192 | )] 193 | depth10x = [dict(type='line', 194 | xref='paper',x0=0,x1=1, 195 | yref='10',y0=10,y1=10, 196 | line=dict( 197 | color="black", 198 | width=1, 199 | dash='dot', 200 | ) 201 | )] 202 | depth20x = [dict(type='line', 203 | xref='paper',x0=0,x1=1, 204 | yref='y',y0=20,y1=20, 205 | line=dict( 206 | color="black", 207 | width=1, 208 | dash='dot', 209 | ) 210 | )] 211 | 212 | 213 | 214 | fig.update_layout( 215 | yaxis_title="Mean Coverage(X)", 216 | xaxis=dict( 217 | title='Artic V1', 218 | tickmode='linear'), 219 | font=dict( 220 | family="Courier New, monospace", 221 | size=8, 222 | ), 223 | shapes=[ 224 | dict(type='line', 225 | xref='paper',x0=0,x1=1, 226 | yref='y',y0=20,y1=20, 227 | line=dict( 228 | color="red", 229 | width=1, 230 | dash='dot', 231 | ), 232 | ), 233 | ] 234 | ) 235 | 236 | output_html = outdir + os.sep + prefix + '_amplicon_coverage.html' 237 | fig.write_html(output_html) 238 | fig.write_image(outdir + os.sep + prefix+".svg") 239 | fig.write_image(outdir + os.sep + prefix+".pdf",width=1280) 240 | fig.write_image(outdir + os.sep + prefix+".eps") 241 | 242 | def run(argvs): 243 | if (argvs.bed): 244 | amplicon_dict = covert_bed_to_amplicon_dict(argvs.bed) 245 | uniq_amplicon_dict = covert_bed_to_amplicon_dict(argvs.bed,True) 246 | bedfile = argvs.bed 247 | if (argvs.bedpe): 248 | amplicon_dict = covert_bedpe_to_amplicon_dict(argvs.bedpe) 249 | uniq_amplicon_dict = covert_bedpe_to_amplicon_dict(argvs.bedpe) 250 | bedfile = argvs.bedpe 251 | if (argvs.cov): 252 | cov_array = parse_cov_file(argvs.cov) 253 | prefix = Path(argvs.cov).stem 254 | if (argvs.bam): 255 | cov_array = parse_bam_file(argvs.bam) 256 | prefix = Path(argvs.bam).stem 257 | if not argvs.prefix: 258 | argvs.prefix = prefix 259 | 260 | amplicon_mean_d = calculate_mean_cov_per_amplicon(cov_array,amplicon_dict) 261 | uniq_amplicon_mean_d = calculate_mean_cov_per_amplicon(cov_array,uniq_amplicon_dict) 262 | write_dict_to_file(amplicon_mean_d,uniq_amplicon_mean_d,argvs.outdir,argvs.prefix) 263 | barplot(amplicon_mean_d,uniq_amplicon_mean_d,bedfile,cov_array.mean(),argvs.outdir,argvs.prefix) 264 | 265 | if __name__ == '__main__': 266 | argvs = setup_argparse() 267 | mkdir_p(argvs.outdir) 268 | run(argvs) 269 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | subprocess 2 | defaultdict 3 | csv 4 | numpy 5 | plotly 6 | pysam 7 | pathlib 8 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | import sys 3 | 4 | setup( 5 | name='amplicov', 6 | version= '0.3.4', 7 | author='Chienchi Lo', 8 | author_email='chienchi@lanl.gov', 9 | packages=find_packages(), 10 | scripts=['amplicov/amplicov'], 11 | url='https://github.com/chienchi/amplicon_coverage_plot', 12 | license='LICENSE.txt', 13 | description='script to generate amplicon coverage plot', 14 | keywords="amplicon genome coverage", 15 | long_description=open('README.md').read(), 16 | long_description_content_type="text/markdown", 17 | install_requires=[ 18 | "plotly >=4.7.1", 19 | "numpy >= 1.15.1", 20 | "pysam >= 0.15.4", 21 | ], 22 | classifiers=[ 23 | "Programming Language :: Python :: 3", 24 | "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", 25 | "Operating System :: OS Independent", 26 | ], 27 | ) 28 | -------------------------------------------------------------------------------- /tests/input.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chienchi/amplicon_coverage_plot/9d0089f2cbe31c28e680a84c528744730e46b68b/tests/input.bam -------------------------------------------------------------------------------- /tests/input.bed: -------------------------------------------------------------------------------- 1 | NC_045512_2 30 54 nCoV-2019_1_LEFT nCoV-2019_1 + 2 | NC_045512_2 385 410 nCoV-2019_1_RIGHT nCoV-2019_1 - 3 | NC_045512_2 320 342 nCoV-2019_2_LEFT nCoV-2019_2 + 4 | NC_045512_2 704 726 nCoV-2019_2_RIGHT nCoV-2019_2 - 5 | NC_045512_2 642 664 nCoV-2019_3_LEFT nCoV-2019_1 + 6 | NC_045512_2 1004 1028 nCoV-2019_3_RIGHT nCoV-2019_1 - 7 | NC_045512_2 943 965 nCoV-2019_4_LEFT nCoV-2019_2 + 8 | NC_045512_2 1312 1337 nCoV-2019_4_RIGHT nCoV-2019_2 - 9 | NC_045512_2 1242 1264 nCoV-2019_5_LEFT nCoV-2019_1 + 10 | NC_045512_2 1623 1651 nCoV-2019_5_RIGHT nCoV-2019_1 - 11 | NC_045512_2 1573 1595 nCoV-2019_6_LEFT nCoV-2019_2 + 12 | NC_045512_2 1942 1964 nCoV-2019_6_RIGHT nCoV-2019_2 - 13 | NC_045512_2 1875 1897 nCoV-2019_7_LEFT nCoV-2019_1 + 14 | NC_045512_2 1868 1890 nCoV-2019_7_LEFT_alt0 nCoV-2019_1 + 15 | NC_045512_2 2247 2269 nCoV-2019_7_RIGHT nCoV-2019_1 - 16 | NC_045512_2 2242 2264 nCoV-2019_7_RIGHT_alt5 nCoV-2019_1 - 17 | NC_045512_2 2181 2205 nCoV-2019_8_LEFT nCoV-2019_2 + 18 | NC_045512_2 2568 2592 nCoV-2019_8_RIGHT nCoV-2019_2 - 19 | NC_045512_2 2505 2529 nCoV-2019_9_LEFT nCoV-2019_1 + 20 | NC_045512_2 2504 2528 nCoV-2019_9_LEFT_alt4 nCoV-2019_1 + 21 | NC_045512_2 2882 2904 nCoV-2019_9_RIGHT nCoV-2019_1 - 22 | NC_045512_2 2880 2902 nCoV-2019_9_RIGHT_alt2 nCoV-2019_1 - 23 | NC_045512_2 2826 2850 nCoV-2019_10_LEFT nCoV-2019_2 + 24 | NC_045512_2 3183 3210 nCoV-2019_10_RIGHT nCoV-2019_2 - 25 | NC_045512_2 3144 3166 nCoV-2019_11_LEFT nCoV-2019_1 + 26 | NC_045512_2 3507 3531 nCoV-2019_11_RIGHT nCoV-2019_1 - 27 | NC_045512_2 3460 3482 nCoV-2019_12_LEFT nCoV-2019_2 + 28 | NC_045512_2 3826 3853 nCoV-2019_12_RIGHT nCoV-2019_2 - 29 | NC_045512_2 3771 3795 nCoV-2019_13_LEFT nCoV-2019_1 + 30 | NC_045512_2 4142 4164 nCoV-2019_13_RIGHT nCoV-2019_1 - 31 | NC_045512_2 4054 4077 nCoV-2019_14_LEFT nCoV-2019_2 + 32 | NC_045512_2 4044 4068 nCoV-2019_14_LEFT_alt4 nCoV-2019_2 + 33 | NC_045512_2 4428 4450 nCoV-2019_14_RIGHT nCoV-2019_2 - 34 | NC_045512_2 4402 4424 nCoV-2019_14_RIGHT_alt2 nCoV-2019_2 - 35 | NC_045512_2 4294 4321 nCoV-2019_15_LEFT nCoV-2019_1 + 36 | NC_045512_2 4296 4322 nCoV-2019_15_LEFT_alt1 nCoV-2019_1 + 37 | NC_045512_2 4674 4696 nCoV-2019_15_RIGHT nCoV-2019_1 - 38 | NC_045512_2 4666 4689 nCoV-2019_15_RIGHT_alt3 nCoV-2019_1 - 39 | NC_045512_2 4636 4658 nCoV-2019_16_LEFT nCoV-2019_2 + 40 | NC_045512_2 4995 5017 nCoV-2019_16_RIGHT nCoV-2019_2 - 41 | NC_045512_2 4939 4966 nCoV-2019_17_LEFT nCoV-2019_1 + 42 | NC_045512_2 5296 5321 nCoV-2019_17_RIGHT nCoV-2019_1 - 43 | NC_045512_2 5230 5259 nCoV-2019_18_LEFT nCoV-2019_2 + 44 | NC_045512_2 5257 5287 nCoV-2019_18_LEFT_alt2 nCoV-2019_2 + 45 | NC_045512_2 5620 5644 nCoV-2019_18_RIGHT nCoV-2019_2 - 46 | NC_045512_2 5620 5643 nCoV-2019_18_RIGHT_alt1 nCoV-2019_2 - 47 | NC_045512_2 5563 5586 nCoV-2019_19_LEFT nCoV-2019_1 + 48 | NC_045512_2 5932 5957 nCoV-2019_19_RIGHT nCoV-2019_1 - 49 | NC_045512_2 5867 5894 nCoV-2019_20_LEFT nCoV-2019_2 + 50 | NC_045512_2 6247 6272 nCoV-2019_20_RIGHT nCoV-2019_2 - 51 | NC_045512_2 6167 6196 nCoV-2019_21_LEFT nCoV-2019_1 + 52 | NC_045512_2 6168 6197 nCoV-2019_21_LEFT_alt2 nCoV-2019_1 + 53 | NC_045512_2 6528 6550 nCoV-2019_21_RIGHT nCoV-2019_1 - 54 | NC_045512_2 6526 6548 nCoV-2019_21_RIGHT_alt0 nCoV-2019_1 - 55 | NC_045512_2 6466 6495 nCoV-2019_22_LEFT nCoV-2019_2 + 56 | NC_045512_2 6846 6873 nCoV-2019_22_RIGHT nCoV-2019_2 - 57 | NC_045512_2 6718 6745 nCoV-2019_23_LEFT nCoV-2019_1 + 58 | NC_045512_2 7092 7117 nCoV-2019_23_RIGHT nCoV-2019_1 - 59 | NC_045512_2 7035 7058 nCoV-2019_24_LEFT nCoV-2019_2 + 60 | NC_045512_2 7389 7415 nCoV-2019_24_RIGHT nCoV-2019_2 - 61 | NC_045512_2 7305 7332 nCoV-2019_25_LEFT nCoV-2019_1 + 62 | NC_045512_2 7671 7694 nCoV-2019_25_RIGHT nCoV-2019_1 - 63 | NC_045512_2 7626 7651 nCoV-2019_26_LEFT nCoV-2019_2 + 64 | NC_045512_2 7997 8019 nCoV-2019_26_RIGHT nCoV-2019_2 - 65 | NC_045512_2 7943 7968 nCoV-2019_27_LEFT nCoV-2019_1 + 66 | NC_045512_2 8319 8341 nCoV-2019_27_RIGHT nCoV-2019_1 - 67 | NC_045512_2 8249 8275 nCoV-2019_28_LEFT nCoV-2019_2 + 68 | NC_045512_2 8635 8661 nCoV-2019_28_RIGHT nCoV-2019_2 - 69 | NC_045512_2 8595 8619 nCoV-2019_29_LEFT nCoV-2019_1 + 70 | NC_045512_2 8954 8983 nCoV-2019_29_RIGHT nCoV-2019_1 - 71 | NC_045512_2 8888 8913 nCoV-2019_30_LEFT nCoV-2019_2 + 72 | NC_045512_2 9245 9271 nCoV-2019_30_RIGHT nCoV-2019_2 - 73 | NC_045512_2 9204 9226 nCoV-2019_31_LEFT nCoV-2019_1 + 74 | NC_045512_2 9557 9585 nCoV-2019_31_RIGHT nCoV-2019_1 - 75 | NC_045512_2 9477 9502 nCoV-2019_32_LEFT nCoV-2019_2 + 76 | NC_045512_2 9834 9858 nCoV-2019_32_RIGHT nCoV-2019_2 - 77 | NC_045512_2 9784 9806 nCoV-2019_33_LEFT nCoV-2019_1 + 78 | NC_045512_2 10146 10171 nCoV-2019_33_RIGHT nCoV-2019_1 - 79 | NC_045512_2 10076 10099 nCoV-2019_34_LEFT nCoV-2019_2 + 80 | NC_045512_2 10437 10459 nCoV-2019_34_RIGHT nCoV-2019_2 - 81 | NC_045512_2 10362 10384 nCoV-2019_35_LEFT nCoV-2019_1 + 82 | NC_045512_2 10737 10763 nCoV-2019_35_RIGHT nCoV-2019_1 - 83 | NC_045512_2 10666 10688 nCoV-2019_36_LEFT nCoV-2019_2 + 84 | NC_045512_2 11048 11074 nCoV-2019_36_RIGHT nCoV-2019_2 - 85 | NC_045512_2 10999 11022 nCoV-2019_37_LEFT nCoV-2019_1 + 86 | NC_045512_2 11372 11394 nCoV-2019_37_RIGHT nCoV-2019_1 - 87 | NC_045512_2 11306 11331 nCoV-2019_38_LEFT nCoV-2019_2 + 88 | NC_045512_2 11668 11693 nCoV-2019_38_RIGHT nCoV-2019_2 - 89 | NC_045512_2 11555 11584 nCoV-2019_39_LEFT nCoV-2019_1 + 90 | NC_045512_2 11927 11949 nCoV-2019_39_RIGHT nCoV-2019_1 - 91 | NC_045512_2 11863 11889 nCoV-2019_40_LEFT nCoV-2019_2 + 92 | NC_045512_2 12234 12256 nCoV-2019_40_RIGHT nCoV-2019_2 - 93 | NC_045512_2 12110 12133 nCoV-2019_41_LEFT nCoV-2019_1 + 94 | NC_045512_2 12465 12490 nCoV-2019_41_RIGHT nCoV-2019_1 - 95 | NC_045512_2 12417 12439 nCoV-2019_42_LEFT nCoV-2019_2 + 96 | NC_045512_2 12779 12802 nCoV-2019_42_RIGHT nCoV-2019_2 - 97 | NC_045512_2 12710 12732 nCoV-2019_43_LEFT nCoV-2019_1 + 98 | NC_045512_2 13074 13096 nCoV-2019_43_RIGHT nCoV-2019_1 - 99 | NC_045512_2 13005 13027 nCoV-2019_44_LEFT nCoV-2019_2 + 100 | NC_045512_2 13007 13029 nCoV-2019_44_LEFT_alt3 nCoV-2019_2 + 101 | NC_045512_2 13378 13400 nCoV-2019_44_RIGHT nCoV-2019_2 - 102 | NC_045512_2 13363 13385 nCoV-2019_44_RIGHT_alt0 nCoV-2019_2 - 103 | NC_045512_2 13319 13344 nCoV-2019_45_LEFT nCoV-2019_1 + 104 | NC_045512_2 13307 13336 nCoV-2019_45_LEFT_alt2 nCoV-2019_1 + 105 | NC_045512_2 13669 13699 nCoV-2019_45_RIGHT nCoV-2019_1 - 106 | NC_045512_2 13660 13689 nCoV-2019_45_RIGHT_alt7 nCoV-2019_1 - 107 | NC_045512_2 13599 13621 nCoV-2019_46_LEFT nCoV-2019_2 + 108 | NC_045512_2 13602 13625 nCoV-2019_46_LEFT_alt1 nCoV-2019_2 + 109 | NC_045512_2 13962 13984 nCoV-2019_46_RIGHT nCoV-2019_2 - 110 | NC_045512_2 13961 13984 nCoV-2019_46_RIGHT_alt2 nCoV-2019_2 - 111 | NC_045512_2 13918 13946 nCoV-2019_47_LEFT nCoV-2019_1 + 112 | NC_045512_2 14271 14299 nCoV-2019_47_RIGHT nCoV-2019_1 - 113 | NC_045512_2 14207 14232 nCoV-2019_48_LEFT nCoV-2019_2 + 114 | NC_045512_2 14579 14601 nCoV-2019_48_RIGHT nCoV-2019_2 - 115 | NC_045512_2 14545 14570 nCoV-2019_49_LEFT nCoV-2019_1 + 116 | NC_045512_2 14898 14926 nCoV-2019_49_RIGHT nCoV-2019_1 - 117 | NC_045512_2 14865 14895 nCoV-2019_50_LEFT nCoV-2019_2 + 118 | NC_045512_2 15224 15246 nCoV-2019_50_RIGHT nCoV-2019_2 - 119 | NC_045512_2 15171 15193 nCoV-2019_51_LEFT nCoV-2019_1 + 120 | NC_045512_2 15538 15560 nCoV-2019_51_RIGHT nCoV-2019_1 - 121 | NC_045512_2 15481 15503 nCoV-2019_52_LEFT nCoV-2019_2 + 122 | NC_045512_2 15861 15886 nCoV-2019_52_RIGHT nCoV-2019_2 - 123 | NC_045512_2 15827 15851 nCoV-2019_53_LEFT nCoV-2019_1 + 124 | NC_045512_2 16186 16209 nCoV-2019_53_RIGHT nCoV-2019_1 - 125 | NC_045512_2 16118 16144 nCoV-2019_54_LEFT nCoV-2019_2 + 126 | NC_045512_2 16485 16510 nCoV-2019_54_RIGHT nCoV-2019_2 - 127 | NC_045512_2 16416 16444 nCoV-2019_55_LEFT nCoV-2019_1 + 128 | NC_045512_2 16804 16833 nCoV-2019_55_RIGHT nCoV-2019_1 - 129 | NC_045512_2 16748 16770 nCoV-2019_56_LEFT nCoV-2019_2 + 130 | NC_045512_2 17130 17152 nCoV-2019_56_RIGHT nCoV-2019_2 - 131 | NC_045512_2 17065 17087 nCoV-2019_57_LEFT nCoV-2019_1 + 132 | NC_045512_2 17430 17452 nCoV-2019_57_RIGHT nCoV-2019_1 - 133 | NC_045512_2 17381 17406 nCoV-2019_58_LEFT nCoV-2019_2 + 134 | NC_045512_2 17738 17761 nCoV-2019_58_RIGHT nCoV-2019_2 - 135 | NC_045512_2 17674 17697 nCoV-2019_59_LEFT nCoV-2019_1 + 136 | NC_045512_2 18036 18062 nCoV-2019_59_RIGHT nCoV-2019_1 - 137 | NC_045512_2 17966 17993 nCoV-2019_60_LEFT nCoV-2019_2 + 138 | NC_045512_2 18324 18348 nCoV-2019_60_RIGHT nCoV-2019_2 - 139 | NC_045512_2 18253 18275 nCoV-2019_61_LEFT nCoV-2019_1 + 140 | NC_045512_2 18650 18672 nCoV-2019_61_RIGHT nCoV-2019_1 - 141 | NC_045512_2 18596 18618 nCoV-2019_62_LEFT nCoV-2019_2 + 142 | NC_045512_2 18957 18979 nCoV-2019_62_RIGHT nCoV-2019_2 - 143 | NC_045512_2 18896 18918 nCoV-2019_63_LEFT nCoV-2019_1 + 144 | NC_045512_2 19275 19297 nCoV-2019_63_RIGHT nCoV-2019_1 - 145 | NC_045512_2 19204 19232 nCoV-2019_64_LEFT nCoV-2019_2 + 146 | NC_045512_2 19591 19616 nCoV-2019_64_RIGHT nCoV-2019_2 - 147 | NC_045512_2 19548 19570 nCoV-2019_65_LEFT nCoV-2019_1 + 148 | NC_045512_2 19911 19939 nCoV-2019_65_RIGHT nCoV-2019_1 - 149 | NC_045512_2 19844 19866 nCoV-2019_66_LEFT nCoV-2019_2 + 150 | NC_045512_2 20231 20255 nCoV-2019_66_RIGHT nCoV-2019_2 - 151 | NC_045512_2 20172 20200 nCoV-2019_67_LEFT nCoV-2019_1 + 152 | NC_045512_2 20542 20572 nCoV-2019_67_RIGHT nCoV-2019_1 - 153 | NC_045512_2 20472 20496 nCoV-2019_68_LEFT nCoV-2019_2 + 154 | NC_045512_2 20867 20890 nCoV-2019_68_RIGHT nCoV-2019_2 - 155 | NC_045512_2 20786 20813 nCoV-2019_69_LEFT nCoV-2019_1 + 156 | NC_045512_2 21146 21169 nCoV-2019_69_RIGHT nCoV-2019_1 - 157 | NC_045512_2 21075 21104 nCoV-2019_70_LEFT nCoV-2019_2 + 158 | NC_045512_2 21427 21455 nCoV-2019_70_RIGHT nCoV-2019_2 - 159 | NC_045512_2 21357 21386 nCoV-2019_71_LEFT nCoV-2019_1 + 160 | NC_045512_2 21716 21743 nCoV-2019_71_RIGHT nCoV-2019_1 - 161 | NC_045512_2 21658 21682 nCoV-2019_72_LEFT nCoV-2019_2 + 162 | NC_045512_2 22013 22038 nCoV-2019_72_RIGHT nCoV-2019_2 - 163 | NC_045512_2 21961 21990 nCoV-2019_73_LEFT nCoV-2019_1 + 164 | NC_045512_2 22324 22346 nCoV-2019_73_RIGHT nCoV-2019_1 - 165 | NC_045512_2 22262 22290 nCoV-2019_74_LEFT nCoV-2019_2 + 166 | NC_045512_2 22626 22650 nCoV-2019_74_RIGHT nCoV-2019_2 - 167 | NC_045512_2 22516 22542 nCoV-2019_75_LEFT nCoV-2019_1 + 168 | NC_045512_2 22877 22903 nCoV-2019_75_RIGHT nCoV-2019_1 - 169 | NC_045512_2 22797 22819 nCoV-2019_76_LEFT nCoV-2019_2 + 170 | NC_045512_2 22798 22821 nCoV-2019_76_LEFT_alt3 nCoV-2019_2 + 171 | NC_045512_2 23192 23214 nCoV-2019_76_RIGHT nCoV-2019_2 - 172 | NC_045512_2 23189 23212 nCoV-2019_76_RIGHT_alt0 nCoV-2019_2 - 173 | NC_045512_2 23122 23144 nCoV-2019_77_LEFT nCoV-2019_1 + 174 | NC_045512_2 23500 23522 nCoV-2019_77_RIGHT nCoV-2019_1 - 175 | NC_045512_2 23443 23466 nCoV-2019_78_LEFT nCoV-2019_2 + 176 | NC_045512_2 23822 23847 nCoV-2019_78_RIGHT nCoV-2019_2 - 177 | NC_045512_2 23789 23812 nCoV-2019_79_LEFT nCoV-2019_1 + 178 | NC_045512_2 24145 24169 nCoV-2019_79_RIGHT nCoV-2019_1 - 179 | NC_045512_2 24078 24100 nCoV-2019_80_LEFT nCoV-2019_2 + 180 | NC_045512_2 24443 24467 nCoV-2019_80_RIGHT nCoV-2019_2 - 181 | NC_045512_2 24391 24416 nCoV-2019_81_LEFT nCoV-2019_1 + 182 | NC_045512_2 24765 24789 nCoV-2019_81_RIGHT nCoV-2019_1 - 183 | NC_045512_2 24696 24721 nCoV-2019_82_LEFT nCoV-2019_2 + 184 | NC_045512_2 25052 25076 nCoV-2019_82_RIGHT nCoV-2019_2 - 185 | NC_045512_2 24978 25003 nCoV-2019_83_LEFT nCoV-2019_1 + 186 | NC_045512_2 25347 25369 nCoV-2019_83_RIGHT nCoV-2019_1 - 187 | NC_045512_2 25279 25301 nCoV-2019_84_LEFT nCoV-2019_2 + 188 | NC_045512_2 25646 25673 nCoV-2019_84_RIGHT nCoV-2019_2 - 189 | NC_045512_2 25601 25623 nCoV-2019_85_LEFT nCoV-2019_1 + 190 | NC_045512_2 25969 25994 nCoV-2019_85_RIGHT nCoV-2019_1 - 191 | NC_045512_2 25902 25924 nCoV-2019_86_LEFT nCoV-2019_2 + 192 | NC_045512_2 26290 26315 nCoV-2019_86_RIGHT nCoV-2019_2 - 193 | NC_045512_2 26197 26219 nCoV-2019_87_LEFT nCoV-2019_1 + 194 | NC_045512_2 26566 26590 nCoV-2019_87_RIGHT nCoV-2019_1 - 195 | NC_045512_2 26520 26542 nCoV-2019_88_LEFT nCoV-2019_2 + 196 | NC_045512_2 26890 26913 nCoV-2019_88_RIGHT nCoV-2019_2 - 197 | NC_045512_2 26835 26857 nCoV-2019_89_LEFT nCoV-2019_1 + 198 | NC_045512_2 26838 26860 nCoV-2019_89_LEFT_alt2 nCoV-2019_1 + 199 | NC_045512_2 27202 27227 nCoV-2019_89_RIGHT nCoV-2019_1 - 200 | NC_045512_2 27190 27215 nCoV-2019_89_RIGHT_alt4 nCoV-2019_1 - 201 | NC_045512_2 27141 27164 nCoV-2019_90_LEFT nCoV-2019_2 + 202 | NC_045512_2 27511 27533 nCoV-2019_90_RIGHT nCoV-2019_2 - 203 | NC_045512_2 27446 27471 nCoV-2019_91_LEFT nCoV-2019_1 + 204 | NC_045512_2 27825 27854 nCoV-2019_91_RIGHT nCoV-2019_1 - 205 | NC_045512_2 27784 27808 nCoV-2019_92_LEFT nCoV-2019_2 + 206 | NC_045512_2 28145 28172 nCoV-2019_92_RIGHT nCoV-2019_2 - 207 | NC_045512_2 28081 28104 nCoV-2019_93_LEFT nCoV-2019_1 + 208 | NC_045512_2 28442 28464 nCoV-2019_93_RIGHT nCoV-2019_1 - 209 | NC_045512_2 28394 28416 nCoV-2019_94_LEFT nCoV-2019_2 + 210 | NC_045512_2 28756 28779 nCoV-2019_94_RIGHT nCoV-2019_2 - 211 | NC_045512_2 28677 28699 nCoV-2019_95_LEFT nCoV-2019_1 + 212 | NC_045512_2 29041 29063 nCoV-2019_95_RIGHT nCoV-2019_1 - 213 | NC_045512_2 28985 29007 nCoV-2019_96_LEFT nCoV-2019_2 + 214 | NC_045512_2 29356 29378 nCoV-2019_96_RIGHT nCoV-2019_2 - 215 | NC_045512_2 29288 29316 nCoV-2019_97_LEFT nCoV-2019_1 + 216 | NC_045512_2 29665 29693 nCoV-2019_97_RIGHT nCoV-2019_1 - 217 | NC_045512_2 29486 29510 nCoV-2019_98_LEFT nCoV-2019_2 + 218 | NC_045512_2 29836 29866 nCoV-2019_98_RIGHT nCoV-2019_2 - -------------------------------------------------------------------------------- /tests/input.bedpe: -------------------------------------------------------------------------------- 1 | gi|1798172431|gb|MN908947.3| 2 24 gi|1798172431|gb|MN908947.3| 474 495 SC2M1-1_LEFT2_1-SC2M1-1_RIGHT2_495 2 | gi|1798172431|gb|MN908947.3| 2 26 gi|1798172431|gb|MN908947.3| 470 491 0_1b-W1_1R_490 3 | gi|1798172431|gb|MN908947.3| 2 26 gi|1798172431|gb|MN908947.3| 470 491 0_1b-W1_1R_490 4 | gi|1798172431|gb|MN908947.3| 31 54 gi|1798172431|gb|MN908947.3| 553 574 SC2M1-1_LEFT_31-SC2M1-1_RIGHT_574 5 | gi|1798172431|gb|MN908947.3| 445 466 gi|1798172431|gb|MN908947.3| 944 965 SC2M1-2_LEFT_445-SC2M1-2_RIGHT_965 6 | gi|1798172431|gb|MN908947.3| 827 848 gi|1798172431|gb|MN908947.3| 1373 1395 SC2M1-3_LEFT_827-SC2M1-3_RIGHT_1395 7 | gi|1798172431|gb|MN908947.3| 1262 1283 gi|1798172431|gb|MN908947.3| 1817 1839 SC2M1-4_LEFT_1262-SC2M1-4_RIGHT_1840 8 | gi|1798172431|gb|MN908947.3| 1458 1479 gi|1798172431|gb|MN908947.3| 1946 1970 W1_5L_1457-W1_5R_1969 9 | gi|1798172431|gb|MN908947.3| 1706 1728 gi|1798172431|gb|MN908947.3| 2245 2266 SC2M1-5_LEFT_1706-SC2M1-5_RIGHT_2266 10 | gi|1798172431|gb|MN908947.3| 1819 1841 gi|1798172431|gb|MN908947.3| 2324 2346 W1_6L_1819-W1_6R_2345 11 | gi|1798172431|gb|MN908947.3| 2138 2159 gi|1798172431|gb|MN908947.3| 2621 2642 SC2M1-6_LEFT_2138-SC2M1-6_RIGHT_2642 12 | gi|1798172431|gb|MN908947.3| 2493 2514 gi|1798172431|gb|MN908947.3| 3145 3166 SC2M1-7a_LEFT_2491-SC2M1-7b_RIGHT_3165 13 | gi|1798172431|gb|MN908947.3| 2932 2954 gi|1798172431|gb|MN908947.3| 3461 3482 SC2M1-8_LEFT_2932-SC2M1-8_RIGHT_3461 14 | gi|1798172431|gb|MN908947.3| 3306 3330 gi|1798172431|gb|MN908947.3| 3855 3878 SC2M1-9_LEFT_3306-SC2M1-9_RIGHT_3878 15 | gi|1798172431|gb|MN908947.3| 3306 3330 gi|1798172431|gb|MN908947.3| 3855 3878 SC2M1-9_LEFT_3306-SC2M1-9_RIGHT_3878 16 | gi|1798172431|gb|MN908947.3| 3715 3737 gi|1798172431|gb|MN908947.3| 4241 4262 SC2M1-10_LEFT_3715-SC2M1-10_RIGHT_4262 17 | gi|1798172431|gb|MN908947.3| 4126 4147 gi|1798172431|gb|MN908947.3| 4637 4658 SC2M1-11_LEFT_4126-SC2M1-11_RIGHT_4658 18 | gi|1798172431|gb|MN908947.3| 4519 4546 gi|1798172431|gb|MN908947.3| 4996 5017 SC2M1-12_LEFT_4519-SC2M1-12_RIGHT_5017 19 | gi|1798172431|gb|MN908947.3| 4885 4908 gi|1798172431|gb|MN908947.3| 5378 5400 SC2M1-13_LEFT_4885-SC2M1-13_RIGHT_5400 20 | gi|1798172431|gb|MN908947.3| 5258 5287 gi|1798172431|gb|MN908947.3| 5795 5818 SC2M1-14_LEFT_5258-SC2M1-14_RIGHT_5818 21 | gi|1798172431|gb|MN908947.3| 5677 5699 gi|1798172431|gb|MN908947.3| 6150 6172 SC2M1-15_LEFT_5677-SC2M1-15_RIGHT_6172 22 | gi|1798172431|gb|MN908947.3| 6030 6057 gi|1798172431|gb|MN908947.3| 6523 6544 SC2M1-16_LEFT_6030-SC2M1-16_RIGHT_6544 23 | gi|1798172431|gb|MN908947.3| 6408 6434 gi|1798172431|gb|MN908947.3| 6878 6903 SC2M1-17_LEFT_6408-SC2M1-17_RIGHT_6903 24 | gi|1798172431|gb|MN908947.3| 6748 6776 gi|1798172431|gb|MN908947.3| 7234 7255 SC2M1-18_LEFT_6748-SC2M1-18_RIGHT_7255 25 | gi|1798172431|gb|MN908947.3| 6959 6988 gi|1798172431|gb|MN908947.3| 7373 7394 SC2M1-19a_LEFT_6957-SC2M1-19a_RIGHT_7393 26 | gi|1798172431|gb|MN908947.3| 6959 6988 gi|1798172431|gb|MN908947.3| 7373 7394 SC2M1-19a_LEFT_6957-SC2M1-19a_RIGHT_7393 27 | gi|1798172431|gb|MN908947.3| 7237 7263 gi|1798172431|gb|MN908947.3| 7672 7694 SC2M1-19b_LEFT_7235-SC2M1-19_RIGHT_7694 28 | gi|1798172431|gb|MN908947.3| 7237 7263 gi|1798172431|gb|MN908947.3| 7749 7772 SC2M1-19b_LEFT_7235-W1_21R_7771 29 | gi|1798172431|gb|MN908947.3| 7560 7587 gi|1798172431|gb|MN908947.3| 8107 8128 SC2M1-20_LEFT_7560-SC2M1-20_RIGHT_8128 30 | gi|1798172431|gb|MN908947.3| 7986 8009 gi|1798172431|gb|MN908947.3| 8364 8385 SC2M1-21a_LEFT_7984-SC2M1-21a_RIGHT_8384 31 | gi|1798172431|gb|MN908947.3| 8004 8025 gi|1798172431|gb|MN908947.3| 8528 8553 SC2M1-21_LEFT_8004-SC2M1-21_RIGHT_8553 32 | gi|1798172431|gb|MN908947.3| 8242 8267 gi|1798172431|gb|MN908947.3| 8596 8619 SC2M1-21b_LEFT_8240-SC2M1-21b_RIGHT_8618 33 | gi|1798172431|gb|MN908947.3| 8407 8436 gi|1798172431|gb|MN908947.3| 8889 8913 SC2M1-22_LEFT_8407-SC2M1-22_RIGHT_8913 34 | gi|1798172431|gb|MN908947.3| 8778 8799 gi|1798172431|gb|MN908947.3| 9307 9330 SC2M1-23_LEFT_8778-SC2M1-23_RIGHT_9330 35 | gi|1798172431|gb|MN908947.3| 9000 9021 gi|1798172431|gb|MN908947.3| 9431 9460 W1_26L_8999-W1_26R_9459 36 | gi|1798172431|gb|MN908947.3| 9203 9225 gi|1798172431|gb|MN908947.3| 9708 9734 SC2M1-24_LEFT_9203-SC2M1-24_RIGHT_9734 37 | gi|1798172431|gb|MN908947.3| 9551 9576 gi|1798172431|gb|MN908947.3| 10040 10061 SC2M1-25_LEFT_9551-SC2M1-25_RIGHT_10061 38 | gi|1798172431|gb|MN908947.3| 9660 9687 gi|1798172431|gb|MN908947.3| 10185 10208 W1_28L_9659-W1_28R_10207 39 | gi|1798172431|gb|MN908947.3| 9903 9930 gi|1798172431|gb|MN908947.3| 10430 10451 SC2M1-26_LEFT_9903-SC2M1-26_RIGHT_10451 40 | gi|1798172431|gb|MN908947.3| 10318 10342 gi|1798172431|gb|MN908947.3| 10816 10837 SC2M1-27_LEFT_10318-SC2M1-27_RIGHT_10837 41 | gi|1798172431|gb|MN908947.3| 10697 10719 gi|1798172431|gb|MN908947.3| 11188 11209 SC2M1-28_LEFT_10697-SC2M1-28_RIGHT_11209 42 | gi|1798172431|gb|MN908947.3| 11047 11072 gi|1798172431|gb|MN908947.3| 11517 11541 SC2M1-29_LEFT_11047-SC2M1-29_RIGHT_11541 43 | gi|1798172431|gb|MN908947.3| 11400 11428 gi|1798172431|gb|MN908947.3| 11923 11944 SC2M1-30_LEFT_11400-SC2M1-30_RIGHT_11944 44 | gi|1798172431|gb|MN908947.3| 11810 11833 gi|1798172431|gb|MN908947.3| 12314 12335 SC2M1-31_LEFT_11810-SC2M1-31_RIGHT_12335 45 | gi|1798172431|gb|MN908947.3| 12201 12226 gi|1798172431|gb|MN908947.3| 12698 12719 SC2M1-32_LEFT_12201-SC2M1-32_RIGHT_12719 46 | gi|1798172431|gb|MN908947.3| 12557 12580 gi|1798172431|gb|MN908947.3| 13115 13136 SC2M1-33_LEFT_12557-SC2M1-33_RIGHT_13136 47 | gi|1798172431|gb|MN908947.3| 12996 13018 gi|1798172431|gb|MN908947.3| 13379 13400 SC2M1-34a_LEFT_12994-SC2M1-34a_RIGHT_13399 48 | gi|1798172431|gb|MN908947.3| 13006 13027 gi|1798172431|gb|MN908947.3| 13480 13501 SC2M1-34_LEFT_13006-SC2M1-34_RIGHT_13501 49 | gi|1798172431|gb|MN908947.3| 13247 13268 gi|1798172431|gb|MN908947.3| 13600 13621 SC2M1-34b_LEFT_13245-SC2M1-34b_RIGHT_13620 50 | gi|1798172431|gb|MN908947.3| 13363 13384 gi|1798172431|gb|MN908947.3| 13835 13861 SC2M1-35_LEFT_13366-SC2M1-35_RIGHT_13861 51 | gi|1798172431|gb|MN908947.3| 13723 13750 gi|1798172431|gb|MN908947.3| 14208 14232 SC2M1-36_LEFT_13727-SC2M1-36_RIGHT_14232 52 | gi|1798172431|gb|MN908947.3| 13723 13750 gi|1798172431|gb|MN908947.3| 14208 14232 SC2M1-36_LEFT_13727-SC2M1-36_RIGHT_14232 53 | gi|1798172431|gb|MN908947.3| 13987 14011 gi|1798172431|gb|MN908947.3| 14479 14504 W1_40L_13986-W1_40R_14503 54 | gi|1798172431|gb|MN908947.3| 14103 14124 gi|1798172431|gb|MN908947.3| 14620 14641 SC2M1-37_LEFT_14103-SC2M1-37_RIGHT_14641 55 | gi|1798172431|gb|MN908947.3| 14480 14504 gi|1798172431|gb|MN908947.3| 15005 15027 SC2M1-38_LEFT_14480-SC2M1-38_RIGHT_15027 56 | gi|1798172431|gb|MN908947.3| 14888 14910 gi|1798172431|gb|MN908947.3| 15370 15391 SC2M1-39_LEFT_14888-SC2M1-39_RIGHT_15391 57 | gi|1798172431|gb|MN908947.3| 15264 15287 gi|1798172431|gb|MN908947.3| 15750 15771 SC2M1-40_LEFT_15264-SC2M1-40_RIGHT_15771 58 | gi|1798172431|gb|MN908947.3| 15637 15665 gi|1798172431|gb|MN908947.3| 16186 16208 SC2M1-41_LEFT_15637-SC2M1-41_RIGHT_16208 59 | gi|1798172431|gb|MN908947.3| 16065 16092 gi|1798172431|gb|MN908947.3| 16627 16648 SC2M1-42_LEFT_16065-SC2M1-42_RIGHT_16648 60 | gi|1798172431|gb|MN908947.3| 16065 16092 gi|1798172431|gb|MN908947.3| 16627 16648 SC2M1-42_LEFT_16065-SC2M1-42_RIGHT_16648 61 | gi|1798172431|gb|MN908947.3| 16518 16545 gi|1798172431|gb|MN908947.3| 17066 17087 SC2M1-43_LEFT_16518-SC2M1-43_RIGHT_17087 62 | gi|1798172431|gb|MN908947.3| 16948 16969 gi|1798172431|gb|MN908947.3| 17437 17458 SC2M1-44_LEFT_16948-SC2M1-44_RIGHT_17458 63 | gi|1798172431|gb|MN908947.3| 17317 17338 gi|1798172431|gb|MN908947.3| 17881 17903 SC2M1-45_LEFT_17317-SC2M1-45_RIGHT_17903 64 | gi|1798172431|gb|MN908947.3| 17752 17778 gi|1798172431|gb|MN908947.3| 18254 18275 SC2M1-46_LEFT_17752-SC2M1-46_RIGHT_18275 65 | gi|1798172431|gb|MN908947.3| 18148 18172 gi|1798172431|gb|MN908947.3| 18647 18668 SC2M1-47_LEFT_18148-SC2M1-47_RIGHT_18668 66 | gi|1798172431|gb|MN908947.3| 18506 18528 gi|1798172431|gb|MN908947.3| 19017 19038 SC2M1-48_LEFT_18506-SC2M1-48_RIGHT_19038 67 | gi|1798172431|gb|MN908947.3| 18713 18738 gi|1798172431|gb|MN908947.3| 19092 19113 SC2M1-49a_LEFT_18711-SC2M1-49a_RIGHT_19112 68 | gi|1798172431|gb|MN908947.3| 18897 18918 gi|1798172431|gb|MN908947.3| 19463 19484 SC2M1-49_LEFT_18897-SC2M1-49_RIGHT_19484 69 | gi|1798172431|gb|MN908947.3| 18957 18978 gi|1798172431|gb|MN908947.3| 19311 19332 SC2M1-49b_LEFT_18955-SC2M1-49b_RIGHT_19331 70 | gi|1798172431|gb|MN908947.3| 19183 19207 gi|1798172431|gb|MN908947.3| 19549 19570 SC2M1-50a_LEFT_19181-SC2M1-50a_RIGHT_19569 71 | gi|1798172431|gb|MN908947.3| 19311 19332 gi|1798172431|gb|MN908947.3| 19845 19866 SC2M1-50_LEFT_19311-SC2M1-50_RIGHT_19866 72 | gi|1798172431|gb|MN908947.3| 19397 19422 gi|1798172431|gb|MN908947.3| 19799 19821 SC2M1-50b_LEFT_19395-SC2M1-50b_RIGHT_19820 73 | gi|1798172431|gb|MN908947.3| 19663 19685 gi|1798172431|gb|MN908947.3| 20077 20099 SC2M1-51a_LEFT_19661-SC2M1-51a_RIGHT_20098 74 | gi|1798172431|gb|MN908947.3| 19725 19752 gi|1798172431|gb|MN908947.3| 20232 20255 SC2M1-51_LEFT_19725-SC2M1-51_RIGHT_20255 75 | gi|1798172431|gb|MN908947.3| 19959 19980 gi|1798172431|gb|MN908947.3| 20347 20374 SC2M1-51b_LEFT_19957-SC2M1-51b_RIGHT_20373 76 | gi|1798172431|gb|MN908947.3| 20124 20146 gi|1798172431|gb|MN908947.3| 20677 20698 SC2M1-52_LEFT_20124-SC2M1-52_RIGHT_20698 77 | gi|1798172431|gb|MN908947.3| 20347 20374 gi|1798172431|gb|MN908947.3| 20772 20796 SC2M1-52_LEFT2_20349-SC2M1-52_RIGHT2_20798 78 | gi|1798172431|gb|MN908947.3| 20554 20581 gi|1798172431|gb|MN908947.3| 21118 21144 SC2M1-53_LEFT_20554-SC2M1-53_RIGHT_21144 79 | gi|1798172431|gb|MN908947.3| 20990 21014 gi|1798172431|gb|MN908947.3| 21534 21562 SC2M1-54_LEFT_20990-SC2M1-54_RIGHT_21562 80 | gi|1798172431|gb|MN908947.3| 21030 21059 gi|1798172431|gb|MN908947.3| 21535 21563 W1_60L_21029-W1_60R_21562 81 | gi|1798172431|gb|MN908947.3| 21421 21446 gi|1798172431|gb|MN908947.3| 21895 21916 SC2M1-55_LEFT_21421-SC2M1-55_RIGHT_21916 82 | gi|1798172431|gb|MN908947.3| 21775 21797 gi|1798172431|gb|MN908947.3| 22324 22345 SC2M1-56_LEFT_21775-SC2M1-56_RIGHT_22345 83 | gi|1798172431|gb|MN908947.3| 22203 22225 gi|1798172431|gb|MN908947.3| 22672 22697 SC2M1-57_LEFT_22203-SC2M1-57_RIGHT_22697 84 | gi|1798172431|gb|MN908947.3| 22458 22484 gi|1798172431|gb|MN908947.3| 22973 22994 W1_64L_22457-W1_64R_22993 85 | gi|1798172431|gb|MN908947.3| 22563 22584 gi|1798172431|gb|MN908947.3| 23107 23128 SC2M1-58_LEFT_22563-SC2M1-58_RIGHT_23128 86 | gi|1798172431|gb|MN908947.3| 22986 23007 gi|1798172431|gb|MN908947.3| 23498 23519 SC2M1-59_LEFT_22986-SC2M1-59_RIGHT_23519 87 | gi|1798172431|gb|MN908947.3| 23379 23402 gi|1798172431|gb|MN908947.3| 23853 23876 SC2M1-60_LEFT_23379-SC2M1-60_RIGHT_23876 88 | gi|1798172431|gb|MN908947.3| 23737 23763 gi|1798172431|gb|MN908947.3| 24210 24231 SC2M1-61_LEFT_23737-SC2M1-61_RIGHT_24231 89 | gi|1798172431|gb|MN908947.3| 23995 24021 gi|1798172431|gb|MN908947.3| 24605 24626 SC2M1-62a1_LEFT_23993-W1_30R_24625_1 90 | gi|1798172431|gb|MN908947.3| 24095 24117 gi|1798172431|gb|MN908947.3| 24602 24623 SC2M1-62_LEFT_24095-SC2M1-62_RIGHT_24623 91 | gi|1798172431|gb|MN908947.3| 24493 24520 gi|1798172431|gb|MN908947.3| 24979 25003 SC2M1-63_LEFT_24493-SC2M1-63_RIGHT_25003 92 | gi|1798172431|gb|MN908947.3| 24858 24880 gi|1798172431|gb|MN908947.3| 25348 25369 SC2M1-64_LEFT_24858-SC2M1-64_RIGHT_25369 93 | gi|1798172431|gb|MN908947.3| 25214 25239 gi|1798172431|gb|MN908947.3| 25769 25790 SC2M1-65_LEFT_25214-SC2M1-65_RIGHT_25790 94 | gi|1798172431|gb|MN908947.3| 25665 25686 gi|1798172431|gb|MN908947.3| 26203 26224 SC2M1-66_LEFT_25665-SC2M1-66_RIGHT_26224 95 | gi|1798172431|gb|MN908947.3| 25912 25936 gi|1798172431|gb|MN908947.3| 26256 26277 SC2M1-67a_LEFT_25910-SC2M1-67a_RIGHT_26276 96 | gi|1798172431|gb|MN908947.3| 26095 26120 gi|1798172431|gb|MN908947.3| 26567 26590 SC2M1-67_LEFT_26096-SC2M1-67_RIGHT_26590 97 | gi|1798172431|gb|MN908947.3| 26130 26151 gi|1798172431|gb|MN908947.3| 26521 26542 SC2M1-67b_LEFT_26128-SC2M1-67b_RIGHT_26541 98 | gi|1798172431|gb|MN908947.3| 26454 26479 gi|1798172431|gb|MN908947.3| 26983 27004 SC2M1-68_LEFT_26454-SC2M1-68_RIGHT_27004 99 | gi|1798172431|gb|MN908947.3| 26848 26874 gi|1798172431|gb|MN908947.3| 27203 27227 SC2M1-69a_LEFT_26846-SC2M1-69a_RIGHT_27226 100 | gi|1798172431|gb|MN908947.3| 26877 26898 gi|1798172431|gb|MN908947.3| 27411 27432 SC2M1-69_LEFT_26877-SC2M1-69_RIGHT_27432 101 | gi|1798172431|gb|MN908947.3| 27082 27103 gi|1798172431|gb|MN908947.3| 27423 27444 SC2M1-69b_LEFT_27080-SC2M1-69b_RIGHT_27443 102 | gi|1798172431|gb|MN908947.3| 27254 27283 gi|1798172431|gb|MN908947.3| 27624 27645 SC2M1-70a_LEFT_27252-SC2M1-70a_RIGHT_27644 103 | gi|1798172431|gb|MN908947.3| 27254 27283 gi|1798172431|gb|MN908947.3| 27785 27808 SC2M1-70_LEFT_27254-SC2M1-70_RIGHT_27808 104 | gi|1798172431|gb|MN908947.3| 27499 27520 gi|1798172431|gb|MN908947.3| 27987 28007 SC2M1-70b_LEFT_27497-W1_34R_28006_1 105 | gi|1798172431|gb|MN908947.3| 27650 27674 gi|1798172431|gb|MN908947.3| 28182 28203 SC2M1-71_LEFT_27650-SC2M1-71_RIGHT_28203 106 | gi|1798172431|gb|MN908947.3| 27650 27674 gi|1798172431|gb|MN908947.3| 28182 28203 SC2M1-71_LEFT_27650-SC2M1-71_RIGHT_28203 107 | gi|1798172431|gb|MN908947.3| 28066 28087 gi|1798172431|gb|MN908947.3| 28628 28649 SC2M1-72_LEFT_28066-SC2M1-72_RIGHT_28649 108 | gi|1798172431|gb|MN908947.3| 28525 28546 gi|1798172431|gb|MN908947.3| 29024 29045 SC2M1-73_LEFT_28525-SC2M1-73_RIGHT_29045 109 | gi|1798172431|gb|MN908947.3| 28918 28939 gi|1798172431|gb|MN908947.3| 29448 29469 SC2M1-74_LEFT_28918-SC2M1-74_RIGHT_29469 110 | gi|1798172431|gb|MN908947.3| 29344 29366 gi|1798172431|gb|MN908947.3| 29824 29848 SC2M1-75_LEFT_29344-SC2M1-75_RIGHT_29848 111 | gi|1798172431|gb|MN908947.3| 29344 29366 gi|1798172431|gb|MN908947.3| 29824 29848 SC2M1-75_LEFT_29344-SC2M1-75_RIGHT_29848 112 | -------------------------------------------------------------------------------- /tests/input.gff: -------------------------------------------------------------------------------- 1 | ##gff-version 3 2 | ##sequence-region NC_045512.2 1 29870 3 | # conversion-by bp_genbank2gff3.pl 4 | # organism Wuhan seafood market pneumonia virus 5 | # Note Wuhan seafood market pneumonia virus isolate Wuhan-Hu-1, complete genome. 6 | # date 28-JAN-2020 7 | NC_045512.2 GenBank region 1 29869 . + 1 ID=NC_045512;Dbxref=BioProject:PRJNA485481,taxon:2697049;Name=NC_045512;Note=Wuhan seafood market pneumonia virus isolate Wuhan-Hu-1%2C complete genome.,REVIEWED REFSEQ: This record has been curated by NCBI staff. The reference sequence is identical to MN908947. On Jan 17,2020 this sequence version replaced NC_045512.1. Annotation was added using homology to SARSr-CoV NC_004718.3. If you have questions or suggestions,please email us at info@ncbi.nlm.nih.gov and include the accession number NC_045512.##Find all other Wuhan seafood market pneumonia virus (2019-nCov) sequences at https://www.ncbi.nlm.nih.gov/genbank/2019-ncov-seqs/ ##Assembly-Data-START## Assembly Method :: Megahit v. V1.1.3 Sequencing Technology :: Illumina ##Assembly-Data-END## COMPLETENESS: full length. ;collection_date=Dec-2019;comment1=REVIEWED REFSEQ: This record has been curated by NCBI staff. The reference sequence is identical to MN908947. On Jan 17%2C 2020 this sequence version replaced NC_045512.1. Annotation was added using homology to SARSr-CoV NC_004718.3. If you have questions or suggestions%2C please email us at info@ncbi.nlm.nih.gov and include the accession number NC_045512.##Find all other Wuhan seafood market pneumonia virus (2019-nCov) sequences at https://www.ncbi.nlm.nih.gov/genbank/2019-ncov-seqs/ ##Assembly-Data-START## Assembly Method :: Megahit v. V1.1.3 Sequencing Technology :: Illumina ##Assembly-Data-END## COMPLETENESS: full length. ;country=China;date=28-JAN-2020;host=Homo sapiens;isolate=Wuhan-Hu-1;mol_type=genomic RNA;organism=Wuhan seafood market pneumonia virus 8 | NC_045512.2 GenBank 5'UTR 1 265 . + 1 ID=GenBank:5'UTR:NC_045512.2:1:265 9 | NC_045512.2 GenBank gene 266 21555 . + 1 ID=GU280_gp01;Dbxref=GeneID:43740578;Name=orf1ab;locus_tag=GU280_gp01 10 | NC_045512.2 GenBank mRNA 266 21555 . + 1 ID=GU280_gp01.t01;Parent=GU280_gp01 11 | NC_045512.2 GenBank mRNA 266 13483 . + 1 ID=GU280_gp01.t02;Parent=GU280_gp01 12 | NC_045512.2 GenBank mature_protein_region 266 805 . + 1 ID=GU280_gp01.p02;Parent=GU280_gp01.t02;Name=orf1ab;Note=nsp1%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=leader protein;protein_id=YP_009725297.1 13 | NC_045512.2 GenBank mature_protein_region 806 2719 . + 1 ID=GU280_gp01.p02.mature_protein_region;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp2;protein_id=YP_009725298.1 14 | NC_045512.2 GenBank mature_protein_region 2720 8554 . + 1 ID=GU280_gp01.p02.mature_protein_region.1;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=former nsp1%3B conserved domains are: N-terminal acidic (Ac)%2C predicted phosphoesterase%2C papain-like proteinase%2C Y-domain%2C transmembrane domain 1 (TM1)%2C adenosine diphosphate-ribose 1''-phosphatase (ADRP)%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp3;protein_id=YP_009725299.1 15 | NC_045512.2 GenBank mature_protein_region 8555 10054 . + 1 ID=GU280_gp01.p02.mature_protein_region.2;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=contains transmembrane domain 2 (TM2)%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp4;protein_id=YP_009725300.1 16 | NC_045512.2 GenBank mature_protein_region 10055 10972 . + 1 ID=GU280_gp01.p02.mature_protein_region.3;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp5%3B main proteinase (Mpro)%3B mediates cleavages downstream of nsp4. 3D structure has been determined (Yang et al.%2C 2003)%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=3C-like proteinase;protein_id=YP_009725301.1 17 | NC_045512.2 GenBank mature_protein_region 10973 11842 . + 1 ID=GU280_gp01.p02.mature_protein_region.4;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=putative transmembrane domain%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp6;protein_id=YP_009725302.1 18 | NC_045512.2 GenBank mature_protein_region 11843 12091 . + 1 ID=GU280_gp01.p02.mature_protein_region.5;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp7;protein_id=YP_009725303.1 19 | NC_045512.2 GenBank mature_protein_region 12092 12685 . + 1 ID=GU280_gp01.p02.mature_protein_region.6;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp8;protein_id=YP_009725304.1 20 | NC_045512.2 GenBank mature_protein_region 12686 13024 . + 1 ID=GU280_gp01.p02.mature_protein_region.7;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=ssRNA-binding protein%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp9;protein_id=YP_009725305.1 21 | NC_045512.2 GenBank mature_protein_region 13025 13441 . + 1 ID=GU280_gp01.p02.mature_protein_region.8;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=formerly known as growth-factor-like protein (GFL)%3B produced by both pp1a and pp1ab;locus_tag=GU280_gp01;product=nsp10;protein_id=YP_009725306.1 22 | NC_045512.2 GenBank mature_protein_region 13442 13468 . + 1 ID=GU280_gp01.p02.mature_protein_region.9;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp12%3B RdRp%3B produced by pp1ab only;locus_tag=GU280_gp01;product=RNA-dependent RNA polymerase;protein_id=YP_009725307.1 23 | NC_045512.2 GenBank mature_protein_region 13468 16236 . + 1 ID=GU280_gp01.p02.mature_protein_region.9;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp12%3B RdRp%3B produced by pp1ab only;locus_tag=GU280_gp01;product=RNA-dependent RNA polymerase;protein_id=YP_009725307.1 24 | NC_045512.2 GenBank mature_protein_region 16237 18039 . + 1 ID=GU280_gp01.p02.mature_protein_region.10;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp13%3B zinc-binding domain (ZD)%2C NTPase/helicase domain (HEL)%2C RNA 5'-triphosphatase%3B produced by pp1ab only;locus_tag=GU280_gp01;product=helicase;protein_id=YP_009725308.1 25 | NC_045512.2 GenBank mature_protein_region 18040 19620 . + 1 ID=GU280_gp01.p02.mature_protein_region.111;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp14%3B produced by pp1ab only;locus_tag=GU280_gp01;product=3'-to-5' exonuclease;protein_id=YP_009725309.1 26 | NC_045512.2 GenBank mature_protein_region 19621 20658 . + 1 ID=GU280_gp01.p02.mature_protein_region.1112;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp15%3B produced by pp1ab only;locus_tag=GU280_gp01;product=endoRNAse;protein_id=YP_009725310.1 27 | NC_045512.2 GenBank mature_protein_region 20659 21552 . + 1 ID=GU280_gp01.p02.mature_protein_region.11113;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=nsp16%3B 2'-o-MT%3B produced by pp1ab only;locus_tag=GU280_gp01;product=2'-O-ribose methyltransferase;protein_id=YP_009725311.1 28 | NC_045512.2 GenBank mature_protein_region 13442 13480 . + 1 ID=GU280_gp01.p02.mature_protein_region.111114;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Name=orf1ab;Note=produced by pp1a only;locus_tag=GU280_gp01;product=nsp11;protein_id=YP_009725312.1 29 | NC_045512.2 GenBank CDS 266 13468 . + 1 ID=GU280_gp01.p01;Parent=GU280_gp01.t01;Dbxref=GeneID:43740578;Name=orf1ab;Note=pp1ab%3B translated by -1 ribosomal frameshift;codon_start=1;locus_tag=GU280_gp01;product=orf1ab polyprotein;protein_id=YP_009724389.1;ribosomal_slippage=_no_value;translation=length.7096 30 | NC_045512.2 GenBank CDS 13468 21555 . + 1 ID=GU280_gp01.p01;Parent=GU280_gp01.t01;Dbxref=GeneID:43740578;Name=orf1ab;Note=pp1ab%3B translated by -1 ribosomal frameshift;codon_start=1;locus_tag=GU280_gp01;product=orf1ab polyprotein;protein_id=YP_009724389.1;ribosomal_slippage=_no_value;translation=length.7096 31 | NC_045512.2 GenBank CDS 266 13483 . + 1 ID=GU280_gp01.p02.CDS;Parent=GU280_gp01.t02;Alias=GU280_gp01.p02;Dbxref=GeneID:43740578;Name=orf1ab;Note=pp1a;codon_start=1;locus_tag=GU280_gp01;product=orf1a polyprotein;protein_id=YP_009725295.1;translation=length.4405 32 | NC_045512.2 GenBank exon 266 13468 . + 1 Parent=GU280_gp01.t01 33 | NC_045512.2 GenBank exon 13468 21555 . + 1 Parent=GU280_gp01.t01 34 | NC_045512.2 GenBank exon 266 13483 . + 1 Parent=GU280_gp01.t02 35 | NC_045512.2 GenBank gene 21563 25384 . + 1 ID=GU280_gp02;Dbxref=GeneID:43740568;Name=S;locus_tag=GU280_gp02 36 | NC_045512.2 GenBank mRNA 21563 25384 . + 1 ID=GU280_gp02.t01;Parent=GU280_gp02 37 | NC_045512.2 GenBank CDS 21563 25384 . + 1 ID=GU280_gp02.p01;Parent=GU280_gp02.t01;Dbxref=GeneID:43740568;Name=S;Note=structural protein%3B spike protein;codon_start=1;locus_tag=GU280_gp02;product=surface glycoprotein;protein_id=YP_009724390.1;translation=length.1273 38 | NC_045512.2 GenBank exon 21563 25384 . + 1 Parent=GU280_gp02.t01 39 | NC_045512.2 GenBank gene 25393 26220 . + 1 ID=GU280_gp03;Dbxref=GeneID:43740569;Name=ORF3a;locus_tag=GU280_gp03 40 | NC_045512.2 GenBank mRNA 25393 26220 . + 1 ID=GU280_gp03.t01;Parent=GU280_gp03 41 | NC_045512.2 GenBank CDS 25393 26220 . + 1 ID=GU280_gp03.p01;Parent=GU280_gp03.t01;Dbxref=GeneID:43740569;Name=ORF3a;codon_start=1;locus_tag=GU280_gp03;product=ORF3a protein;protein_id=YP_009724391.1;translation=length.275 42 | NC_045512.2 GenBank exon 25393 26220 . + 1 Parent=GU280_gp03.t01 43 | NC_045512.2 GenBank gene 26245 26472 . + 1 ID=GU280_gp04;Dbxref=GeneID:43740570;Name=E;locus_tag=GU280_gp04 44 | NC_045512.2 GenBank mRNA 26245 26472 . + 1 ID=GU280_gp04.t01;Parent=GU280_gp04 45 | NC_045512.2 GenBank CDS 26245 26472 . + 1 ID=GU280_gp04.p01;Parent=GU280_gp04.t01;Dbxref=GeneID:43740570;Name=E;Note=ORF4%3B structural protein%3B E protein;codon_start=1;locus_tag=GU280_gp04;product=envelope protein;protein_id=YP_009724392.1;translation=length.75 46 | NC_045512.2 GenBank exon 26245 26472 . + 1 Parent=GU280_gp04.t01 47 | NC_045512.2 GenBank gene 26523 27191 . + 1 ID=GU280_gp05;Dbxref=GeneID:43740571;Name=M;locus_tag=GU280_gp05 48 | NC_045512.2 GenBank mRNA 26523 27191 . + 1 ID=GU280_gp05.t01;Parent=GU280_gp05 49 | NC_045512.2 GenBank CDS 26523 27191 . + 1 ID=GU280_gp05.p01;Parent=GU280_gp05.t01;Dbxref=GeneID:43740571;Name=M;Note=ORF5%3B structural protein;codon_start=1;locus_tag=GU280_gp05;product=membrane glycoprotein;protein_id=YP_009724393.1;translation=length.222 50 | NC_045512.2 GenBank exon 26523 27191 . + 1 Parent=GU280_gp05.t01 51 | NC_045512.2 GenBank gene 27202 27387 . + 1 ID=GU280_gp06;Dbxref=GeneID:43740572;Name=ORF6;locus_tag=GU280_gp06 52 | NC_045512.2 GenBank mRNA 27202 27387 . + 1 ID=GU280_gp06.t01;Parent=GU280_gp06 53 | NC_045512.2 GenBank CDS 27202 27387 . + 1 ID=GU280_gp06.p01;Parent=GU280_gp06.t01;Dbxref=GeneID:43740572;Name=ORF6;codon_start=1;locus_tag=GU280_gp06;product=ORF6 protein;protein_id=YP_009724394.1;translation=length.61 54 | NC_045512.2 GenBank exon 27202 27387 . + 1 Parent=GU280_gp06.t01 55 | NC_045512.2 GenBank gene 27394 27759 . + 1 ID=GU280_gp07;Dbxref=GeneID:43740573;Name=ORF7a;locus_tag=GU280_gp07 56 | NC_045512.2 GenBank mRNA 27394 27759 . + 1 ID=GU280_gp07.t01;Parent=GU280_gp07 57 | NC_045512.2 GenBank CDS 27394 27759 . + 1 ID=GU280_gp07.p01;Parent=GU280_gp07.t01;Dbxref=GeneID:43740573;Name=ORF7a;codon_start=1;locus_tag=GU280_gp07;product=ORF7a protein;protein_id=YP_009724395.1;translation=length.121 58 | NC_045512.2 GenBank exon 27394 27759 . + 1 Parent=GU280_gp07.t01 59 | NC_045512.2 GenBank gene 27756 27887 . + 1 ID=GU280_gp08;Dbxref=GeneID:43740574;Name=ORF7b;locus_tag=GU280_gp08 60 | NC_045512.2 GenBank mRNA 27756 27887 . + 1 ID=GU280_gp08.t01;Parent=GU280_gp08 61 | NC_045512.2 GenBank CDS 27756 27887 . + 1 ID=GU280_gp08.p01;Parent=GU280_gp08.t01;Dbxref=GeneID:43740574;Name=ORF7b;codon_start=1;locus_tag=GU280_gp08;product=ORF7b;protein_id=YP_009725296.1;translation=length.43 62 | NC_045512.2 GenBank exon 27756 27887 . + 1 Parent=GU280_gp08.t01 63 | NC_045512.2 GenBank gene 27894 28259 . + 1 ID=GU280_gp09;Dbxref=GeneID:43740577;Name=ORF8;locus_tag=GU280_gp09 64 | NC_045512.2 GenBank mRNA 27894 28259 . + 1 ID=GU280_gp09.t01;Parent=GU280_gp09 65 | NC_045512.2 GenBank CDS 27894 28259 . + 1 ID=GU280_gp09.p01;Parent=GU280_gp09.t01;Dbxref=GeneID:43740577;Name=ORF8;codon_start=1;locus_tag=GU280_gp09;product=ORF8 protein;protein_id=YP_009724396.1;translation=length.121 66 | NC_045512.2 GenBank exon 27894 28259 . + 1 Parent=GU280_gp09.t01 67 | NC_045512.2 GenBank gene 28274 29533 . + 1 ID=GU280_gp10;Dbxref=GeneID:43740575;Name=N;locus_tag=GU280_gp10 68 | NC_045512.2 GenBank mRNA 28274 29533 . + 1 ID=GU280_gp10.t01;Parent=GU280_gp10 69 | NC_045512.2 GenBank CDS 28274 29533 . + 1 ID=GU280_gp10.p01;Parent=GU280_gp10.t01;Dbxref=GeneID:43740575;Name=N;Note=ORF9%3B structural protein;codon_start=1;locus_tag=GU280_gp10;product=nucleocapsid phosphoprotein;protein_id=YP_009724397.2;translation=length.419 70 | NC_045512.2 GenBank exon 28274 29533 . + 1 Parent=GU280_gp10.t01 71 | NC_045512.2 GenBank gene 29558 29674 . + 1 ID=GU280_gp11;Dbxref=GeneID:43740576;Name=ORF10;locus_tag=GU280_gp11 72 | NC_045512.2 GenBank mRNA 29558 29674 . + 1 ID=GU280_gp11.t01;Parent=GU280_gp11 73 | NC_045512.2 GenBank 3'UTR 29675 29869 . + 1 Parent=GU280_gp11 74 | NC_045512.2 GenBank CDS 29558 29674 . + 1 ID=GU280_gp11.p01;Parent=GU280_gp11.t01;Dbxref=GeneID:43740576;Name=ORF10;codon_start=1;locus_tag=GU280_gp11;product=ORF10 protein;protein_id=YP_009725255.1;translation=length.38 75 | NC_045512.2 GenBank exon 29558 29674 . + 1 Parent=GU280_gp11.t01 76 | -------------------------------------------------------------------------------- /tests/output.txt: -------------------------------------------------------------------------------- 1 | ID Whole_Amplicon Unique_Amplicon Whole_Amplicon_Ns(cov<10) Unique_Amplicon_Ns(cov<10) 2 | nCoV-2019_1 217.74 58.00 0.00 0.00 3 | nCoV-2019_2 1552.83 1235.49 0.00 0.00 4 | nCoV-2019_3 3164.22 2831.72 0.00 0.00 5 | nCoV-2019_4 2005.16 1658.00 0.00 0.00 6 | nCoV-2019_5 560.84 224.89 0.00 0.00 7 | nCoV-2019_6 1538.99 1485.79 0.00 0.00 8 | nCoV-2019_7 525.50 285.00 0.00 0.00 9 | nCoV-2019_8 454.83 421.00 0.00 0.00 10 | nCoV-2019_9 99.46 10.00 0.00 0.00 11 | nCoV-2019_10 555.03 476.97 0.00 0.00 12 | nCoV-2019_11 1566.55 1521.92 0.00 0.00 13 | nCoV-2019_12 493.29 302.00 0.00 0.00 14 | nCoV-2019_13 1131.37 907.00 0.00 0.00 15 | nCoV-2019_14 1308.77 1055.00 0.00 0.00 16 | nCoV-2019_15 674.29 284.00 0.00 0.00 17 | nCoV-2019_16 1594.52 1579.00 0.00 0.00 18 | nCoV-2019_17 171.35 33.00 0.00 0.00 19 | nCoV-2019_18 163.33 3.00 290.00 242.00 20 | nCoV-2019_19 1725.08 1677.00 0.00 0.00 21 | nCoV-2019_20 937.88 449.00 0.00 0.00 22 | nCoV-2019_21 2349.35 2140.87 0.00 0.00 23 | nCoV-2019_22 1653.61 1416.00 0.00 0.00 24 | nCoV-2019_23 548.00 130.00 0.00 0.00 25 | nCoV-2019_24 275.30 64.00 0.00 0.00 26 | nCoV-2019_25 1189.37 1154.00 0.00 0.00 27 | nCoV-2019_26 576.91 432.00 0.00 0.00 28 | nCoV-2019_27 1046.75 938.00 0.00 0.00 29 | nCoV-2019_28 732.20 590.00 0.00 0.00 30 | nCoV-2019_29 806.59 636.00 0.00 0.00 31 | nCoV-2019_30 1249.75 1168.00 0.00 0.00 32 | nCoV-2019_31 426.53 64.00 0.00 0.00 33 | nCoV-2019_32 1850.10 1781.00 0.00 0.00 34 | nCoV-2019_33 1042.94 709.00 0.00 0.00 35 | nCoV-2019_34 1635.19 1367.00 0.00 0.00 36 | nCoV-2019_35 1374.40 1089.00 0.00 0.00 37 | nCoV-2019_36 903.02 582.00 0.00 0.00 38 | nCoV-2019_37 2597.31 2406.00 0.00 0.00 39 | nCoV-2019_38 1645.29 1279.00 0.00 0.00 40 | nCoV-2019_39 869.10 301.92 0.00 0.00 41 | nCoV-2019_40 2758.10 2302.00 0.00 0.00 42 | nCoV-2019_41 2264.55 1453.00 0.00 0.00 43 | nCoV-2019_42 1843.23 1456.00 0.00 0.00 44 | nCoV-2019_43 2470.99 2012.00 0.00 0.00 45 | nCoV-2019_44 2170.39 1901.97 0.00 0.00 46 | nCoV-2019_45 401.22 13.00 0.00 0.00 47 | nCoV-2019_46 1398.91 1295.00 0.00 0.00 48 | nCoV-2019_47 2484.93 2206.29 0.00 0.00 49 | nCoV-2019_48 2101.44 1807.72 0.00 0.00 50 | nCoV-2019_49 1889.58 1836.84 0.00 0.00 51 | nCoV-2019_50 777.58 657.00 0.00 0.00 52 | nCoV-2019_51 1410.67 1108.00 0.00 0.00 53 | nCoV-2019_52 2606.71 2419.82 0.00 0.00 54 | nCoV-2019_53 2991.82 2896.81 0.00 0.00 55 | nCoV-2019_54 566.32 195.00 0.00 0.00 56 | nCoV-2019_55 308.27 127.00 0.00 0.00 57 | nCoV-2019_56 2122.16 1688.76 0.00 0.00 58 | nCoV-2019_57 3780.71 3543.89 0.00 0.00 59 | nCoV-2019_58 838.44 405.00 0.00 0.00 60 | nCoV-2019_59 1655.37 1451.00 0.00 0.00 61 | nCoV-2019_60 1803.78 1232.00 0.00 0.00 62 | nCoV-2019_61 2977.25 2602.54 0.00 0.00 63 | nCoV-2019_62 3054.90 2539.69 0.00 0.00 64 | nCoV-2019_63 2643.02 2367.00 0.00 0.00 65 | nCoV-2019_64 341.32 3.00 295.00 251.00 66 | nCoV-2019_65 993.06 953.00 0.00 0.00 67 | nCoV-2019_66 427.32 309.00 0.00 0.00 68 | nCoV-2019_67 248.50 16.00 0.00 0.00 69 | nCoV-2019_68 1733.67 1525.00 0.00 0.00 70 | nCoV-2019_69 1680.86 1429.00 0.00 0.00 71 | nCoV-2019_70 255.75 45.00 0.00 0.00 72 | nCoV-2019_71 342.59 200.00 0.00 0.00 73 | nCoV-2019_72 1431.35 1333.00 0.00 0.00 74 | nCoV-2019_73 1224.74 1125.95 0.00 0.00 75 | nCoV-2019_74 317.99 75.00 0.00 0.00 76 | nCoV-2019_75 536.84 518.00 0.00 0.00 77 | nCoV-2019_76 496.60 1.00 267.00 219.00 78 | nCoV-2019_77 3325.64 3229.00 0.00 0.00 79 | nCoV-2019_78 1390.35 1026.83 0.00 0.00 80 | nCoV-2019_79 2128.62 2013.96 0.00 0.00 81 | nCoV-2019_80 934.42 630.00 0.00 0.00 82 | nCoV-2019_81 822.67 525.00 0.00 0.00 83 | nCoV-2019_82 2180.56 1981.00 0.00 0.00 84 | nCoV-2019_83 1407.64 883.00 0.00 0.00 85 | nCoV-2019_84 2004.87 1823.00 0.00 0.00 86 | nCoV-2019_85 1231.66 985.87 0.00 0.00 87 | nCoV-2019_86 1326.03 966.00 0.00 0.00 88 | nCoV-2019_87 1586.04 1246.99 0.00 0.00 89 | nCoV-2019_88 2216.37 2101.84 0.00 0.00 90 | nCoV-2019_89 798.52 321.00 0.00 0.00 91 | nCoV-2019_90 2579.78 2547.69 0.00 0.00 92 | nCoV-2019_91 334.30 22.72 0.00 0.00 93 | nCoV-2019_92 878.71 514.00 0.00 0.00 94 | nCoV-2019_93 3091.74 2994.95 0.00 0.00 95 | nCoV-2019_94 764.33 465.96 0.00 0.00 96 | nCoV-2019_95 671.92 421.96 0.00 0.00 97 | nCoV-2019_96 1803.77 1759.52 0.00 0.00 98 | nCoV-2019_97 324.46 55.92 0.00 0.00 99 | nCoV-2019_98 178.94 152.00 0.00 0.00 100 | -------------------------------------------------------------------------------- /tests/runTest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | rootdir=$( cd $(dirname $0) ; pwd -P ) 4 | tempdir=$rootdir/tmpOut 5 | 6 | test_result(){ 7 | Test=$tempdir/output_amplicon_coverage.txt 8 | Expect=$rootdir/output.txt 9 | testName="run test"; 10 | if diff <(tail $Expect) <(tail $Test) 11 | then 12 | echo "$testName passed!" 13 | touch "$tempdir/test.success" 14 | else 15 | echo "$testName failed!" 16 | touch "$tempdir/test.fail" 17 | fi 18 | } 19 | 20 | cd $rootdir 21 | echo "Working Dir: $rootdir"; 22 | echo "Running Test ..." 23 | 24 | rm -rf $tempdir 25 | 26 | $rootdir/../amplicov/amplicov --gff input.gff --bed input.bed --cov coverage.txt --prefix output --outdir $tempdir || true 27 | #$rootdir/../amplicov/amplicov --bed input.bed --cov coverage.txt --prefix output --outdir $tempdir || true 28 | 29 | test_result; 30 | 31 | --------------------------------------------------------------------------------