├── .bumpversion.cfg ├── .github └── workflows │ ├── build.yaml │ └── test.yaml ├── .gitignore ├── LICENSE ├── README.md ├── example ├── Hi75.fasta ├── Hi84.fasta ├── M21328.fasta ├── M26329.fasta └── PTHi-1539.fasta ├── hicap-runner.py ├── hicap ├── __init__.py ├── alignment.py ├── annotation.py ├── arguments.py ├── database.py ├── database │ ├── IS1016V6.fasta │ ├── bexA.fasta │ ├── bexB.fasta │ ├── bexC.fasta │ ├── bexD.fasta │ ├── hcsA.fasta │ ├── hcsB.fasta │ ├── type_a.fasta │ ├── type_b.fasta │ ├── type_c.fasta │ ├── type_d.fasta │ ├── type_e.fasta │ └── type_f.fasta ├── genbank.py ├── graphic.py ├── locus.py ├── main.py ├── model │ └── prodigal_hi.bin ├── region_common.py ├── region_specific.py ├── report.py └── utility.py ├── setup.py └── tests ├── __init__.py ├── data ├── bad.fasta ├── good.fasta ├── type_a.fasta └── type_a_variant.fasta ├── test_blast.py └── test_util.py /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 1.0.4 3 | commit = True 4 | tag = False 5 | parse = (?P\d+)\.(?P\d+)\.(?P[a-z0-9+]+) 6 | 7 | [bumpversion:file:hicap/__init__.py] 8 | search = __version__ = '{current_version}' 9 | replace = __version__ = '{new_version}' 10 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: install 2 | on: [push] 3 | jobs: 4 | install: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v4 8 | - uses: conda-incubator/setup-miniconda@v3 9 | with: 10 | auto-update-conda: true 11 | conda-solver: "libmamba" 12 | python-version: "3.11" 13 | channels: bioconda,conda-forge,defaults 14 | - name: Conda install 15 | shell: bash -el {0} 16 | run: conda install 'python >=3.6' 'biopython >=1.79' 'reportlab ==3.4.0' 'prodigal >=2.6.1' 'blast >=2.2.28' 17 | - name: Install 18 | shell: bash -el {0} 19 | run: pip install . 20 | - name: Check install 21 | shell: bash -el {0} 22 | run: (hicap --version | grep hicap) || exit 1 23 | -------------------------------------------------------------------------------- /.github/workflows/test.yaml: -------------------------------------------------------------------------------- 1 | name: test 2 | on: [push] 3 | jobs: 4 | test: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v4 8 | - uses: conda-incubator/setup-miniconda@v3 9 | with: 10 | auto-update-conda: true 11 | conda-solver: "libmamba" 12 | python-version: "3.11" 13 | channels: bioconda,conda-forge,defaults 14 | - name: Conda install 15 | shell: bash -el {0} 16 | run: conda install 'python >=3.6' 'biopython >=1.79' 'reportlab ==3.4.0' 'prodigal >=2.6.1' 'blast >=2.2.28' 17 | - name: Unit tests 18 | shell: bash -el {0} 19 | run: python3 -m unittest 20 | - name: End-to-end test 21 | shell: bash -el {0} 22 | run: mkdir -p output/ && ./hicap-runner.py --query_fp example/Hi75.fasta --output_dir output/ 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.pyc 3 | venv/ 4 | __pycache__/ 5 | other/ 6 | -------------------------------------------------------------------------------- /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 | # hicap 2 | 3 | Identify _cap_ locus serotype and structure in your _Haemophilus influenzae_ assemblies. 4 | 5 | ![Example locus](https://image.ibb.co/kGLC1e/type_b_example.png) 6 | 7 | ## Table of contents 8 | 9 | - [Table of contents](#table-of-contents) 10 | - [Introduction](#introduction) 11 | - [Citation](#citation) 12 | - [Requirements](#requirements) 13 | - [Installation](#installation) 14 | - [Outputs](#outputs) 15 | - [Usage](#usage) 16 | - [Example](#example) 17 | - [License](#license) 18 | 19 | ## Introduction 20 | 21 | The _cap_ locus of _H. influenzae_ are categorised into 6 different groups based on serology (a-f). There are three 22 | functionally distinct regions of the _cap_ locus, designated `region I`, `region II`, and `region III`. Genes within `region 23 | I` (`bexABCD`) and `region III` (`hcsAB`) are associated with transport and post-translation modification. The `region II` 24 | genes encode serotype specific proteins, with each serotype (a-f) having a distinct set of genes. _cap_ loci are often 25 | subject to structural changes (e.g. duplication, deletion) making the process of _in silico_ typing and characterisation of 26 | loci difficult. 27 | 28 | `hicap` automates identification of the _cap_ locus, describes the structural layout, and performs _in silico_ serotyping. 29 | 30 | ## Citation 31 | 32 | If you use this tool, please cite the `hicap` paper: 33 | 34 | - Watts, S. C., & Holt, K. E. (2019). hicap: in silico serotyping of the Haemophilus influenzae 35 | capsule locus. Journal of Clinical Microbiology, JCM.00190-19. https://doi.org/10.1128/JCM.00190-19 36 | 37 | ## Requirements 38 | 39 | There are a couple of software dependencies that are required. 40 | 41 | - `Python`, version 3.6 or above with the following packages: 42 | - `Biopython`, version 1.79 or above 43 | - `ReportLab`, version 3.5.0 or above 44 | - `Prodigal`, version 2.6.1 or above 45 | - `BLAST+`, version 2.2.28 or above. Commands used are: 46 | - `makeblastdb` 47 | - `blastn` 48 | 49 | ## Installation 50 | 51 | The recommended method of installation is bioconda: 52 | 53 | ```bash 54 | conda install -c bioconda -c conda-forge hicap 55 | ``` 56 | 57 | Otherwise you can install `hicap` with pip: 58 | 59 | ```bash 60 | # Install into user directory via pip 61 | pip3 install --user git+https://github.com/scwatts/hicap.git 62 | 63 | # Check install 64 | hicap --help 65 | ``` 66 | 67 | Or clone the git repo and use the `hicap-runner.py` script: 68 | 69 | ```bash 70 | # Install into current directory by cloning 71 | git clone https://github.com/scwatts/hicap.git 72 | 73 | # Check install 74 | ./hicap/hicap-runner.py --help 75 | ``` 76 | 77 | If installing `hicap` by the `pip` or `clone` method, you'll need to satisfy all software dependencies manually. 78 | 79 | ## Usage 80 | 81 | Basic usage requires an input genome assembly and an output directory for result files: 82 | 83 | ```bash 84 | # Create output directory and run serotype prediction 85 | mkdir -p output/ 86 | hicap --query_fp input_genome.fasta --output_dir output/ 87 | ``` 88 | 89 | There are several parameters that can be set manually. The default settings have been empirically determined to be optimal on 90 | a test dataset so different settings may be more appropriate for other input data. To list this parameters use, the extended 91 | help for `hicap`: 92 | 93 | ```text 94 | hicap --help_all 95 | usage: hicap -q QUERY_FP -o OUTPUT_DIR [-d DATABASE_DIR] [--gene_coverage GENE_COVERAGE] [--gene_identity GENE_IDENTITY] 96 | [--broken_gene_length BROKEN_GENE_LENGTH] [--broken_gene_identity BROKEN_GENE_IDENTITY] [--log_fp LOG_FP] [--debug] [-v] [-h] 97 | [--help_all] 98 | 99 | File input and output: 100 | -q QUERY_FP, --query_fp QUERY_FP Input FASTA query 101 | -o OUTPUT_DIR, --output_dir OUTPUT_DIR Output directory 102 | -d DATABASE_DIR, --database_dir DATABASE_DIR Directory containing locus database. [default: /home/stephen/.local/lib/python3.6/site- 103 | packages/hicap/database] 104 | -s, --full_sequence Write the full input sequence out to the genbank file rather than just the region 105 | surrounding and including the locus 106 | 107 | Search parameters: 108 | --gene_coverage GENE_COVERAGE Minimum percentage coverage to consider a single gene complete. [default: 0.80] 109 | --gene_identity GENE_IDENTITY Minimum percentage identity to consider a single gene complete. [default: 0.70] 110 | --broken_gene_length BROKEN_GENE_LENGTH Minimum length to consider a broken gene. [default: 60] 111 | --broken_gene_identity BROKEN_GENE_IDENTITY Minimum percentage identity to consider a broken gene. [default: 0.80] 112 | 113 | Other: 114 | --log_fp LOG_FP Record logging messages to file 115 | --debug Print debug messages 116 | -v, --version Show version number and exit 117 | -h, --help Show this help message and exit 118 | --help_all Display extended help 119 | ``` 120 | 121 | ## Outputs 122 | 123 | Analysis using `hicap` will generate three result files in the specified output directory: 124 | 125 | - `Summary`: a somewhat machine parsable file with detailed summary information 126 | - `Genbank`: a genbank file with sequence marked up with _cap_ locus annotations 127 | - `Graphic`: a visual representation of the annotated _cap_ locus 128 | 129 | ### Summary 130 | 131 | The summary output file contains information relating to the annotation of the _cap_ locus. Below is a description of each 132 | column: 133 | 134 | | Column | Description | 135 | | -------------------- | ---------------------------------------------------------------------------------------------------- | 136 | | `isolate` | input isolate name | 137 | | `predicted_serotype` | `hicap` serotype prediction | 138 | | `attributes` | attributes of the locus (e.g. missing genes, truncated genes, duplication, etc) | 139 | | `genes_identified` | _cap_ genes identified. genes on different contigs delimited by`;`. truncation shown by trailing `*` | 140 | | `locus_location` | location of _cap_ genes. contigs delimited by `;` and matches `gene_identified` positions | 141 | | `region_n_genes` | expected and identified genes in region `n`. missing names are shown when applicable | 142 | | `IS1016_hits` | count of IS*1016* hits found | 143 | 144 | ### Genbank 145 | 146 | The genbank output file provides marked up input sequence data with annotations of the _cap_ locus. This file will contain a 147 | single record for each contig which the capsular locus is identified on. The default setting is to only include the sequence 148 | of the _cap_ locus and surrounding region. This behaviour can be overridden to include all input sequence data by specific 149 | `--full-sequence` on the command line. 150 | 151 | _cap_ locus regions are annotated by the `misc_feature` feature with a `/note` qualifier specifying an identifier for that 152 | specific region. _cap_ genes are given the `CDS` feature with a `/gene` qualifier set to the appropriate gene name. ORFs 153 | found nearby that are not typically part of the _cap_ locus are also marked as a `CDS` feature but `/gene` is set to `orf` 154 | with an incremental counter suffix for differentiation. 155 | 156 | All `CDS` features have a `/note` qualifier which contains various details, each separated by `;`. Possible values are 157 | `region_one`, `region_two`, `region_three`, `fragment`, `no_orf`, `insertion_sequence`, `misc_orf`. 158 | 159 | ### Graphic 160 | 161 | The graphical output provides a visualisation of the annotated _cap_ locus. The output format is `svg` and can be viewed in 162 | any modern browers or imagine viewer with `svg` support. Genes of each region are coloured differently; green, red, and 163 | yellow for `region I`, `region II`, and `region III` respectively. Truncated ORFs are coloured using a darker, desaturated 164 | corresponding region colour. ORFs which are not part of the _cap_ locus are left grey. Regions with homology to IS*1016* are 165 | annotated using small blue arrows. 166 | 167 | ![single track](https://i.ibb.co/WWPFFCd/Hi76.png) 168 | 169 | Each track of the visualisation represents a contig. The _cap_ locus of the example below is located on three different 170 | contigs. 171 | 172 | ![multi track](https://i.ibb.co/fGzyxL8/Hi83.png) 173 | 174 | ## Example 175 | 176 | To provide an example of `hicap` usage, we will annotate the _cap_ locus in the following isolates: 177 | 178 | | Isolate | BioSample Accession | Notes | 179 | | ----------- | ------------------- | ---------------------------------------------------------------------- | 180 | | `Hi75` | `SAMEA33515668` | Downloaded SRA reads (`ERX1834398`; ion torrent) and assembled locally | 181 | | `Hi84` | `SAMEA33522418` | Downloaded SRA reads (`ERX1834407`; ion torrent) and assembled locally | 182 | | `M21328` | `SAMN09704914` | Downloaded GenBank assembly (`GCA_003497005.1`) | 183 | | `M26329` | `SAMN09704930` | Downloaded GenBank assembly (`GCA_003492045.1`) | 184 | | `PTHi-1539` | `SAMEA4643429` | Downloaded GenBank assembly (`GCA_900407865.1`) | 185 | 186 | For `Hi75` and `Hi84` reads were assembled using SPAdes 3.13.0. All assemblies have been placed into the `example/` 187 | directory. `hicap` can be run in series or in parallel (using `gnu parallel`). 188 | 189 | **Serial** execution: 190 | 191 | ```bash 192 | mkdir -p output/ 193 | for assembly_fp in example/*fasta; do 194 | hicap --query_fp "${assembly_fp}" --output_dir output/; 195 | done 196 | ``` 197 | 198 | **Parallel** execution: 199 | 200 | ```bash 201 | mkdir -p output/ 202 | parallel hicap --query_fp {} --output_dir output/ ::: example/*fasta 203 | ``` 204 | 205 | The summary output for these assemblies can be combined using `sed`: 206 | 207 | ```bash 208 | summary_fps=(output/*tsv); 209 | { head -n1 "${summary_fps[0]}"; sed '/^#/d' "${summary_fps[@]}"; } > example_summary.tsv 210 | ``` 211 | 212 | This file can be viewed on the command line or imported into excel. 213 | 214 | ```bash 215 | column -t -s$'\t' example_summary.tsv | less -S 216 | ``` 217 | 218 | To view an isolate's genbank output in `artemis`, you first must combine the multiple genbank records. This can be done 219 | using `seqret` from `EMBOSS`. Using `M21328` as an example here: 220 | 221 | ```bash 222 | union -sequence output/M21328.gbk -outseq output/M21328_combined.gbk -osformat genbank -feature 223 | ``` 224 | 225 | Note that while combining multiple records enables viewing in `artemis`, contig boundaries are masked. 226 | 227 | ## License 228 | 229 | [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html) 230 | -------------------------------------------------------------------------------- /hicap-runner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import hicap.main 3 | 4 | 5 | if __name__ == '__main__': 6 | hicap.main.main() 7 | -------------------------------------------------------------------------------- /hicap/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '1.0.4' 2 | -------------------------------------------------------------------------------- /hicap/alignment.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import pathlib 3 | 4 | 5 | from . import utility 6 | 7 | 8 | BlastFormat = {'qseqid': str, 9 | 'sseqid': str, 10 | 'qlen': int, 11 | 'slen': int, 12 | 'qstart': int, 13 | 'qend': int, 14 | 'sstart': int, 15 | 'send': int, 16 | 'length': int, 17 | 'evalue': float, 18 | 'bitscore': float, 19 | 'pident': float, 20 | 'nident': int, 21 | 'mismatch': int, 22 | 'gaps': int} 23 | 24 | 25 | class BlastResult: 26 | 27 | def __init__(self, *values): 28 | for (attr, attr_type), value in zip(BlastFormat.items(), values): 29 | setattr(self, attr, attr_type(value)) 30 | self.orf = None # annotation.Orf - ORF associated with hit 31 | self.seq_section = None # annotation.SeqSection - blast hits without ab ORF 32 | self.region = None 33 | self.broken = False 34 | 35 | 36 | def create_blast_database(input_fp, output_dir): 37 | logging.debug('Create BLAST database for %s', input_fp) 38 | output_fp = pathlib.Path(output_dir, input_fp.name) 39 | command = 'makeblastdb -in %s -out %s -dbtype nucl' % (input_fp, output_fp) 40 | utility.execute_command(command) 41 | return output_fp 42 | 43 | 44 | def align(query_fp, blast_db_fp): 45 | logging.debug('Aligning %s to sequences in %s using BLAST', query_fp, blast_db_fp) 46 | command = 'blastn -task blastn -db %s -query %s -outfmt "6 %s"' 47 | result = utility.execute_command(command % (blast_db_fp, query_fp, ' '.join(BlastFormat))) 48 | return result.stdout 49 | 50 | 51 | def parse_blast_stdout(blast_results): 52 | logging.debug('Parsing %s BLAST results', len(blast_results)) 53 | line_token_gen = (line.split() for line in blast_results.split('\n')) 54 | return [BlastResult(*lts) for lts in line_token_gen if lts] 55 | -------------------------------------------------------------------------------- /hicap/annotation.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import re 3 | 4 | 5 | from . import utility 6 | 7 | 8 | PRODIGAL_RESULT_RE = re.compile(r'^>[0-9]+_([0-9]+)_([0-9]+)_([-+])$') 9 | PRODIGAL_CONTIG_RE = re.compile(r'^# Sequence.+?seqhdr="(.+?)"(?:;|$)') 10 | 11 | 12 | class Orf: 13 | '''Used to represent an ORF and is associated with a BlastResult instance''' 14 | 15 | def __init__(self, contig, start, end, strand): 16 | self.contig = contig 17 | self.start = int(start) 18 | self.end = int(end) 19 | self.strand = +1 if strand == '+' else -1 20 | self.sequence = str() 21 | 22 | 23 | class SeqSection: 24 | '''Used to represent an section of query sequence for hits without ORFs''' 25 | 26 | def __init__(self, contig, start, end, strand): 27 | self.contig = contig 28 | self.start = int(start) 29 | self.end = int(end) 30 | self.strand = strand 31 | 32 | 33 | def collect_orfs(fasta_fp, model_fp): 34 | logging.info('Collecting ORFs from input assembly') 35 | prodigal_stdout = annotate(fasta_fp, model_fp) 36 | orfs = process_prodigal_stdout(prodigal_stdout) 37 | 38 | fasta = utility.read_fasta(fasta_fp) 39 | for orf in orfs: 40 | orf.sequence = fasta[orf.contig][orf.start-1:orf.end] 41 | return orfs 42 | 43 | 44 | def annotate(query_fp, model_fp): 45 | logging.debug('Annotating %s using Prodigal', query_fp) 46 | command = 'gzip -c -d %s | prodigal -f sco -i /dev/stdin -m -t %s' if query_fp.name.endswith('gz') else 'prodigal -f sco -i %s -m -t %s' 47 | result = utility.execute_command(command % (query_fp, model_fp)) 48 | # Prodigal includes \r from FASTAs, causing problems with the output. Remove \r here 49 | return result.stdout.replace('\r', '') 50 | 51 | 52 | def process_prodigal_stdout(prodigal_results): 53 | logging.debug('Parsing %s Prodgial results', len(prodigal_results)) 54 | orfs = list() 55 | contig = str() 56 | for line in prodigal_results.rstrip().split('\n'): 57 | if line.startswith('# Sequence Data'): 58 | contig = PRODIGAL_CONTIG_RE.match(line).group(1) 59 | elif line.startswith('# Model Data'): 60 | continue 61 | else: 62 | result = PRODIGAL_RESULT_RE.match(line).groups() 63 | orfs.append(Orf(contig, *result)) 64 | return orfs 65 | -------------------------------------------------------------------------------- /hicap/arguments.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import logging 3 | import pathlib 4 | import shutil 5 | import sys 6 | 7 | 8 | from . import utility 9 | from . import __version__ 10 | 11 | 12 | class WideHelpFormatter(argparse.HelpFormatter): 13 | 14 | def __init__(self, *args, **kwargs): 15 | terminal_width = shutil.get_terminal_size().columns 16 | help_width = min(terminal_width, 140) 17 | super().__init__(*args, **kwargs, max_help_position=help_width, width=help_width) 18 | 19 | 20 | def get_args(): 21 | # Parsers 22 | parser_parent = argparse.ArgumentParser(formatter_class=WideHelpFormatter, add_help=False) 23 | parser_files = parser_parent.add_argument_group('File input and output') 24 | parser_params = parser_parent.add_argument_group('Search parameters') 25 | parser_other = parser_parent.add_argument_group('Other') 26 | 27 | # Inputs and outputs 28 | database_dir = pathlib.Path(__file__).parent / 'database' 29 | model_path = pathlib.Path(__file__).parent / 'model/prodigal_hi.bin' 30 | parser_files.add_argument('-q', '--query_fp', required=True, type=pathlib.Path, 31 | help='Input FASTA query') 32 | parser_files.add_argument('-o', '--output_dir', required=True, type=pathlib.Path, 33 | help='Output directory') 34 | parser_files.add_argument('-d', '--database_dir', required=False, type=pathlib.Path, default=database_dir, 35 | help='Directory containing locus database. [default: %s]' % database_dir) 36 | parser_files.add_argument('-m', '--model_fp', required=False, type=pathlib.Path, default=model_path, 37 | help='Path to prodigal model. [default: %s]' % model_path) 38 | parser_files.add_argument('-s', '--full_sequence', required=False, action='store_true', 39 | help='Write the full input sequence out to the genbank file rather ' 40 | 'than just the region surrounding and including the locus') 41 | 42 | # Parameters 43 | parser_params.add_argument('--gene_coverage', default=0.80, type=float, 44 | help='Minimum percentage coverage to consider a single gene complete. [default: 0.80]') 45 | parser_params.add_argument('--gene_identity', default=0.70, type=float, 46 | help='Minimum percentage identity to consider a single gene complete. [default: 0.70]') 47 | parser_params.add_argument('--broken_gene_length', default=60, type=int, 48 | help='Minimum length to consider a broken gene. [default: 60]') 49 | parser_params.add_argument('--broken_gene_identity', default=0.80, type=float, 50 | help='Minimum percentage identity to consider a broken gene. [default: 0.80]') 51 | 52 | # Other 53 | parser_other.add_argument('--threads', type=int, default=1, help='Threads to use for BLAST+. [default: 1]') 54 | parser_other.add_argument('--log_fp', type=pathlib.Path, help='Record logging messages to file') 55 | parser_other.add_argument('--debug', action='store_const', dest='log_level', const=logging.DEBUG, 56 | default=logging.INFO, help='Print debug messages') 57 | parser_other.add_argument('-v', '--version', action='version', version='%(prog)s {}'.format(__version__), 58 | help='Show version number and exit') 59 | parser_other.add_argument('-h', '--help', action='help', help='Show this help message and exit') 60 | parser_other.add_argument('--help_all', action='store_true', help='Display extended help') 61 | 62 | # Change behaviour of help display 63 | quick_help_args = ('--query_fp', '--output_dir', '--version', '--help', '--help_all') 64 | if '--help_all' in sys.argv[1:]: 65 | parser_parent.print_help() 66 | sys.exit(0) 67 | for arg in parser_parent._actions: 68 | if not any(qarg in arg.option_strings for qarg in quick_help_args): 69 | arg.help = argparse.SUPPRESS 70 | 71 | # Glob for database files 72 | args = parser_parent.parse_args() 73 | args.gene_database_fps = [fp for fp in args.database_dir.glob('*fasta') if '1016' not in fp.name] 74 | args.is_database_fp = args.database_dir / 'IS1016V6.fasta' 75 | return args 76 | 77 | 78 | def check_args(args): 79 | # Files 80 | if args.log_fp: 81 | utility.check_filepath_exists(args.log_fp.parent, 'Directory %s for log filepath does not exist') 82 | utility.check_filepath_exists(args.database_dir, 'Database directory %s does not exist') 83 | utility.check_filepath_exists(args.query_fp, 'Input query %s does not exist') 84 | if not args.gene_database_fps: 85 | msg = 'Could not find any database files (.fasta extension) in %s.' 86 | logging.error(msg, args.database_dir) 87 | sys.exit(1) 88 | 89 | # TODO: check that all database files and prodigal model exist 90 | # TODO: ensure the number of threads is sane 91 | 92 | # Input format 93 | try: 94 | utility.read_fasta(args.query_fp) 95 | except SystemExit: 96 | logging.error('Input file %s does not appear to be in a valid FASTA format' % args.query_fp) 97 | sys.exit(1) 98 | 99 | # Directory 100 | if not args.output_dir.exists(): 101 | logging.error('Output directory %s does not exist', args.output_dir) 102 | sys.exit(1) 103 | 104 | # Parameters 105 | if args.gene_coverage <= 0: 106 | logging.error('--gene_coverage must be greater than zero') 107 | sys.exit(1) 108 | if args.gene_coverage > 1: 109 | logging.error('--gene_coverage cannot be greater than 1.0') 110 | sys.exit(1) 111 | -------------------------------------------------------------------------------- /hicap/database.py: -------------------------------------------------------------------------------- 1 | import concurrent.futures 2 | import math 3 | import pathlib 4 | import tempfile 5 | 6 | 7 | 8 | from . import alignment 9 | 10 | 11 | SCHEME = { 12 | 'one': {'bexA', 'bexB', 'bexC', 'bexD'}, 13 | 'two': {'type_a', 'type_b', 'type_c', 'type_d', 'type_e', 'type_f'}, 14 | 'three': {'hcsA', 'hcsB'} 15 | } 16 | 17 | 18 | SEROTYPES = { 19 | 'type_a': {'acs1', 'acs2', 'acs3', 'acs4'}, 20 | 'type_b': {'bcs1', 'bcs2', 'bcs3', 'bcs4'}, 21 | 'type_c': {'ccs1', 'ccs2', 'ccs3', 'ccs4'}, 22 | 'type_d': {'dcs1', 'dcs2', 'dcs3', 'dcs4', 'dcs5'}, 23 | 'type_e': {'ecs1', 'ecs2', 'ecs3', 'ecs4', 'ecs5', 'ecs6', 'ecs7', 'ecs8'}, 24 | 'type_f': {'fcs1', 'fcs2', 'fcs3'}, 25 | } 26 | 27 | 28 | def search(orfs_all, database_fps, threads): 29 | # Generator to split ORFs into even groups for each thread 30 | n = math.ceil(len(orfs_all) / threads) 31 | orfs_split_gen = (orfs_all[i:i+n] for i in range(0, len(orfs_all), n)) 32 | 33 | # Output data for each process and run alignment 34 | with tempfile.TemporaryDirectory() as dh: 35 | # Write 36 | orf_num = 0 37 | query_fps = list() 38 | for i, orfs_group in enumerate(orfs_split_gen, 1): 39 | query_fp = pathlib.Path(dh, 'orfs_%s.fasta' % i) 40 | query_fps.append(query_fp) 41 | with query_fp.open('w') as fh: 42 | for orf in orfs_group: 43 | print('>%s' % orf_num, orf.sequence, sep='\n', file=fh) 44 | orf_num += 1 45 | # Execute 46 | args = ((query_fp, database_fps) for query_fp in query_fps) 47 | with concurrent.futures.ThreadPoolExecutor(max_workers=threads) as executor: 48 | hits_all_sets = [r for r in executor.map(lambda x: run_search(*x), args)] 49 | # Collapse into single set and return 50 | return {hit for hits in hits_all_sets for hit in hits} 51 | 52 | 53 | def run_search(query_fp, database_fps): 54 | '''Perform search via alignment of query sequences in provided database files''' 55 | # If database_fps is not iterable (i.e. a single db) make it so 56 | if not isinstance(database_fps, (list, tuple, set)): 57 | database_fps = [database_fps] 58 | 59 | hits_all = set() 60 | for database_fp in database_fps: 61 | with tempfile.TemporaryDirectory() as dh: 62 | blast_database_fp = alignment.create_blast_database(database_fp, dh) 63 | blast_stdout = alignment.align(query_fp, blast_database_fp) 64 | hits_all.update(alignment.parse_blast_stdout(blast_stdout)) 65 | return hits_all 66 | 67 | 68 | def filter_hits(hits, coverage_min=None, identity_min=None, length_min=None): 69 | '''Filter hits using provided thresholds''' 70 | hits_filtered = set() 71 | for hit in hits: 72 | if identity_min and hit.pident < (identity_min * 100): 73 | continue 74 | if coverage_min and hit.length / hit.slen < coverage_min: 75 | continue 76 | if length_min and hit.length < length_min: 77 | continue 78 | hits_filtered.add(hit) 79 | return hits_filtered 80 | 81 | 82 | def assign_hit_orfs(hits, orfs): 83 | '''Assign each hit their respective ORF''' 84 | for hit in hits: 85 | hit.orf = orfs[int(hit.qseqid)] 86 | return hits 87 | 88 | 89 | def get_region(gene_name): 90 | '''Return region corresponding to gene name''' 91 | for region in ('one', 'three'): 92 | if gene_name in SCHEME[region]: 93 | return region 94 | for serotype_comp in SEROTYPES.values(): 95 | if gene_name in serotype_comp: 96 | return 'two' 97 | else: 98 | raise ValueError('Could not find %s gene in scheme' % gene_name) 99 | 100 | 101 | def get_serotype_group(gene_name): 102 | '''Return the serotype group of a given region two gene''' 103 | for serotype, gene_names in SEROTYPES.items(): 104 | if gene_name in gene_names: 105 | return serotype 106 | raise ValueError('Could not find %s gene in serotypes' % gene_name) 107 | -------------------------------------------------------------------------------- /hicap/database/IS1016V6.fasta: -------------------------------------------------------------------------------- 1 | >IS1016V6 2 | GGGGCTGACGTAGATTAGCAAGTGTGCTAGTCTATAAAAATGAAGATAACTCATTGTAAATTAAAGAAATCTATACAAAATAAACTCCTTGAATTTTTTG 3 | TATTAGAAGTGACAGCCCGAGCAGCGGCTGATTTACTCGGTATCCAAGCCAATTCAGCGATTTTGTTTTACCGAAAAATTCGTGAAGTCATTAGTTATCA 4 | TTTAGCCCTTGAAGCCGATGAGGTTTTTGATGGTCAAATTGAGCTTGATGAAAGCTATTTTGGCGGTCATCGTAAAGGAAAACGAGGTCTAGGCGCAGCA 5 | GGAAAAGTTGCCGTATTCGGTTTGTTAAAGCGACAAGGAAAAGTATTTACAGTAGTGGTAGAAAATACCAAAACAGAGACATTAATGCCTGTTATTGTGA 6 | GGAAAATCAAGCCTCACAGCTGGGTGTATACCAATACTTATCGAAGCTATGATGCTCTTGATGTGAGCAAATTTCACCACGAACGAATCAATCATTCCGA 7 | ACTATTTGCGGTGAAACAAAACCACATAAATGGAATAGAAAATTTCTGGAGTCAGGCGAAGAAATACTCCGAAAATATAATGGAATCGACCGAAAAAACT 8 | TTCCTTTATTCTTGAAGGAATGCGAATTTCGGTTTAACTTTGGAGCACCAAAAGAACAGCTTAAAATATTGAGAAAATGGTGTGGTATTTAGGGCTAATC 9 | TACGTCAGCCCC 10 | -------------------------------------------------------------------------------- /hicap/database/bexA.fasta: -------------------------------------------------------------------------------- 1 | >bexA CP005967.1:675016-675669 Haemophilus influenzae KR494, complete genome 2 | TTATTTTTGAGTTTGATCATAATATTGATACGCTTTGTCCATATCTTCAAAATGGTGCATCATACCATTT 3 | TCCAACACCACAGCTTTATCACAATAAGATTTCATTGCACTTGGACTATGTGAAACCAAAATAATGGAAC 4 | GATCTTTACGCTTTTCAAATAATTCATATTTGCATTTCTCTGCAAACCGAGAATCTCCCACCGCTATTAC 5 | TTCATCGATCAAATAACAATCAAATTCAACAGAAAGAGAAAGAGCGAATGCAAGCCGAGCTTTCATCCCT 6 | GAAGAGTATTTCTTCACTGGTTCATAAAGATAATCACCTAATTCAGAAAATTCTTTTGTAAAACGAGTCA 7 | CATATTCAGGATCAACATCATATAAACGGCAGATAAAACGCAGGTTATCCATCCCGGTTAAGCTTCCCTG 8 | AAATGCACCACTAAAAGCTAATGGCCAAGAAATACTCATTGAACGATCAATAGTGCCGCTTGTTGGGGGT 9 | TCTACTCCACTGATCAACCGAATAAGTGTTGATTTGCCTGCTCCATTTCGTCCTAGGATCCCAATTTTCT 10 | CACCTTTTTTTAACTCAAAATTGATATCTTTTAGTACCGTTTTCCAACCACTATTAGTGTGATACTTTTT 11 | ACACACTTTATTCATACGAATCAT 12 | -------------------------------------------------------------------------------- /hicap/database/bexB.fasta: -------------------------------------------------------------------------------- 1 | >bexB CP005967.1:675666-676463 Haemophilus influenzae KR494, complete genome 2 | TCATTGCGCCTCAATCCCTTTACTGAAATTTTTAACCATCACTAAGCCAATTAGCAATAAAGCCAAATCA 3 | CTTACGACTAAAAATCCGATGCTCTCATAAGTGACTACCGTATCCCCAAAGTAACCATGACGAAACATTT 4 | CCGTACCATGAATCATTGGAAGCCAAAGTGCAATAGATTGAGCCTGTGATGGAAGATTATGTACAAAGAA 5 | AAATGCTCCTGAAATAGGTAACAATACGAAACTTAAGGTCCCCCAAATTTTACCAAAAACCTCAAATTGC 6 | TGAGCGATAGCACAAATAATTAGGCCTAAGCTAAAAGCAAACATAGCCATGAGAAACCATGCAATAAGCA 7 | TATAAAACACATCTTGTGGCGCATCAATCCAACCGATCATCACCAGGATTACCATAAAAAGAATTTGAGC 8 | AATAGAAGCCCCCGCCACCTCCAGTAAAACTCGTGTAAAAATAGTATCTAACACACGAACATTTCGATGA 9 | TAAAGTAAGCTAAGATTTGCTGAAATTGATCCAATTGCACGATTCGAAGCATTGCGCCACATCATCGCCA 10 | TAGGATAGCCCGTCATGACAAAAGCAATCATATTTAAAGTTGAAAATTTATCAGCACGAATAAATTTCCA 11 | CATCATCACAATAAAAAAAGTCATGAGTAAAGGCTCAACAAACAGCCATAGAAAGCCAATATTTTTACGC 12 | CCATAACGAGAGACTATTTCACGCATAAGTAATGCGTTAATCACCCTCCCTTGAATCGCTAATGATTGTT 13 | TAAACGTTGTTTGATCACCATATTGCAT 14 | -------------------------------------------------------------------------------- /hicap/database/bexC.fasta: -------------------------------------------------------------------------------- 1 | >bexC CP005967.1:676463-677596 Haemophilus influenzae KR494, complete genome 2 | TTAGTTTTTATGCTCTCTTATGCTTGCGATAAGTAAACTCAATACACCATATAACATTAAACCGACAATA 3 | AAGGTCGCAATGATATTATAAATACGACTTGGCTCTAATGCCCAGTCAGGTTTACTTGGTTGACTAATTA 4 | TTTCTAAATAAAGTTGTTGGCGATCGGCTTCTCCGCGAGTGTTTTGTAAAGATGTCATTGCTGCGGTCAA 5 | TTGTTGTTGAGCAAGCTCATTGTCTAAGACTAAACGTTGATAATCTGCAGTTTGTGTTGCAGCTGAATTT 6 | CCATTACCTGATAATTGACGTGTTTGTTCATCAATTTCTCTTTTCAAACTTTTCTGGCGCATTTGCAATG 7 | CGGGTACTTGTGGGTTATCTGGCGTGATTGAAATTAATTGTGCTAATTGAGTTTCAACTCGGATTAATTC 8 | ACTTTTCAACGTTGAAATTAATGAAATTTGCACGCCAGATTGAGCCGGTAAATCAAAAATTTTATTTTTA 9 | ATACGATATTGACTCAATGCTTGTGCACTTTCATTCACATTTTTCTCTGCATCTTTTACGGCCTGCTCAG 10 | CAAATTCAATCGTATCTTTTCTTGCACGCTCATTTAATCTATTGATTAATGATTCACCTTCTTTCAATAA 11 | GCGCTCATTGATTTGATAACCTTCTTCAGCATCAAAAGCATGCACTCGCAATGTTGCAATGCCAGAAATA 12 | GAATCCACATCAACACTCAAACGTTCTTTAAAATAACGATAGAATGCCTCTTGTGTATCATTCAAACCAA 13 | ACCCATTAAAGCGGCTTAATAAATCGCCTTTTTCAGAATAAAAAGTGCGAAGAGGCAAACTTTGCTCTAA 14 | TGCTGATAGTGCTGTACGTGAACGCATATACTCTTGCACAGAGTAAGTATCATCCTGTGAACGAGAAAAA 15 | CCCGTACTTTGCAATAATGCACCAACTCCGCTTAAAGAAGACTGACTGCGAGGAGAACGTACTACAAAAC 16 | TAGATTCTGAAACATAGATATCAGATGCTAATAGACCAAAATATACTGCAGAAAAAGCAGTTGGAATCAA 17 | TACAGTTAATCCAAAAAGCGAATTCATTTTATTCCAAAGTGATTTCTTCTTTTTCTTCGGTGCCACTGGG 18 | TTTTCGGTTGTCAT 19 | -------------------------------------------------------------------------------- /hicap/database/bexD.fasta: -------------------------------------------------------------------------------- 1 | >bexD CP005967.1:677611-678795 Haemophilus influenzae KR494, complete genome 2 | TTAATAACTTCTGATCGTATTGGTCGTACTCGTTACCGGCGAGGTAATCGAGAAAATCATTCTCAAGAAT 3 | TTTTGGAATTCTGAAAGCGGTGCATTCGACACATATACAATATCTTTATCTTGGATAGGGAAGCGTTGTA 4 | ATAAAAACATGGTTTCCGGTTGTAATAAATTCGCACGGTATACGGTTGGCACTTCCATGCCATTACCATA 5 | CCCCTTAGCCGCCCATTCTTGCTGTGCTTTAGAGTCTAATTGTGCAAACGGCATATAACGGAATACAAAG 6 | ACACCTCGTGGGTCAGAACGCGTGTCAATCAAACCGCCCATTTTACCAATCGCTTCAGCAAGCGTAATAC 7 | CACTGCTAGAAAAACGTAACTGTTGGTTATTACCTACAGCGCCTAGCCCTGTAAATTTATATGGCGTATT 8 | TAAAAGTGAAACCACATCGCCTGCACGTAATACAATATTTTGCTTAGGATCGGCAATTAAGGTTTCAAAT 9 | GCCAATGTTTTCACTTGATTTCCTCGCGTAAGCTGAACAGTCACATCTTCAATATTTTCTGTTGATCCAC 10 | CTACAGCAGCCACTGCATCTAAAACACGTTCATCATTTGCAGTTAATGGCATACGCACAGTACTACCTTG 11 | ACGAATAACAATCACATCTGATGAATTATTGTTAGCAATTTTAACTACTGCCTGTGGTTGATTTGCTTTA 12 | CGTCTAAGGCTTGCCACAATTTGAGCTTGAATAACCTCTGGTGTCTTACCTGCGACACTGATATTTCCAA 13 | CAAATGGCACGGTTACCGTACCATTTTTATTTACGATTTGTGAAGGTAATTGTGTAACATGGCCACTGCC 14 | CTGTCCTTCACTACTAAATGTTGTACCAAATAACACTGCTGGAGGGGCTTCCCAAATGGAGATCTCTAAT 15 | ACATCACCCACATTTACAGCACCAGCATAACCGCTGCTGCCAGACACATCTGCAAACCCTGAAAAGCGTT 16 | GACTTTGTTGTGCCATGTACATTTGTTGCACGAGTAATTCATTTAACTCAACTACATTAACTTTTGCTGC 17 | TAACTCAGATGCATCAGCTCCTTGGTTTATATCTAATACCGCTGAATGACTTGGTCCTGAAGTTGGTAAC 18 | GAAGAACAAGCGGAAAGTCCAAACATCAATGCAAAGCTGACCGCTTTTAGTGGATAATTTTTCAT 19 | -------------------------------------------------------------------------------- /hicap/database/hcsA.fasta: -------------------------------------------------------------------------------- 1 | >hcsA CP005967.1:684125-686167 Haemophilus influenzae KR494, complete genome 2 | ATGCCAACTGCTCTGATTTTCTCGCACGGAATCAAAAAAATTCCGCATTTAGCCTCATTTTTCCCTAATC 3 | AAAAATTGGCTTTCGCGCGCATTTTTTCTGTGCCGAAGGCTGATTCTGTGTTGGGTTGGGGGTTACGTCC 4 | TTCCACGAAAAAATCACGTGCATATGCACAAAAGCATAACTTACCGTTTATCGCCTTAGAAGACGGTTTT 5 | TTACGTTCGCTAGGCTTGGGCGTTGATGGTTATCCACCACTTTCTATGATCGTGGATAAATTAGGTATTT 6 | ATTACGACACGACTCGTCCCTCAACATTGGAACAGCTTGTTCTGGCGGGAGAATGTGATGAGGTTTTAGC 7 | GGAAAAGGTTCGATCACAGATTATGACGCATCAACTTTCAAAATATAACCAAACATTAGTGGATTATGAG 8 | AAAGAAGGTGACGAGCCATTAGTGCTTGTTATCGACCAAACCTTTGGCGATATGGCGGTGAAATATGGTC 9 | AAGCCGATGCTGAGCATTTTGCACAGATGTTACAAGCTGCCATTACAGAAAATCCCAAAGCCAAAATTTT 10 | AGTGAAAACCCATCCTGATGTATTAAGTGGTAAAAAACAGGGCTATTTTTCGCCAAATGAAAATTATCCA 11 | AGCAACGTGCATTTTTTTAGTGATCCCGTCAATCCGATTTCGCTGATTAAAGCCGTAGAGAAAGTTTATT 12 | GTGTTACCTCTCAAATGGGGTTTGAAGCATTACTGGCGGGTAAACCGGTGGTGACGTTTGGCGTACCATG 13 | GTTTGCTGGCTGGGGCGTGACGGATGATCGTCATCAGAATGCTAAAGCATTGGCACAAAGTGAGCGTCGT 14 | AAAGTGCGGTCAGTTTTACAACTGTTTTATGCGGCATATTTTCAATATACTCGTTATTTGAATCCAAACA 15 | CCGGCACAGCTGGAACAATTTTTGATGTCATTAACCACATCATTCACACCAAAGCACTTAACTTGTGCTT 16 | ACAAGGTAATCTCTATTGCGTTGGAATGTCGTTGTGGAAACGTGCGGTTATTAAACCGTTTTTCCGTTTA 17 | CCAAGCTGCAAGCTACATTTTGTTAAAGATGTGAGTAAACTCAATGGTAAAACATTCACAAAAAATGACC 18 | GCTTGTTACTATGGGGAACCGGTAAAGAAGCTGCGCTAAATTATGCTAAAGCGCATAATATTAACATGCT 19 | CAGAATGGAAGATGGGTTTATTCGTTCAGTTGGGCTTGGCTCAAACTTGGTTGCGCCACTTTCTTTAGTG 20 | TGTGACGATTTAGGTATCTATTTCAATGCAGAAAGTCCTTCTCGCTTAGAAGAGATTTTGCAGCATCAAC 21 | AATTTACCGAAGCAGATTTAATCGAAGCCAGTCAACTACAACATGCGTTGGTATCGCAACATATCGGTAA 22 | ATATAATGTCGGTGAAGGAACATTTTCTTTACCGAATACAGTCAAAAAGAAAATTTTAGTGGTAGGACAG 23 | GTCGAAGACGATGCCTCTATTCGAACTGCCTCACCGAATATTCGCACTAATTTAGATTTATTAAAAACAG 24 | TATGCGCCGCAAATCCTCAAGCTTATATCGTTTATAAGCCACACCCGGATGTTGTAAGTGGTAACCGCAT 25 | TGGTCATATTGCAGAATCGCAAGCGGTCAAATTAGCGGATCAAATTGCAAAAACAGAAAACGTGCTTGAC 26 | TGCATCAATGCCGTGGATGAACTACACACCATGACATCTCTTGCAGGTTTTGAAGCCTTGCTAAGAAACA 27 | AAACGGTGCATTGTTATGGTTTGCCATTTTATAGCCACTGGGGATTGACCGTTGATCACTGCTCTTTTAA 28 | CCGCCGCAATCGAAAACTTTCATTGTTAGAACTTATTTCTGGCACATTGGTCTATTATCCACAATATGTT 29 | AATCCGAATACGGGTGAGCTAACCAATGCTCAAACAGCGATTGAAATTTTGAAAGCACAGCGTTTAGCGC 30 | TTAATCACAGCGGTATTCATCGCCATTGGCTAGCTAAACAATATGGCAAATTGCAGCATTTAGTGTGCGC 31 | ATTGCGTACTTAA 32 | -------------------------------------------------------------------------------- /hicap/database/hcsB.fasta: -------------------------------------------------------------------------------- 1 | >hcsB CP005967.1:686221-687441 Haemophilus influenzae KR494, complete genome 2 | ATGAACCACTATTTAGATGAATTAGTCCAAAGTTCACAGCGGATCTTGCTTTTGCAAGGGCCGATAGGTC 3 | ACTTTTTTGCTGATCTTTCTGATTGGTTAGTGGGGCAAGGAAAAACCGTTTATAAAATCAATTTTAACGG 4 | TGGCGATGAGCATTTTTATCCATTATCGATTGAAAATACGATTGCTTATCGTGGCTCAGTGAGTGAGTTC 5 | TACCCTTACCTGCAACTATTTTGCAAACAACATAATATCGATGCGATGGTTTGCTTTGGTGATAACCGTA 6 | AATACCACAAAATCGCAAAAAAAATCTCACAAGATAGACAGATTCTATTTTGGGTGTTGGAAGAAGGCTA 7 | TTTCCGTCCTGATTATGTAACACTCGAAAAACTAGGGGTAAATGCGTTCTCTCCTCTTCCTCGCCAGGCA 8 | GACTTCTATCTTGAACAAGCCGAAAATTTACCTGAGCCAACCGTACCACTTAAATTAGCCAAAGGTTTTT 9 | TAACGATGGCAAAAGTAGCAATAGCATATTACGTTAGTGCATATCTAGCTAGAGATAATTATCCTAAATA 10 | TCAACACCATCGTATTATTAACCTTAAATATTACATCAAACATTGGATCATTTCGGGCATTAAACGGACT 11 | TGTTATTATTTGCGTGATCGCACGTTTGCAAAAAAAGTAACAAAAGGAGAACTCGGTCATTTTTTTATTG 12 | TACCGCTGCAAGTTTATGATGATAGTCAAGTGAAAATACATTGCGACTTCAATAGTGTCGGTGAATTCTT 13 | AGCTGAAGTACTACGGTCTTTTGCTACATCTGCGCCTAATCATTTAAACTTGGTCATTAAGCACCATCCA 14 | ATGGATAGAGGTTTTGTTCATTATGAGTCTGTTATTCTAGAGTTTGAAAGCTGCTATCCTCATTTAAAAG 15 | GAAGATTATTTTATGTACATGATGTGCCATTGCCCGTTCTACTTCGCCGTGGAAAAGGCATGGTAACATT 16 | AAACAGTACGAGTGGTATTTCAGCCTTATTACATGGAATGCCCGTTATTACGCTTGGGCGTGCAAATTAT 17 | CATTTTGAAGGTCTCACACACCAAGGTGATTTAGCTTCATTCTGGCAAAATCCAACCAAGCCTGATATGT 18 | CAGTATTTGAGGCTTACCGCAAATATCATCTCAATAAAACCATGATTAACGGCAGTTTTTATACTCGAGT 19 | CATCCTTCCCTTACATCAGGATGAAAATTAA 20 | -------------------------------------------------------------------------------- /hicap/database/type_a.fasta: -------------------------------------------------------------------------------- 1 | >acs1 2 | ATGAATAAAAATAAAAACATAGGAATCATTCTAGCTGGTGGTGTTGGCTCTCGTATGGGATTGAGCTACCCAAAACAATT 3 | CTCAAAAATTGCAGGCAAAACTGCGCTGGAGCATACTCTTGCCATTTTCCAAGAACATAAAGAAATTGATGAAATTATCA 4 | TCGTTTCTGAGCGTACCTCTTATCGTCGTATCGAAGATATCGTATCAAAAGCTGGATTTTCCAAAGTTAATCGTATTATT 5 | TTTGGTGGTAAAGAACGCTCTGATTCTACTCTTTCTGCAATCACAGCTCTTCAAGATGAACCAGAAAATACGAAATTAAT 6 | CATTCATGATGCTGTACGACCTTTACTAGCGACTGAGATAATCTCTGAATGTATTGCGAAATTAGATAAGTACAATGCTG 7 | TAGATGTGGCTATTCCTGCAGTTGATACCATTGTTCATGTTAATAATGATACCCAAGAAATTATTAAAATTCCTAAGCGT 8 | GCTGAATACTACCAAGGCCAAACTCCACAAGCATTTAAACTAGGCACGCTAAAAAAAGCTTACGATATTTATACACAAGG 9 | TGGCATCGAAGGTACTTGTGATTGTTCTATTGTGTTAAAAACCCTACCTGAAGAAAGAGTTGGTATCGTTTCAGGTTCTG 10 | AAACCAACATTAAATTAACTCGCCCAGTTGATCTTTTTATCGCTGATAAATTATTCCAAAGCCGTAGTCATTTTTCACTA 11 | CGTAATATCACCTCTATTGATCGCCTATATGATATGAAAGATCAGGTATTAGTTGTTATTGGTGGAAGCTATGGTATTGG 12 | CGCGCATATTATCGATATTGCAAAAAAATTTGGAATTAAAACATATAGCCTTAGTCGTTCAAATGGTGTCGATGTTGGTG 13 | ATGTTAAGTCTATTGAAAAAGCATTCGCAGAAATTTACGCAAAAGAACACAAAATAGACCATATCGTAAATACTGCTGCG 14 | GTGTTAAATCATAAAACGTTAGCATCAATGTCTTATGAAGAAATTTTAACTAGTATCAATGTAAACTACACGGGCATGAT 15 | TAATGCTGTGATAACAGCTTATCCTTACTTAAAACAAACTCATGGTAGTTTTTTAGGTTTCACATCAAGCTCGTATACAC 16 | GAGGCCGTCCATTCTATGCTATTTACTCTTCTGCAAAAGCAGCTGTGGTAAACTTAACTCAAGCCATCTCTGAAGAATGG 17 | TTACCGGATAATATTAAAATTAACTGCGTTAATCCAGAGAGAACAAAAACACCAATGAGAACCAAAGCATTCGGTATTGA 18 | ACCAGAAGGCACACTACTTGATCCCAAAACGGTAGCATTTGCTTCTCTTACTGTACTCGCTAGCAGAGAGACTGGTAACA 19 | TCATCGATGTTGTATTAAAAGATGAAGAATATATTTCCCATATTTTAGCTGATCTTTATAAATAA 20 | >acs2 21 | ATGGCTAATACACCCTATTTTATTTATCTTGACACCAAAATTATTGGTGCAGTAAAGCAGACAATTACCTTTTTCGAACA 22 | TGGTGTGTTTCCTCGTGGAAACACAACCATTCTTGTGAAAAAGTATAAGCATAAGTCAGCAAAAATAATTGAGCGAGCTT 23 | TAATGAAAGCCTCGCTCAATTATCATTTTGTCAATGCCGCCTACCTTGATGCATTAACAGAAGGTGTTATTTTTTACCCA 24 | TTTAATGCACAGTCAAATTGCCGAGCAGTAGCAAACCGTAAACTTACTCATATTTTTATCACTCATGGTGAAAGCAATAA 25 | AATCACCTCAGTTAAGCCTATTACTCGCATTTATGATCATGTTATTACTGCAGGTAAAGCTGGTGTAGATCGCTTTCTTT 26 | CCCATAAAATTTTCTCTCAATATGATGTTGATACAGGCAGAATTATTCCTATGGGAGATACATTTATTGGGAAAACAGGA 27 | CTAGATTGTACAGGTAAAGGCACTCCGGTCATCTTTTATGCTCCAACATGGGAAGGCGGTATTGAGCAAGAAAATTACTC 28 | TAGCCTTGCTCATATAAATCAAGTTGTGGCAACCATCTTACAACTTAGCGAATACTATCAAGTGAAGCATGTTGCCATTC 29 | GTCCACACCCAAACACAGGACACCGCAGACCAGAATATCACAATTTTTTATTACGAATAATAGAAAGCTTACAAGCAAAA 30 | TCACTAAAACTCGTACTTTTCAAACCTTACTTGAATTTTTCTTTTGCCCAAGAATGGAAATTAAAGCGGAGAGATGTTGT 31 | TTTTAAAACAAACTTCAGTGAGTTTAGTGCTGTAGTTGGCCTGTGCGATATTTCTGCAATGGAAACTCAATTACTTAACG 32 | AAAATATTTATTACTACTTATTCTGCTCTGAAGAGTACAAGCAGTATCTATTGACGTTAAAGAACAGTGAATGCTATCAA 33 | AATAACGCATTAATCTTTGATTGCGGGGAATTGATTCCTTCTCAAGAATTAGAAAATTTCCAACATTTAAAGTCTTATCT 34 | AATAGATTCTAACTTCTCTGAAATTCCAATTTCAGAAAGATTGAGATTTTTATTGACAAACTTAATAATGAGCTAA 35 | >acs3 36 | ATGAAAAAACGTAATTTATTTAGAAAAAAATTTAAAAATAATGCTCCGCGTAATGAGCGTATCGATGTAAGCATCATTAT 37 | CCCAATGTATAATGTAGAAAATTTAATTGGTGAAACTATTGAATGCTTAAAAAATAATTTCTGTAAAATGGAAGTATTGC 38 | TTATTGACGATGGTTCAAAAGATAACACTGTTAATAATGCAAAATTAGCCGTTGCTAACGATAAAAGATTTACTATTCTT 39 | CGAAAAGAAAATTCTGGTGTTTCCTCTACTAGAAACTTTGGAATAAAAAAAGCAAAAGGAGAATTCATTTTTTTCTGTGA 40 | TTCTGATGACATTTTAGAAGAAAATGCTATTGATAAACTACTCATTGCAGCATTTGCTGAAAATGCGGATTATATTTACG 41 | GTGGCATCAAAAAATTTAATAAAGAAAAAGAGTGGACTATTCCTGTTCACGACAAAAATAATCTATTCCTACAAGGAACA 42 | AAGACCATCGATAAGAATACAGAACTATTTTTATCAATGTCTCCTGGGGCAAAATTAATACATCGATCACTGTTAAAGAA 43 | TAAATTTTTTCCAGAAGATATTCATTGTGCAGAAGATCAGGTCATATTCTTCAATATATTTTTATATGCTAAAAAAATCT 44 | ATTGTATCGGTAACTATATCTATAAATATAGAGAGCGAGATTTAGAAAACAATGAACGATCAATTACACAGCAACGTGAT 45 | ATAAAAGCCTTTGCATTTTTTATTGATATTTTGTCAGTTATTGAAATCAATAGAAAAGTTTTGGAAGAATCTGCTTTAAC 46 | TGACTCTCAAAAAAAACTTGTTCTTAAAGCATATTTTGAAAGAGCCTTAACCTTTGATGTATGGCCTCTATTTCTACGTG 47 | TCTTAAAGTTTGACAATAAAAAATCTAGCGAGGCGATAACTCTGATAATCAATCTAATTAATAGTGTAGATAAAGAGTTT 48 | TTGAATTACACTCCAGGATTTAGATATTTTTTCTTAAGAGTTTTAATTGATAATATTGATTATATTAGCATCAAAGATTA 49 | TTTACTATACAAATCACTAGTAGCTCTAATCATTTCAAACTTACAAGAAGAAACTATAGAGGTTTGTGAAAATTCGCCAA 50 | ACTGGGGAAATAGATTGACAGAAAATAAAAGTATTATAGCTAAAAATGGATTCTTAAACTTTTTATTATTACGTCAGAAG 51 | AAAAAACTTTTTAGATTTTTAAATAGAAATAGAGAATTTATTGGTAAAAATTTATTTTTCCCTTTAATGAAACTTATTCC 52 | TATCAATAAGAATAAGATTGTGTTTGCTACATCATCAAAAGGAAAAGCATCTAGCAATTTCACATATCTGCTAAATGAAC 53 | TAAAAAAAGATAACAAGAATTATGAGATAAAAAAATTCCTTGGTTTATCAAATGAACTAAAAAGAAACTTATACCGCTAT 54 | TATCATTTAGCCACTGCAGGAACAATTTTTTTAGAAAGCTATTATAGCCCCCTATATAATGTAAAATTAAGAAAAAGTAC 55 | TAAAGTAGTTCAATTATGGCATGCTTGTGGCGGCTTTAAAAAATTCGCATATAGCTCACTAGGTCAAGGCGATGCTAACT 56 | CCGAAGAATTTGAGTATCATGCTCATAAGTTTTATACACATGTTATGACAAGCTCAGATGATACCAGTATTATATATTCT 57 | GAAGCATTCAACTTACCTTTAGAGAAAATGCATAGTTTAGGTGTTCCTAGAACTGATTTCTTCTTCAATAGAAGAAAAAT 58 | GAATTCTGTACGAAATGAAATTTTAGAAAAATACCCTGAACTCAAGAATACTAAAAATGTACTTTATTCTCCAACATTTA 59 | GAGGAAATCCTAGAGAGCGTAAAAACTTCAAATTACCATTTGATTTTAAACAATTTGATAAATTACCTTATGAATATAAG 60 | ATAATTATCAAATTGCACCCAGCAGTCGATATTTCAAGTATAAAAATACCATATCATTATAGAAATCGTTTTTTATTATT 61 | AGATAGTTCCGAAGATGTTAACCAATGGTTATGCTTTAGTGATATATTAATTACGGATTATTCTTCATTAATTTTTGAAT 62 | ATGCATTACTAGATAAACCAATTATTTTATATGCGTATGATATCGATGAGTACTTCGATGAACGTGGTTTCTATAATCCA 63 | TATGAAACTTATGCATATGGAGAAATAGTCACAAATAAGAGAAGGCTTATTGATGCTATTTTAACTGCTGAAAATAACAT 64 | GGATGATTATGCTCAGAAAAAAGAAGCTTTTAAAGAAAAATTTATGTCTGGCTGTGATGGCAAATCATCTATAAAAATTC 65 | TATCTTATATTATGAAATAA 66 | >acs4 67 | ATGAGGAACATAAAAACGTTATTAGAACTCATAAAAAATGAAGATAAAAACTTTTCTTTTTATAAATCATTTTCCAATAA 68 | ATCTATCTATTATGATTTTCCATTCTTTCATCACAAAGAGAATAAATGGGATAGTTTTACCGTCAGCATTGATTTAGTAA 69 | AACAAAGATTTTATTTTTATCTACGCTCTCACTTAGAAATCAAAAAAATTACTGGTATCGTTCCTGTTTTAGACTTACAT 70 | GAATGGGAAAATAACTTATTTGTTTATCACATCGCTAAATTAACTGACCTAGATGTTGTCAGGTTATATATTTTACTTAC 71 | AAAAATGATCGAAAAAAATTTATCTATTTATAACACACCTAACATAGAGTTAGAAAAATAA 72 | -------------------------------------------------------------------------------- /hicap/database/type_b.fasta: -------------------------------------------------------------------------------- 1 | >bcs1 2 | ATGTTAAAAAATAAAAACATAGGGATCATTTTAGCTGGTGGCATAGGCTCTCGCATGGGCCTAGGTTACCCAAAACAATT 3 | TTCAAAAATTGCAGGTAAAACAGCACTAGAACACACAATTTTCATTTTTCAAGAACATAAGGAAATTGATGAAATTATCA 4 | TCGTTTCTGAGAGGAGCACTTATCGTCAAATTGAAGATATCGTTGCAAAAGCAGGCTTCTCTAAAGTTAATCGAATTATT 5 | TTTGGTGGCAAAGAGCGTTCAGACTCTACACTTTCTGCAATTGCTACACTTGAAGGCGAATCAGAAGAAACTAAATTAAT 6 | TATTCATGATGCTGTCCGTCCTTTGCTGGCTGGAGAGGTGATTTCTGAGTGTATTAAAAAGTTAAATAAATATAACGCTG 7 | TGGATGTTGCTATTCCTGCGGTTGATACCATTGTTCATGTCAATAATGAAACTCAAGAAATTATTAACATTCCTAAACGA 8 | GCCGAATACTACCAAGGTCAAACCCCGCAAGCATTTAAATTAGGTACGCTAAAAAAAGCTTACGATATTTATACTCTAGG 9 | TGGTATCGAAGGTACTTGCGATTGCTCTATCATATTAAAAACACTACCAGAAGAAAAAGTGGGCATTGTTGCAGGTTCTG 10 | AAACCAATATTAAATTAACTCGTCCAGTGGATCTTTTTATCGCTGATAAATTATTCCAAAGCCGCAGCCATTTCTCACTT 11 | CACAACATAACCTCTATTGAGTGCCTATATGATATGAAAGATAAGGTACTAGTCGTTATTGGTGGTAGCTACGGTATTGG 12 | CGCAGATATTATTGAGATTGCACAAAAAGTTGGCATCAAAACATACAGTCTAAGCCGTTCTAATGGTGTTAATGTTGCAG 13 | ATATTGAATCTATAGAAAAAGCATTGGCTGATATTTATGCAAAAGAACATAAAATTGATTACATTGTCAACAGTGCAGCC 14 | ACATTAAATCATAAAACATTGACTTCGATGTCTCGTGAAGAAATTTCAACAAGTATCAATGTAAACTATACAGGCATGGT 15 | TAATGCGGCTGTAGCAGCGTACCCTTACTTAAAACAAAGTCACGGTGGTTTCTTAAGTTTTACCTCAAGTTCTTATACTC 16 | GAGGTCGTCCATTTTATGCTATTTACTCTTCTGCTAAAGCGGCAGTAGTAAACTTAACTCAAGCTCTCTCTGAAGAGTGG 17 | TTACCTGACAATATTAAAATTAACTGCATTAACCCAGAGAGAACAAAAACGCCTATGCGTACCAAAGCATTCGGTATTGA 18 | ACCTGAAGGCACACTACTTGATCCAAAAACAGTTGCATTTGCTTCTCTTACTGTACTCGCTAGCAGAGAGACAGGTAACA 19 | TCATCGATGTTGTATTAAAATATGAAGAATATATTTCCCATATTTTATCTGATCTTTATAAATAA 20 | >bcs2 21 | ATGACCAATACACCCTATTTTATTTATCTTGACACCAAAATTATTGGTGCTGTAGAGCAGACAATTACCTTTTTCGAACA 22 | TGGTGTGTTTCCTCGTGAAAACACAACCGTTCTTGTGAAAAAGTATAAACATAAGTCAGCAAAAATAATTGAGCGAGCTT 23 | TAATTAAAGCCTCGCTCAGTTATCATTTTGTCAATGTCGCCTACCTTGATGCATTAACAGAAGGTGTTATTTTTTACCCA 24 | TTTAATGCAAAGTCAAATTGCCGAGCAGTAGCAAACCGTAAACTGACTCATATTTTTATCACTCATGGTGAAAGCAATAA 25 | AATCACTTCAGTTAAGCCTATTACTCGCATTTATGATCATGTTATTACTGCAGGTAAAGCTGGTGTAGATCGCTTTCTTT 26 | CCAATAAAATTTTCTCTCAATATGATGTTGATACAGGCAGAATCATCCCTATGGGAGATACATTTATCGGCAAAACAGGA 27 | CTAGATTGCACAGGTAAAGGCACTCCAGTTATCTTTTATGCTCCAACATGGGAAGGTGGTATTGAGCAAGAAAATTACTC 28 | TAGCATTGCTCATATAAATCAAGTTGTGGCAACCATCTTACAACTTAGCGAATACTATCAAGTGAAGCATGTTGCTATTC 29 | GTCCACATCCTAATACAGGGCATCGTTTGCCTAAATATCATCAATTTTTGATAGATATTGTAGAAGCTCTTCTGCATAAA 30 | GGATTAAAAATTACATTATACAAACCTCATGTAGGACTCACATTCTTTCAGGCTTGGAAACTAAGACGAGAAGGCGTAAG 31 | CCTAACTTCTGACTTAAGTAAATTTTATGCACCTATCGGACTTTGCGATATTTCAGCCGTAGAAAGTCAATTATTGAATG 32 | AAAATATTTTCTACTATTTATTCTGTTCAAAAGCACAAAAAGAATATTTAATCAGTCTAAAAAATAGTCAATATTATAAG 33 | ACTAACATACTTACTTTTGGTGAAAAACTTTATTTTCATCACATACCGAAAGACGAGTTTTATCGACTCCGTGATTATAT 34 | GGTAGAACAAAATTATTTAGACATTCCGTTTAATCAACGAATCGAACAGCTTCTAGCAAAATTAAATCAATTATAA 35 | >bcs3 36 | ATGAAAACTTGGTTATTTGGCTCTTATGCTTGGCAAGGAAATCCTAAGGCTTTATTCCTGTATATGCTTGTAAATTGTAA 37 | AGAAACCCACGAATGCTGGTGGGTTGCAGACAACGAAGAAAGCATGAAGAGTATAAAAAAATCTACTGGCTTAAAAAACA 38 | TTACGTTTACCGATAGTGAAAAAGCTAAAGCACTTTTCCCTCATGCCGACGTTTACGTAACAGAAAACTTCCGTGAAAGT 39 | TATCCAGTTTACATGAATGAAAATATCAAAGTTTTCAACACATGGCATGGCGTTGGTTTAAAACATATTGAATTAGCATT 40 | AGGCATGAATTCAGTATTAGCTGAAAGCATTGTTCGAAAATATGTTCGAAACTATGATATCTACAAAAATAATGTATTGT 41 | TTCTTACAACATCGCAAGCAATGGAAGATCACTTCCTTGAAGATATGGCGATCAGTAAAGAACTAATTATCCGCGGGAAA 42 | TACCCTCGCAATGCAGTTTATGGTCCTAATGGGATCCATACCTATGATATCAATACGCTTTTACCAAAAAATAAAAGCCA 43 | ATATAGCCAAACTATTCTTTTCTGCCCAACTTATCGTATTGGTGCAATCCAAGGTGTTTTAAATAGCCTATTACCAGATT 44 | TTGCTAAACTTGAAGAAGTTTGCCGTCATAAAAATCAACTATTCATCGTTAAAGTTCACCCGTTCATGAAGAAAGATAAT 45 | TACTTCGCTGAAATGAGTGAAAAATATAAAGATAGTGAATACATCCTATTTTGGAATGATGACTATGATATTTATGAGGC 46 | ATTCAATTCTATCGATCTCGCGATTATTGACTATTCAAGTATCTTTTATGATTTATTAGATGCTGGCGTTGAAAAATTCA 47 | TTCGTTATGTACCTGACTTAGATGAATACCAGAATGATCTTGAGCTAATTGGCGATTATGCCGATTTAACAGAAGGTCGC 48 | ATCGTTAAATCATTCCAACAATTATTAAATTGTTTAGATAATGCCAACATTAAAATCATTTCAACAAAAAGAAAACAATA 49 | TCTTATGGATTATTTCTTTGGATTTGAGAAAGAAAATAAATCAATGGAATCTTTAATTGCAGATGTTGATAATTGCCAAT 50 | TACAACCAAAATCGTTAAAAGAACTCCATACATTTGATATTTTTGATACCTTAATTCGCCGCTCGACATTACGTCCATTT 51 | AGTATTTTTGACTATGTACGCGACAAAGCTAAAGCATCAGGTATCAAATTCCCGCTTGCATTGACTGAAAATTGGATCAA 52 | TGTACGTAACCGTGCTGAACACGATGTGCGAGATATCATGCGTAAAACAACGTTTGAGCGTCAATCAGATAAAATTGAGA 53 | TTACATTAGACGATATCTACACTCGCTTGCAAAAAAATCTATTACTTACCGATGAACAAACTGATTTCTTAAAACAAGCT 54 | GAAATTGAAGCTGAAATTGCTCATGTTGAGCCAATTCAAAAACGAATTAACTATCTCTTCTCGTTAAAAGCGAAAGGACA 55 | TGATGTAGCCATGGCTAGCGATATGTACTTGCCTGAAGACGTAATTTGTAAAATGTTAGATCGTGCGGATACTCGTTTAC 56 | GTGAAATTCCACTTTATCTTTCAAGTACGATTGGCTACCAAAAATCAACTGGGAAATTATACCAACACATCTTTTTCGAC 57 | TTAGATTACCAATATAGCCGTTGGACACACTATGGCGATAACAAACACGCTGATGGTTCTGTTCCTCGCCGTCTTGGTAT 58 | TCAAACTGCAGTGCATGATATTGATGATTTTATCCCATTTGAAAATGCAATGGTTAATGCAATGGATAACTATAACCGCT 59 | ATCCAGCTTACCAGCTTGCAACTAAGATGCATCGTTACCGCACACAGCTTGTTCAAGAAAATGGTTTCGGTAATACCCTA 60 | TTTGAAACCAAATATTACAACTATGCTTATGTAGGCGCCTCTTTTGTTCCTTATATCAACTGGGCAATTAAAGATGCAAT 61 | TAAACGCGGCTATGAAACCATTTACTTTATCTCTCGCGATGGGCATTTCTTAAAGCAAATTGCTGACAAAATTATTGAAA 62 | TTCGTGGCTATAACGTAAAAACAAAATATATCTACGGTTCACGTAAAGCATGGCGTTTACCTTCTTTCATTACCAAAGTT 63 | GATGATGAAACCTTCTGGCAATTTGGTAACTTTGTCGGTATGGATAGCTTTGAAGATTTGGTGAAAGCCAGTTATTTAAG 64 | CGAAAGTGAACTCTTATCTCTCTTCCCTGAATTTGAAAGTTTACGTCATGCCAAACACCTTCGTGGTGAAATAGCTGAAA 65 | ACATTCGTAAAATTTTCAAAAATTCACCCGCTTACCATGAGAAAGTGTTAGCGATCGCCGCTGAAAAACGCAAAATGGTA 66 | CGCCAATACATTCAACAAGAAATTAATCCAAAAGAAAAATTTGCGTTTGTTGAATTCTGGGGGCGAGGCTATACACAAGA 67 | TACCTTTGGTCGTCTGCTAAATGATGCCTTTGGTAAAGAAGTAAAAAACCCATTCTATTATGTCAGAAGTTTTACTGATG 68 | ATATGGGTACATCTGTTCGCCATAACTTCATCTTAGCACCACAAAACTTCTCATTCTTCGAGCCTATTTTTGCACAAACC 69 | CCATACGACAGTATTCCTGGTTACTACGAAGAAAAAGGCAGAATTGAACCAATTATTAATCACCGAGATAGAAGCGTAAG 70 | CGATCTCATTTCGGAAGGGTTATTAAAATTTACAGAAGATTACTTAGCACTCAATACGCAAGATGAAGATTACTTTGATG 71 | CAGCATTATCGCAATTTAACTATCAATATCAGTTAAATACACCAAATGATCAATTTATTTGCAATGTATTCAGTGAATTA 72 | AAAGATAACATTTCAAGTTTTGGTGTAGAAAAACCTTATGCACCAGCATTAACGCTGAAACAGCTTGAAAGTATCGCCTC 73 | TAAACAAGAGCTGGATAAACTGACTCAATCAATTCCTATCTCACTCTCAAAAAGTGATGTAAAAGTAATTGATTATTATA 74 | ATAAAATTCAGAAAAACTATAATTTACCGGCATATAACAGCACACCAATGCGTAAAGCTTATGCAGTAAACCCATTAGAA 75 | CAATATGTTTGGAGCACACAGGTTCCATTTAGAGTACTTTCATTAAAACAAAACAGCTTCTATTTAGATGTGAGTTTTGC 76 | TGAAACGACCAAACGAAAAGATATTTTCTTAAAAGAATTAAATGAAATCGATGTTATTGCCGTTGATTGGTTAAAAGGCG 77 | GGGTTCCGCGTTTATTAACAGAGCACGGATATATTACGGCTCATAAAGACTGGGTAAAAAAATCATTTAATGATGATAAA 78 | ACCAATAATATTGAAGAACCTAAGGTAAAAAATAAAGAGAAAAGTAAGGTACTAGAAGTAAATACGACTGTAACCAATAA 79 | CAATAAACAAGCTATTGGTAAGTTAGATAATAATATTGATAAGTCAAATAAAGAGCAGAAGAAACGTAAGCTAGCTAGAA 80 | ATCCTTATGCTTTTTTCAATGATTCTAAAAAACCTATATTAAATAGTCTTAAGCATTTATTTAATGAGAGCCATTCCTTA 81 | GGCAGACTTCTAAGTAGGATTGTTAGAAAAACACTTAACCATGATTAA 82 | >bcs4 83 | ATGAATATTAAAAATATAGCAATTAACTTTTCATCTAAAAAAGATTTTCTAAATAATTTTGGTAAAATTAATAATGAAAA 84 | AACGAGCTTATCCATAATAAATAAAAACGAGATTATTATAAAAGGTAAAAAAAATGATAATTCTCTTAACTTTACTTTAT 85 | TAAAAAATAAAAAATATTTAAAACCTGGGAAGACTTATACTATTTCCTGTGATTTTATTCTTAATAAAAAAATATCTAAA 86 | ACATTACCTTTTGACGTTCCTAAAATTGCTTTTGATTGTACAATTAATGGAAAAAATAACTTTGACTATCAATCTAGCTC 87 | ATCTATTCCTAATGAAGTGGGTGTTTGGCATAAATCTTTGACCGTCAAAGTTCCTAAAAATTGTTCTAATGCATGGTTTA 88 | GAATTTATGTGGGAATAGAAAAAGATGCTGGCGAATTATTAATAAAAAATATTTTTATATCAGAGAATAACTTTGATTTC 89 | ATTTACTTAAATAATCTATTCTATCACAATGAAGATAATGATACTTTTTCTTTATTATCTGATTTCAAAGAAAACTATAT 90 | TGAAAAGTGTAATGATGTATCTTATCTCTTTAGAAATGGACACTACACATTCGTGAACTCAATCATTAAAAATATTAATG 91 | ATAGTGCAATAAGAAAAAAATTTAAGTTATATTTAGTTATGTCAAAAGAAAATGTATCGAATACATTAGCTTACTTTAAC 92 | AATATTAAAAATGAACTTAACGAGCAAGATTCTGTTTTAGCTTCTGACGCAATACATTTTTTTGCTAGAAATTTAGAATG 93 | GGACACAATTAAAGATATAGTAAATTTTTTCGATAAAAAAGGATTGTACCACAACTGCATAGAATATTTATATGAGAAGG 94 | CTCAGCTTTATAGAAGATTAAAAGATAAAGAAAATGAATTAAAATACTATAATCTTGCATTATCCATAGATGAAAATAAA 95 | AATCCAAATATAAATTGGAATCTATTTTTTGATAGTAATAATCCAGGTCTAAGCTATAGAAGAGATGAATTAAAGTTTAT 96 | TCTAGAAAACTTATCAGACATACAGAGAATTGCCGATTCCTATCCTTCTTCTCATATCAACTTTAAAGAATCGCCTGTTT 97 | TTGTCTTTTGGGATCAAGGATATGATAACGCGCCGATCATAGTAAAATCTATGATAGATAGAATGAAAATAATATATGGT 98 | AATAAACTGGTATTTCTTACTGGAGAAACTATAGAGGCTTATATAGATATACCAGCTAGAATAGAAAGTTTCAGAGAATC 99 | TAAAAGAGCCTTTTTCTCAGATTATATTCGTACAGAATTATTATTGAGATATGGTGGTACTTGGATAGATTCAACTGTAT 100 | TCACAACGAATCAATTTTATAAAGAGAATTTAGAAATATTAGAAAAAAATGATAATAATCTATATGTACTAAGAATTCCT 101 | GAAAATCCATACCGAATTTCTAATTGGTTTTTATCAACAAACCAAACTGGAAATAGAATACTGGCTTTAATGTATGCAAC 102 | TATGTTGATTTTTGCTGAAAAAAGAAACAGTCTATTTGAATATTATCAATACCATACCTTTTTTGAAATCTTAACACAGT 103 | TAGATAAACAAGCTAATGAAGACTTTCATAAAAATTATAGAAATAACTATCAACCTTATGCACATGATCTATTAAAAAAC 104 | TTTAGAAATGATTGGGATAGAGAGTTATTTAATAAACTAATTGCTCGCTGTCCAATACAAAAACTGACATATAAATCTAA 105 | TTTATTACACTTAAGAACACATTCTTTATTACACTTAAGAACACATTCTTTTTACAAAACTATTATTAGAAATGCAGCTT 106 | TTTTATAA 107 | -------------------------------------------------------------------------------- /hicap/database/type_c.fasta: -------------------------------------------------------------------------------- 1 | >ccs1 2 | GTGAGAAAACTAAAAAAATTTGTTACGAAACCACACATATTCTTTCGTGACGCATTGAATAATAAATACCCTATTATAAA 3 | TAATGAACAAGGAGTTAGTGAATTAGATGAAAATGCTGTTATTGATCATCAAGAAAAGCTAGAAAAATTAGAAAATTCAT 4 | TAATGAATACATCAATACCCATTGATGTTGTTTTCACTTGGCTTAATAATAAAGATGAAAAATGGCAGGAAAAGAAACAA 5 | CACTATTCAAAACTCGCAAATGACTTTGAGCTTTATGCGAAAGATGAAGCCAGATTTGAGGAACATAATGAGTTATTTTA 6 | CTCAGTTAAAAGTGTGCAGAAATTCTTACCCTGGCTACGATACATTTTTATCGTAACAGATAATCAAATACCAGATTGGC 7 | TTAACAAGGAAGAACAGCAAATTAAAATTATTGATCATCGTGAAATTATTGATGAGAATTATCTTCCTACATTTAATTCT 8 | CATGTAATTGAAGCTAATCTACATAAAATCCCAAACCTGAGTGAGCATTTTATTTATTTTAATGATGATGTATTTGTAGC 9 | TAAACCTTTACAAAAAAGCCATTTTTTCAAACCTAATGGACTAGCCTCTATTTTTCTATCCATCAAAAATCTAGATAAAA 10 | TGTATGCGAAGGGTACAATCACACCAACATTGCTCGCTTCGATGAATTCAAGAAGATTATTGAGAAAACTGTATGGACAA 11 | GAATTAAACGGACAAACACTGCTAATTCATTCCTATGTTCCACTCAAGAAAAGTGTTTTTGAAAAAATATGGAGTGTGTT 12 | TAAAGAAGAGATTGAAAGCTTTTTATCAAATAGATTTAGGAGTAGAAACGATCTTAATCTCGCTACTTTTTTTGTACCTT 13 | ATGCCATGTATTTAGAAGGAAAAAGTGTTCTTACACCTGAAATTTGCTATTACTTTAATATTCGCTCTGCAAATGCTAAG 14 | GTACAGTATAAAAAGTTACTAAAGAAAAAACATTCATCAAATCAACCGCACTCTTTTTGTGCTAATGATTTTAATGGGAA 15 | ACAACATATATCAAATTATAGTGAACAATTAGCAAAAGTTTTAGAATCATATTACAAATAG 16 | >ccs2 17 | ATGAGCAAAATCAATAGAAAACTTAAGAAACTAATGAGGGATCCTAAACTATTTTTTAAGGATATGTACTTAAAGAATTC 18 | ATTTAAACTTAAGAAATACATACCATCATCTCACAAAGGAAATAACAAGTTTACAATAATTTCTGCTATTTATAATACAG 19 | AAAAATATCTTGATGAGTATTTTTCTAGTATTACTACTCAATTATTAAACTTTAAAAATAATATATTTATTATCTGTGTA 20 | GATGATGGTTCAGTAGATGACTCAGCTAAGATTATTAAAAAATGGCAGCGTAAATATCCTAAAAATATCACATATATCTA 21 | TAAAGAAAATGGTGGGCAAGCCTCTGCAAGAAATGTTGGAATTGAGCACGTTCAAACCGAATGGGTTACTTTCATTGACC 22 | CTGATGATTTTGTTAGTAAAAACTATTTTTCTGAAGTCGATAAACAAATATCAGAATCAGAGAATGTTTCACTAATAGCT 23 | TGCCCTCTTGTTTTCTATTTTGAAGATAAAGACATGTTTAAAGATACACATCCCCTTAAATATCGTTTTAACAAAGGGAA 24 | TGTAACTTTACCTATCTCCGATCTAAAAGATAAAATCCAATTATCAGCGAGTACTGCTTTCTTTAAATCTAGCGATATTG 25 | GAAATGTTAGATTTGATGAAAAAATGAAACCAAGCTTCGAAGATGCAAAATTTGTTATAGACTACCTTCTAAGTAATAAA 26 | AATAAATATGCAAGTTTTGTTTCTAATATTAGCTATTATTACAGAAAAAGAGCTGATGGTAGCTCAACTCTAGATGGAGC 27 | TTGGTTCAATACAAATCTGTTTACTAGAGTATTAGAAGAAGGCTGTCTTAAAATACTTAATGATGCAGAAAAAACTTTTG 28 | GCTATATCCCTGAGTATATTCAAAGAACCGCACTATACCATTTATATTGGTACTTTGGTCGTATCATAAATAATGAATCA 29 | AATCTGTCACATTTAACAAATGAAGAAAAAGAAAAGTTTAAATCGCTCGTTTTCGCTATATTTAAAAGAATTGATAATAA 30 | GGTAATCGAAGCATTTAATCTAGGTGGCGCATGGTTCTTCCATAAAGTTGGTTTTTTAGGATTATTTAAGAAATCTGAAC 31 | CTACCAATCAAATTGTTTATATTGAGAAATATGATATTCAGAAAGATCAGATGTTAGTCAGCTTCTTTTCAACATCAGAT 32 | TGCTTTGAAGAATACCTTTTAAATAATAAAGAGTGCTTACCAAAGTATAAAAAACTAATAAATTATCACTTTTTAGACTC 33 | TATATTCACAAAAGAATATCGAGCATGGATACCTTGTAATGAAGGCAGTAAATTACAAGTAAAAATAAATAATAAATTAG 34 | CTAAACTTTCTTTTTTAGGTAAACACCATAATGAATTAAATTGCTCAACTGTGAAGAATTACTTTGTAAAAAACTCTACT 35 | AAAGTAACTCAAGACTGGATTTTTATTGATAGAAATAATCAAGCTGATGATAACGCTGAGCATTTATATTGTTACGTCAT 36 | GAAAAATAATCCATCTCAAAGTATCTATTTTGTTTTGAACCGTGATTCTCACGATTGGGAACGATTAGAAAAAGAAGGAT 37 | TCAACCTTTTAGAGTTTGGTAGCAAAAAATTTGAAGATATTTTACGCAAGTGTGAAAAAATCATTAGTAGCCATATTGAT 38 | GGATACATTACACATTATTTTAAAGATAACTCTTTAATGGATAAAGATTATGTATTTTTACAACATGGTATAACCAAAGA 39 | TGATCTTTCTTCTTGGCTAAACACTAAGAAAAATATGTCTTTATTTGTTACAGCAACACAAGACGAATACAACTCTATTA 40 | GAGGCAATCATTCTGCTTATAAATTTACAGATAAAGAAGTAATTTTAAGTGGCTTCCCTAGACATGACGCATTATTAGCT 41 | AAAAACAAGCATGATTCAAAAACAATCTTAATTATGCCAACTTGGCGTAATAATATTGTAGGTAAAATTTTAGAGGGTAA 42 | TAAACGAGCTTATAACTCTCAATTTATGGAAACTGAATATGCAATTCATTGGCAAGCATTTTTGAAACGTCAAAGTGTAA 43 | AAATGTTATCCCAAAAATACGGATATAAATTCATATTTGCTCCACATCCAAATATGCAAGAGTATCTAAAAGAATTTGAT 44 | ATTCCTGAGTATATTGATATTTGGAAATACTCTGATGGAAATATTCAAAATCTATTTCAAAATGCACTAGTTTTAATTAC 45 | TGATTATTCATCTATTGCATTTGATTTTGCTTATTTAGATAAAAGTGTTATTTACTACCAATTTGATGCAGATGCTGTAT 46 | TTTCAGGTTCGCACACTTATAAAAAAGGTTATTTTTCTTATGAAGAAAATGGCTTTGGAGATGTTGTTAAGAGCTTACCA 47 | GAATTAGAGCTCTCTCTCTCTTATTTATTAATTAATAGCAAAGGAAAACCACATACTAAATATCTCAAGAGAATAAATGA 48 | CACATTTCCTTTTAGAGATGGTAAAAATTGCCAACGTGTATATGAGGCCATCACTAACTTAAATGAGAAAGATTCATCTT 49 | CTTTAAACCTAGACATGTTAATTGAAGATGCGATATCTGTCCAGAATAGTCAAAATTACCTTGGTATAGAAAAGAAATAT 50 | GAAACGCTGTTCAAATATATTAATCAAAGTGATTACTCTCACTTACAACAAACTTATATGAATGCGCTTCTAAAACAAAA 51 | TAAATTAGTTAAATTAAAGCTTTATATTCTTAATAATCATATTGAGAAGAAAGAATTTTGGATTAATTTGGTAGATTTAC 52 | AAATAGGAAATTCATCCAAGGCAGCTATTTACTTTGCAAAACATTTCCCTGAAGAAAAATCAATTCTCTTTTTAGCAATG 53 | CTGCATCTTTCTAGAATGCATCATCCATTAGCAAGAAAAGTGATTACTGAACTTGCCAAAGGTAATGTTTCTGAAACGCA 54 | AAATAGCTTAATTGAGATTGCTAGAAAAGTATTAGAAAATGATGGATTTTATGCATTATCATTAATTAATTCTTTACTAG 55 | AAAGGAAAATGACTCTAGAATATATGTTATACAAAATAGAGTTATTTGCCTCTTATCTATGTATGGACATGTTAAGACTT 56 | CAAGATTCACATAAATATCTTGTTAAATATGAAAAACATACTCGAAATGACCCTGCTTGCCGTGTAGTAATAGCAAGATT 57 | AGCAAAAGTAAATAATAATAAACCGAAATTGATAGATCAGCTCGATAAAACTTTTGGAGAGAACATAGAATTAATTCCAA 58 | AAGACCTTTATTTTGATTATTTATCTGGCATAAAAGATAATAAAAATAAGATAAGTAACTTATTGAACAAATTATCAGAA 59 | AAAGATAGTGCTGAGATATCCTTAACTGAGATTAAAATTAGTGCACTCTTTAAAGAAAATCGATGGAAAGAAATTGTATC 60 | AACCATGAAATATGATGAGAGTTATGCTGAAGAAATAAATGACATGTATATTTACTCATTAATTAAAATTGGAAATTTAG 61 | AACAAGCCATTTTAATTTTCAAAAATCTAGCACCGAAAAAGTGCTATTCTTACTGGAAATGCGCTTCAGAAGTCGCTGAA 62 | AAAAGCAATGATTATAAAACACTTAAAAAGTGCTTAAAAAATCAATTAAAATTAGCCGATTTACTTTCATAG 63 | >ccs3 64 | ATGTTAGAAAATAAATTTACTGCATCTAATGGTGTTGAGATTACATATAAACAAAAGAAAAATAAATTTGATTTTAAACA 65 | TCTAATTTTTGTTTTTTCTGGATTCTTAAATAAAACACCAGGTAATTATGATTTCATTAATGCTATGAGTGATTGCCCGG 66 | CTGAAGTCATCTGGATAAATGATAGCTTCGATAACATGTATACCTATTATCTATGTGTCAATATGGATTTTAAGATTGAA 67 | GAAGCCATCAAAGAATTTATGATGCAAAAAATTCAAGAGCGTAACCTTTCATATTCACAGGTTACGACAACTGGCTACTC 68 | TAAAGGTGGAAGTGCTGCACTTTACTATGGTTTATCCATGGGAATTAAAAATATTGTTACCACTGTTCCACAAATGAAAA 69 | TTGGCAGTTATGTAGCTAATAATTGGAAAGATGTGGCAAGTCATATGATGGGAAAAAATTATCAGAATGCCCACATTAAC 70 | TATTTGGATAAATCAATCGTAAAATTACTAAAACAAGAGAAAGATTTTAATAGAAATATCTACCTCTTAACCTCTGAAGC 71 | AGATATTCAATATAACTCAGAGATAAAACCTTATTTAGAGGATTTTTCTAAATATGACAACTTTAACTTAATAAAATCGT 72 | TTTCTGTGTTTGTAAGAGAGCATAACCAAGTAACTTCTCATCATACGGCGCTATTACTTAGCATTTACTATGCCTTAGCA 73 | TCGGAAGCTGTACCAAGATTTAATCAAGGGGAAGTTAATTTCTTTGGAAGCCAGCCTTGTCCGAAACCGGACTCAAACAG 74 | TAAAGAAACTTTTGTGGATTTAAGAACATTTGGATTAAAAGAGAAGACTATTTTCGTGGAAGGAGTAGCTATTATTAGAG 75 | GTACTCATCTTCAAGAATATTCTGATGTGGATTACCATTTAATATTTACTGAAAAAAATAGTAAGAAAGAATATATTAAA 76 | CCGCTTGCAAAAACACATAAACCGCATTTAACAAGAGAGCTCTTTGATGGTAATTTTGTTGTTTATGACAAGGGGGAGTT 77 | TACAACATATCAATATAAAGGAATTAATATCTCTGATATTCCAAAAGGGGCTTATCAATTAAGTATTAATATAAATACTA 78 | AAAATAATAGTATTAGAGTTCCAATACAAAGCATGAAAAACATTAAAGAAAACATTGAGAACATTCACTTTGAGTGTAGC 79 | AAAACTGAAGCCACTTTAATGATTAAATAA 80 | >ccs4 81 | TTGCAAAGAATTTATTGTGGACTTAAAAAATTCAAGCTACTCGAAAGTACTCTTTACTTAGAGGGGATTGGAATCATTTT 82 | AGGACAAAATGCTAAAGAGTATAGTGATATTAGCTATCAATTAATTATTAAAGATTCAACCAATAGCTATGTAAAGCCCT 83 | TAGCTAAAGCACATCGAACTGAACTAACAACCCAGTACTCTGTAGATAAAAATATTTCTTATGATAAATGTTGGTTTGCT 84 | ACTCCAAATTACGAAGGTGTAGACATTTCTGATATTCCCTTAGGAGATTATGAGCTTTTTCTAAAAATAATAGTAAATGG 85 | TATAGAAAACATTATTAGTTTACAAAGTGGAACTAAAATTAATATTGATAATGACATATTTACTTTTAAAACAAACAACA 86 | CCGGAAATCAATTTAAGATTAAAGGAAAGTTAGAAGGTGATGTAGCTTACTGCAAATATAGTAACGATAAATTTAAAATT 87 | GATGGTTGTTATCAATATGAATATGATAATTTTATTCAAGCACCATCTAACTTAAATAATGTTCATGTTCAATTTTTTGG 88 | CAAAAACAACCGTGTTATCTTGCATAAAAATTCGAATCTGAAAAATACTTTTATTGAATTTAAAGGAAATAACGCCACTA 89 | TTATAATAGGAGAAAAAGCAGGTATTTTTGGTAATTTTCGGTTAGGTTTTGGTTGTAAAATCGAAATAGGAAATGGAACC 90 | ACAAGTACCAATGGTGTTTATATGACTTGTGCAGAAAGTACAAGTATCACTATTGGAAATGACTGTATGTTTGCTACTAA 91 | TAACCAAATTCGAACAGATGATGCCCATGCAATTTATGATGCGAATACCGGTAAGCGTATTAATTTTTCTAAAAATATTG 92 | TAATTGGTAATCATGTTTGGGTTGCATATGGAGCAACTATCTTAGGCGGAAGTAACATTGGTGATGGTTCAGTTATTGGT 93 | GCTTACTCATTACTCAAAAAATCAGTTCCCAATAATTGCATCGCCGCAGGAGTTCCCGCAAAAGTGATTAAAGAAAATAT 94 | TATTTGGGAGTGCCCATTATTGCTGAATGCTGTAGATGAAAATAGCTTTTTAATTGCTAATGGCTACTAA 95 | -------------------------------------------------------------------------------- /hicap/database/type_d.fasta: -------------------------------------------------------------------------------- 1 | >dcs1 2 | ATGAAAATACTTACCGTTTTTGGTACAAGACCAGAGGCAATAAAAATGGCCCCTCTAGTGAATCAACTTAAAGAGCATCC 3 | ACAAATTGTATCTAAAGTCTGTGTAACAGGGCAGCATCGTGAAATGTTAGATCAAGTCCTTTCTCTATTTGAAATCGAAC 4 | CTGACTATGATCTAAACATCATGAGGGAATCTCAAACTCTTCAGAGTGTTACAACAAGTATTATTGAGAAATTAACCCCT 5 | ATTTTAGAAGAATTTCAACCTCACTACATTTTAGTTCACGGAGACACAACCACAACTTTTGCTGCAAGTTTAGCTGCTTT 6 | TTATCAAAAAATTCCTGTCGGTCATGTTGAAGCTGGTTTGCGTACGCAAAATATATATTCACCTTGGCCTGAAGAAGCGA 7 | ATCGTTGTTTAACATCAATGTTAACATCTTTACATTTTGCTCCAACTGAAACTGCAAAACATAATTTAATTGCGGAGAGT 8 | AAAAAACCAGAAGGCATTATTATCACAGGGAATACGGTTATTGATGCGCTTTTAATAGTAACTGAGAAATTAAAAGATCC 9 | TATTTTAAGAAATCAAATGGAAGAATATTTTCCATTTACTAAACATGATAAAAAAATTATTTTAATTACAGCTCATCGTC 10 | GAGAAAATCATGGTGATGGTATTAAGAATATCGGACTTGCGATATTAGAATTGGCGCAGAAATATACTGAATTTGAATTT 11 | GTACTTCCTCTACATCTTAATCCTAACGTAAGAAGACCATTATTAGAAATGCTTTCAGGTATTGAGAACGTCCATCTTAT 12 | TGAGCCACAAGAATATCTACCATTCGTCTATTTAATGTCATGCTCTCATATTATTCTGAGCGATTCAGGTGGCGTACAAG 13 | AAGAAGCACCATCCTTAGGAAAACCAGTGCTAGTCATGCGTGATACAACAGAAAGACCTGAAGCTGTAGCCGCCGGAACT 14 | GTAAAACTTGTAGGTTCAGATACAGATACTATTGTAAAAGAATTTTCTCTATTAATAGATAATCCATATTTATACGAAAA 15 | AATGTCAATGGCTAAAAATCCTTATGGAGACGGTATGGCTTCACATCGTATCGTAGAAACACTTTTAAAAAATAATCTTT 16 | TATAA 17 | >dcs2 18 | ATGAAAAACAAAACAATCTCAGTTATCGGTTTAGGCTATATCGGTTTACCAGCAGCAGCAATGTTTGCTGTGCAAGGTAC 19 | AAAAGTTATCGGTGTAGATGTTAACCAACACGCGGTTGATACTATCAATCAAGGAAAAATTCATATTGTTGAACCTGGCT 20 | TAGGTGAAATTGTTCAAAAAGCAGTAGCCGATGGATTATTAAAAGCCGTTACTAAACCAGAACCTGCTGATGCATTTCTA 21 | ATCGCAGTGCCAACTCCCTTCAAAGGTGATCATGAACCAGATGTAAGCTATATTGAAGCTGTATCAAAAGCATTAGCTCC 22 | TGTTCTCAAAAAAGGAGATACTGTTATTCTAGAATCTACTTCACCCGTCGGTACCACTGAGCAAATGGTTGAATGGCTGT 23 | CAGCTTCACGTCCTGATTTAAAATTCCCACGTGAAAATAGTAATGATGATATTGATGTTTACGTTGCTTATTGTCCTGAG 24 | CGTGTATTACCCGGTCAAGTCATTCGCGAATTAGTGGAAAATGACCGAATTATCGGGGGAATTACTGACGAATGTTCAAA 25 | TAAGGCAATTGATGTTTATAAAATTTTCGTAAAAGGCGATTTAGTAAAAACCAATGCACGTACAGCTGAAATGAGCAAAC 26 | TTACTGAAAATGCTTTCCGTGATGTAAATATCGCCTTTGCTAATGAGCTCTCTTTGATCTCTGAACGCTTAAATATTAAT 27 | GTTTGGGAGTTAATTGCTCTAGCTAACCGCCATCCTCGTGTAAATATTCTTCAACCTGGTTGTGGTGTCGGTGGTCATTG 28 | CATTGCTGTTGATCCATGGTTTATTGTAGATAAAACACCCGATTTAGCAAATATAGTTCGTACTGCACGAGAAGTAAATG 29 | ACAACAAACCTAATTGGGTTATTGAGCAAGTCAAACAAGCTGTAGAAAAAGCAGCAAACCTTGCAAATAAATCAACAAAT 30 | GAAATCAACATTGTTTGTTATGGATTAGCTTTCAAACCAGATATCGATGATTTACGTGAAAGTCCAGCATTAGCGATTAC 31 | TGAGAAATTAATGGATTTATATCCAAATCAAGTAAAAGCGGTTGAACCAAACTATAATTCTGAAGCAAATCATAGTGACA 32 | AAGAACTGACTTTACTAGACTACCAAGAAAGCTTAAAAACTGTAGATGTAGCTGTATTATTAGTTAACCATAAAGAATTT 33 | GTTGAAAATAAACCGCACTTTGGAAACAATGTTGTAATCGTTGATACGAAAGGGATTTGGTAA 34 | >dcs3 35 | ATGAAGATTTTAATTTTTGGTAGCTATGTTACAAGAGATGCTTTTACTTTTGATAAATCAAATGAATTTGAATTAGATCG 36 | ATATTTCGTTAGAACATCTCTAGCAACTGCTTTTAATTCAGAGCCAATAGAAGATAATTATACGATGCAATTAACCTCTG 37 | CATTTCAGAAAAAAATTGTAAATGCTGAGTTAAAAAAAGAATTCAAAGAACTCTTTCTTCTTGGGAAGTATGATTACCTT 38 | GTGATTGATTTTATTGATGACCGATACAACCTGTTTAAATTTAAGAATGGTTGTAAAACTCTTCTTAGTGCTGAATTAAA 39 | AAATACTGATTTCTTAGATAAAAATCAACATAACGGAGAAATAATTTCTGGATTCTCTGAAGAATGGTTTGAAGAGTGGA 40 | AAAAAGGTTGCCTAGAGTTTATTAAACTTGCCAAAGAAAACAATTTATTAAATAAAATCATTCTAAATAAAGTTTATTGG 41 | ACTGCATTTCTAAATCAGAATGAACAATTTTATAATATAGAGCAAGTGAATAAGGCCAATAAGTTCCTAGATAAACAATA 42 | TGACTTTATTGAAAAATTTATTGGAGAAAATAACACTATTATCTATTCCAAATCTTTATTACTTGCTAATAAAAAACATA 43 | TATGGGGATTAAGTCCATTTCATTATGTTGATGAATTATATCTTTCTATGCTCCTACAGCTAAAAGATAGCAACTTTAGA 44 | AAAATAATCAAAAATCAATCCAATAGTAAAAAAATAGAATATATGAAACCAAAAAATCCAAAAACTAAAAATGAACTCGA 45 | CTATATTAGCTCAAAACTAGACGACATTACTGAACTTTCTCATCAGCAATTTTTGTTAATGAAAAAGCTACAAAATCAAG 46 | CTGCAACTCAGAATGAATTATCGGAAAATCTACAAAATAAACTTATAGTTCAAGAAGAAAATATTAAGAATTTATCATCT 47 | CAATTAGAAAACACTAAAAAAGAACTAAATAAAAAGCAAACTGAATTATCTCAAACAAATCAAAAAATTAAACAGGCAAA 48 | AGAACAAGTAGAAAATACCCTTTCTTTCAAGCTTGGGCATACACTTATTTTTTCAACAAAATCATTCAAAAATTTCTTTT 49 | CTTTGCCAAAAGATTTATTTGATCTAGCTTTATTAGCCAAAGAAAGAAAAAATAATAGAGCAAAACCATTATCTAAATCT 50 | TTCTTATCTCCTGTGTCATATCCTAAAATTGATGGCCCATTTAAGAAAAAATATGGATTCAAATTTATTTCTATTCTAGA 51 | TGAGATTTCACATACTTCATTTGAAAGTGAATTTAAATTATTTCCTCTTAATAAAGCAAGTTTTGAAACACAAATCAAGG 52 | GTTCTACATCTTTAGGATTTTTTATTGAAAGCTGTTGGAAAGGGAATTTTGGTGCATGGGAATATGCTTTTACATCACCA 53 | AATCTACAACACCAGAATGCACAAAATCTATTGAAGGCATTAGATATCGCAAAATCAAGAAATTTTCCTATTATCTTCTG 54 | GAACAAAGAAGATCCAATGCACTACGATAAATTCTTACCTATTTCATCAAAATACGACATTATTTTCACAACTGATAGTA 55 | ACAAAGTAAAAGATTATCAACGAGATGTGCCTAATGCAAAAGTAGAACCACTACTCTTTGCCGCCAATATTCATATTTGT 56 | AATCCGGCAAATAGATTTAGAGTGGAACAAGAAAACATCTGTTTTGCAGGATCTTACTATGGTGTAGGCCATGATGATCG 57 | AAAAAAACAAATGGATGAATTACTGCCTACTATTATTAAATTTAAAGGTGCTATTTACGATCGTATGTCCCAAGTTGGCA 58 | GTGACAGATATTCATATCCTAGAAAATACCGTAAATTTATTCGTCCTGCTGTGCCATTTAGAGAAATTGTTAATGTATAT 59 | AGACAATTTAAAATTTTTCTAAATGTGAATACTATCACAGACTCCCCAACAATGATGTCGAGACGTGTTTATGAGCTACT 60 | AGCGTGCGGAACCCCTGTTATTTCGACACCAAGCCTAGCAATTGATGAACAATTTAAAGGGATTGTACAAGTAGCTAAAA 61 | ATGCAAAAGAAGCAAACAAAATTGCTAAAAATTTATTAGAAAATGAATGGGAATGGAGAAAAATTTCTCATTTAGGCTAT 62 | AGAGAAGTGATGTTAAAACACACTTATGAACATCGTGCTATCCAAATTGCACGAGCTCTAGGAGAAAAAGTAAAAGAAGA 63 | AGTCCCACTAGCCAGTATTGTGATTGCATCTAACCGACCTCATTTTATTGACCGAATTGTAAAAAATGTTACAGAACAAG 64 | TTTATCCAAATATTGAGGTTATTGTCATTGCTCAAAAATATACCGAAGCGCAATTCAATGAACTTGAAAAAAAATTAAAA 65 | ACTGGCACTAAAAAATTTAATGCTGTTCATATCATTCGTAATGATAGCGAAGACACTTTAGGCACTCGCTTAAATCAAGG 66 | TATCGCTTTATCAAAAGGTGAGTATGTTGCTAAATTTGATGATGATGATTTTTATTTCCCTAACTATCTTCAAGATGCAT 67 | TAATTCCATTTAAGTTTGGAGATTATGGTATTGTTGGGAAAAAAGAAATTTTCATTTATCTTGAAAAACAAAATAAAACA 68 | TTTGTTAGATATAAAGGTGAATACCACAAAGAAACAAATTTCTTAACTGGTGCAACTTTAGTTTTCTCAAGAACTGCTTT 69 | AGAAAAATTATCATTTGGTAATCTAAATAGAGGTGAAGATTCTAATATATTAGAGCAAGCTAAACAAAATGGAATAAAAA 70 | TGTATGTGGCAGATCCATTTAACTTTGTAGTTTATCGTTCTAAAAATGTTAGTAATCATACATGGCAAGTAGAAGATAAG 71 | TTTTTTACTGAAAAAGGTAGCTTTGTTGGTGAAGGCCTCGCTGAAAAAATTACTAAATTATAA 72 | >dcs4 73 | ATGAAAAACAATGTAACTAATTTTCTTTATATAAAAAGACCAATAATTGAAGGCAATAAGGTATTATTTGACTGGAATAT 74 | TGATTATGATAACGACATATCACCTAATAGTATTTATATTGATTATTATGATTTAGACATTTCTGAAGTTCCATTACAGG 75 | TACATTATAATACTATTATTGGATTGTTACTAAATAAATTAAGAAATAGTCAAATAGATACTATTGTGGTTACTGAAGAT 76 | TGTATTTCACAAGAAATAGTTAAATTTTGGCTATCTTATCATAGTTTAAGCAACGTTTATTTTGCTAATATCGGAGATAT 77 | TTCACTTGGGAAATCTTATTATTCAACTAAGCCAGGTAGTGTTGGAATTCTATACGGTGGTGGAAAAGATTCATACTATA 78 | CGTTAGATATACTAAGCCGAAATAATTATATAAAACAGGTAAACATTATCTCTTTTGTTATACCTGACAGTCATGTCAAT 79 | GTAAAACAGCTTGAAGAAAGAAGAGATAATCTTATCCTAAAACCTATTTCTGATAAATATGATATTAATATCATTAAAAT 80 | TAAAACTGATGCTCGTGTAGTAATTAAAGGCTATCACTTAGAACTTTATTTCGCGCCTTTAGGTGTATTAGCTTGGTTGA 81 | ATAAATTTGAATTTGTGACTTTTAGTTATGAGTATTGCCATTATTTTACTCATATTGAAAAGCAAGCAACTTTTGGATTT 82 | GAACGCTCTCAAATATCTTATCTGAAAGCATTAAGTAAATTCTACTCTGAATATTTCTCCGAAAATAATTTAACTATTTT 83 | TAATGCTAATCAACATTTATCTGAATTATCTAGTTTCGGTTATTTAGTTAAAACCAATCCTAAATTTTATCAGACGCTAG 84 | TTATGTGCGAAGCTACTGTCGAGAAAGACAAAAAATGGTGTTGCTCTTGTACAAAATGTGCAGAATTTACTCTTTTCTCT 85 | TTATTCTATAATTTAGAACAATCAGATATAGATGTAGATTGGTTCTTTAGCGAATCACCTTGGATAAACAAAATAATTAA 86 | AGAACTAGAAAATCAATCAGAAAAAGGTAAATTCATTAAAGGATTAACATTCACATTGCATTTTGATTCTTTTAAATTTG 87 | TTATAACAAAACTAAAAGATAAAAATATTAGTTTTAAAAACCAGATTGCAAATAAAAACTTTAATATTCTTGCCGAACAC 88 | TATTATGATGATAAAATAAAAAATGAAGATTGCTTTTACTCTGAAATATTTAATCTGGTTTACCCTCAAGAATTAAAAGA 89 | GGGCTCATTACATCTATTGAATAAATATTTACCTATTTCAGAAGCTCCAAAAGAAAAATCATCTGGCATTGGTACGTTGT 90 | ATTTTGATCCATCTATACAACCAAAACTTGGTCTCTTTTCACCTAAAATTGACCCAACTTTTTTCTTTTCTAAAATAACA 91 | AAAGCAAAACAGTATTCTCATTTTACCAGTGATTCTGTTTCTAGTTATATTTCTAGTTATTCTCTTTTAAATCTAGGTAC 92 | GCTCACCACTCAAGACATATCGTTTTCTACAAATCAAAATTATCTTGACATCTGGATTAATAAAGATCCACTAAAGAAAG 93 | ATGATGGATATAAAATAGAATTACACATAAAAGTAAATAAACAATTTACCTATGGTGCATTCAAATTAGAAATTCCATTT 94 | TTTAGAAAAGAGCTCAATCATAGACTTGAATGCTTTCTTAATATAAACAATAGCTTAGATAAGCTCTCTCTTTCTGAAAG 95 | AAGAAATTTAACATGCCACTTTTCTTTAACCGAACAAAATATAAAAAATGGTTTTATTTCTATAATATTGTCAATGAAAG 96 | CGATTAAAGCATTAGAGCCTTGGAAATGGGGAAATGCTTGTAGAATTCGCCTAAGCGAGATCAAACTTTATGCTAACAAA 97 | TTACAATATAACTTAAATTCATCTAAGATTGAGCTAGAATTTAAATAA 98 | >dcs5 99 | ATGAATATTTACCTTGTTTCAGATGAATTAACATACCAATCATTAAGTTGTGAACAGGCGATAAAGTTATCGGTTTCTCC 100 | TTTTTTTTCTTATATTTCATGGAGAAAAAATAAGCCAGCTCTTCTCCTCGTTGAATCAGCTTGGCAAGGTTACCGAAATC 101 | GTTGGAAATACAAAATAGCTTCTTATCCAGATTATCCTAAGAGGACTAATGAAAAATTAGTTCAATTAGTTGAAAAAGCA 102 | AAAGACAAAGGTATTCCAACAGTCTTTTGGAATAAAGAGGATAGTATTCATTTTGATCGCTTTATTGATTCTGCGAAGCA 103 | CTTTGATTATGTGTTTACTGTTGATGAAAATTGCATTCCTAAATATAAAGCAGTGATGGGGGAAAACCCTTCTGTCCATA 104 | CATTAATGTTTGCAGTGCAACCAAAGTTTCATTCTTTTACTGGTTTTAATTTTAAATATCATAAAGCAAACTTTGTAGGT 105 | AGTTACACCCACCATATTCATGATGTTAGACGACAATGGCAAAATAGCTTATTTTCAACTGTGCTAATGAGTGGATTGGG 106 | ATTAGATGTTTTTGATCGAAATTCAGATAGAAAATCGCAAAATTATCGTTATCCGAATTTAGAGGGAATTAATATTCATC 107 | CAGCTTTGAAATATCCTGATACGGCAAAAATCTATAAGGATTACTTAGTTTCTTTGAATATCAACACGGTTACAGATTCA 108 | CCGACAATGTTTTCTCGTAGACTAATCGAAATTCTTGCCTGTGGGGGCATTTCAGTAACCATCCCATCATTAGCTGTTGA 109 | ACGTTTATTCAAGGATTATTGCTACATTGTTCATTCTGAAGAAGAAATGTTAGAACTATTTAATCGCCTAAAATACGGAC 110 | CTAGTGCACTAGATTTAGAACGAGCTAGAGCTGGTGCTGAATATGTAGAAAATAACCATACTTGGTCTCATCGGTTAAAA 111 | CAAATTGCTGATGTTGTAGGCTTGGACTAA 112 | -------------------------------------------------------------------------------- /hicap/database/type_e.fasta: -------------------------------------------------------------------------------- 1 | >ecs1 2 | ATGAAAATACTGACTGTTTTCGGTACACGACCTGAGGCAATAAAAATGGCGCCTTTAGTACATCAACTTAGAGAAAACCC 3 | ACAAATCATATCTAAAGTCTGTGTAACAGGACAACATCGTGAAATGTTAGATCAAGTTCTTTCCCTATTCGAAATTGAAC 4 | CGGACTATGATCTGAATATTATGAAAGAATCTCAAACACTACAGGGAATTACAACGAGTATTATTGAAAAACTAACTCCA 5 | GTTTTAGAAGAATTCAAACCTCACTATATTTTAGTTCACGGAGACACAACTACAACTTTTGCTGCAAGTTTAGCTGCTTT 6 | TTATCAAAAAATTCCTGTCGGTCATGTTGAAGCTGGTTTGCGCACGCAAAATATATATTCACCTTGGCCTGAAGAAGCGA 7 | ATCGTTGTTTAACGTCAATGTTAACATCTTTACATTTTGCTCCAACTGAAACTGCAAAAAAGAATTTAATTGCAGAGAAT 8 | AAAAAGCCAGAAGGCATTATTATTACAGGGAATACGGTTATTGATGCACTTTTAATAGTAACTGAGAAATTAAAAAATCC 9 | TATTTTAAGAACTCAAATGGAAGAATGTTTTCCATTTACTAAATATGATAAAAAAATCATTTTAATTACAGCTCATCGTC 10 | GAGAAAATCATGGTGATGGTATTAAGAATATCGGGCTTGCGATATTAGAATTAGCGCAGAAATATTCTGAATTTGAATTT 11 | GTACTTCCTCTACATCTTAATCCTAACGTAAGAAGACCATTACTAGAAATGCTTTCAAATATTGAGAACGTCCATCTTAT 12 | TGAACCACAAGAATATCTGCCATTCGTCTATTTAATGTCATGTTCTCATATTATTCTAAGTGATTCAGGTGGAGTGCAAG 13 | AAGAGGCTCCATCCTTAGGAAAACCAGTGCTAGTTATGCGTGATACAACAGAAAGACCTGAAGCAGTAGCAGCTGGAACT 14 | GTGAAACTTGTAGGTTCAGATACAGATACTATTGTAAAAGAATTTTCTCTATTAACAGATAATCCATATTTGTACGAAAA 15 | AATGTCAATGGCAAAAAATCCTTATGGAGACGGCATGGCTTCCCATCGTATCGTAGAAACACTTTTAAAAAATAATCTTT 16 | TATAA 17 | >ecs2 18 | ATGAAAAACAAAACAATCTCAGTTATTGGTTTAGGTTACATCGGTTTACCTGCCGCAGCAATGTTCGCCGCACAAGGTAC 19 | TAAAGTTATCGGTGTAGATGTTAACCAACATGCTGTTGATACTATCAATCAAGGAAAAATTCACATTGTTGAACCTGGTT 20 | TAGGTGAAATTGTTCAAAAAGCAGTAGCCGATGGATTATTAAAAGCAGTTACTAAGCCTGAGCAGGCTGATGCATTTCTA 21 | ATCGCAGTGCCAACTCCATTTAAAGGTGATCATGAACCAGATGTAAGCTATATTGAAGCTGTATCAAAAGCATTAGCTCC 22 | TGTTCTCAAAAAAGGAGATACCGTTATTCTAGAATCTACTTCACCGGTCGGTACCACTGAGCAAATGGTTGAATGGCTGT 23 | CAACTTCACGCCCAGATTTAAAATTCCCACATGAAAATAGTAACATCGATGATATTGATGTTTATGTTGCTTATTGCCCT 24 | GAGCGCGTATTACCAGGCCAGGTTATTCGCGAGTTAGTAGAAAATGACCGAATTATCGGTGGTATTACTGACGAATGTTC 25 | AAATAAAGCAATTGATGTTTATAAAATTTTCGTAAAAGGCGATCTAGTGAAAACTAATGCACGTACGGCTGAAATGAGTA 26 | AGCTTACTGAAAATGCTTTTCGTGATGTAAATATCGCCTTTGCGAATGAGCTCTCTTTGATCTCTGAACGCTTAAATATT 27 | AATGTTTGGGAGTTAATTGCTCTAGCTAACCGCCATCCTCGTGTAAATATTCTTCAACCCGGTTGTGGTGTCGGTGGTCA 28 | TTGCATTGCTGTTGATCCATGGTTTATTGTAGATAAAACACCCGATTTAGCAAATATAGTTCGTACTGCACGAGAAGTAA 29 | ATGACAACAAACCTAATTGGGTTATTGAGCAAGTCAAACAAGCTGTAGAAAAAGCAGCAAACCTTACAAATAAATCAACA 30 | AATGAAATCAACATCGTTTGTTATGGATTAGCTTTCAAACCAGATATCGATGATTTACGTGAAAGTCCAGCATTAGCGAT 31 | TACTGAGAAATTAATGAATTTATATCCAAATCAAGTAAAAGCGGTTGAACCAAACTATAATGCAGAAGCAAACCATAGTG 32 | ACAAAAAACTAACTTTACTAGACTACCAAGAAAGCCTAAAAACTGCAGATGTTGCTGTATTATTAGTTAACCATAAAGAA 33 | TTCGTTGAAAACAAACCGCACTTTGGTAACAATGTAGTGGTAGTAGATATGAAAGGGATCTGGTAA 34 | >ecs3 35 | ATGTCTAAAAGAAAAAAAATCAAAAAAAATCAAAAAAAATATCACTCTTATGAAGAAAAAATAGTACCGCAGCAAGAATT 36 | TTTTCAGTTTAATACAAGCTTAACGCTGTTTCACAATACAGCTATTGAACAAGATAAACGAATCCAAAGATTACAAAATA 37 | AAATTGATTTCTTACAGGAAGAAAAGAAAAATTTAACTAAAGCGATCCGTGAATTTGAAGTCGTCCATAGAGAATGGTTA 38 | CAAGAAAAATCTAACTTAACTAGACAGAAAGAACAATTAGAAAAAAAAGCTCTTAGTTATGAGCACTCAATGTCATTTCG 39 | ATTGGGATACGCCCTCATTTTTGGTTTTAAATCATGGACAGGCTTTAAACATTTAATTAAAACACTTTACACACTACCTT 40 | TTGAGAAGAGAACTAAAAAACAACAACGTACAGAAATATCAGTTACACTTCGCAAACCTGATTATTTAACTATTAATTGG 41 | AAAGGTCGCCGTACTATTACTCAATGGACAAGTCTACCTCAAAAAGAGTTTAAGGATTTTATTGAGCTTTTCGCAGTGGA 42 | GCGGCTTGAATTAAGAAACAGAGGGTTCTTTCAAACTATTGCTTGCAAAAATATTGACCAACTTGTCTTATCAATCAACA 43 | TTGATAGTGAAGAAACCCCTAAGCAGACTAAACAAGCACTGGCAGCTATTACATTCTTAGATAAAGATAATAATACACTA 44 | GAATCTAGTATTGAATTACCACAAAGTAAAAAACTGGGGAAATACTATTTCTACCTTAATACAGAGAAAGATCAACAGGA 45 | TAATTTATTTATTATCCCACCTTTAGATTGTGAAAATATAAAATTAGATATTGTTCCTTGGGATATAAAAGGAAAAATAT 46 | CTGTACATAATAAAGTAGGCATATCTCACTATACAAATGGTATTAGTATCATTCTTCCAACATATAAAGGAGTTAATACT 47 | ATTAAGAAATGCTTAGATTCTTTAAATAATCAAGACCTAAGTTATAGCCTATTTGAAATTATTGTTGTGATGAATGGTCC 48 | TAAAGATGGCACAGAAGAGTTATTAAGACAATATAAGTTGGAAAATCCTAATCTTAATTTAAGATATTATTCTTTGAAAG 49 | AAGCTAATGTAAGCAAAGCTCGAAATTTCGCTATTCAGAAAGCCAAATTTTCTTGGACTACATTTATTGATGATGATGAT 50 | TATGTAGACACAAAATTCCTTTCTAGCTTATACAGTAAAGCTATGTATAACACATTAACATTAACTGGTATTGAAGATGT 51 | GTATGGGGAAGAAATTGTTGTAAGTCCAATAACTAAACAACTTGATAAAGCTATTCTAAAAGATGATATCCAATATAATG 52 | ATGTCACTTCAACACTGACTATGAATGCTTGCAAACTTGTACCAACATATATGGTGAAATCTGTAGAATACGATTCAAAT 53 | CTGCGCAGTGGTGAAGATGTGGTATTTTGGAGCGAAGTACTTGCTAAATTTATGCCAAGAGTTAGCTTAGTCCCTGAATA 54 | TCAATATGCAAATTATAAACGCGTTGTTCGGGATAACTCCGTATCTCGCCAAAAAGAATCTTATGATTTTAATGTATTGC 55 | AACGTTTAGAAGTTATCAAAAAACTCTCCGATTTAATTAAAGGAACTTATAATCAATATATTAATCAGTTTATTCAGAGT 56 | AAAATTAAGGCTCAATCCGGCTTTATCACTAGATATCTCAAGAAAAATCCTGATGATTTTTCTAAATGCATACGAGATAT 57 | TCAAAATCTCAAAATAAATAACCATATCATTCGAGATATAAATGCTCTATTTAGTGATACACTTATTATTTCTTATTGCT 58 | TTGCACCATTTATTGATACCTCTGGTGTAGTAATGAGTAAACGAATTAGAGAAATGAATAAGCCTGTTGATATTATTTAT 59 | AACAATATGGATAAGGTAAGGCCTATTGATGAAGAATTAATGCTCATTGCAGATCCTTATCTAGGAGAAACAATAAAATT 60 | AAATAGCCCTCAATCGTTTTCAAACTGGCATTCTATTGAACAATTTGCAACTAATACATTAGTTGAAGTTGCAAAATTGT 61 | TTACTAAAAGACGGGTCTATAAATCAATTTATAGCCGAGCAATGTGGCCAGCCTCTCACTTTGCAGCTGCGATATTAAAA 62 | ATAAAATATCCGCAATTGAAATGGAGTGCAGAATTTTCAGATCCAGTTTTAATGGACGTTTCTGGTAAAGCAAGATTTGA 63 | AGAATTACCTATTGAATGGTTAATTCACCATGGATTTATCTCAGGTAAAACTGAGACATATATTAACAATAATTTATTTT 64 | ATTGGTGTGAAGCACTACCATATTTATATGCAGATGAATTAATCTTCACTAATGAGAACCAATTAGAATATATGCTTTCT 65 | TATGCTGATGAGTCTCATAAAGATATAATAAGAAGTAAAGCTGTGATCTTACCTCAACCAACGCTCCCAAGAAATTTCTA 66 | TGAAATTTCCTGCGCTAAAATTGAGTTAGATAACAACTATACAAACTTAGCATACTTCGGCTCATTCTATGTCAATAGAG 67 | GATTTACGCCTTTTGTTGATGCTTGGAAAGAATTACCAAACCAATTAAGAGAATCATTCAGACTCTATATCTATACTCAA 68 | CAAAATAGAGAGAGCATTCTAGAAACTACACCGAAAGAATTGCATGATTTAATCATTATTCAACCTTATGTTTCTTATTT 69 | TGACTTTCTGCATTTATCGGACCAATTCGATGCACTAGTTGTTATGGACGCAGAAACTGAAGGACTAAAAGTTAATAATC 70 | CTTATTTACCATCTAAAATTAGCGATTATTTAGGTAGTAAATCTGATATAATTGCCCTTATTGAGACAGGGAGTCCGATG 71 | AGTAAAATAAATCACCCTAATTTATTTAAAGTTGAATTAAAAGATAAAGAGAGTATTATATCTATATTACCCAGACTAAA 72 | TAAAAATAAAGGATGA 73 | >ecs4 74 | ATGAAAGAATTAATTTTTTCTGAAGAAAACATACAATCTCTAATAGAAAATAATTTACTTGATATTAATGAACTAGTTGA 75 | GCAATTCCATCGTAGTAACTTGATTAGTCATACTCGCTATGTCTATTCTATGGGCGCTAAAAGCTGGGGTAGCTGGGAAC 76 | GTGTTAGTATAATGATTAACAAATTCTTGAGCGAGAAAGATTGGAAATTTGAACCATCATCTGAAACATTTAATGTCAAC 77 | GTTGCTTATTTTGCACCAAGTATATTCTTAAAATTAAAAGAATATGAAATAATTGATATTATTAACAACTTGAATCAACA 78 | ACAACTTGTATATGTACTCGTAAAAGATGAAATAATGGATTTCTTTATTACATTATTTAAAAATCCTTTATTCATCTTTG 79 | TGTTACGAAGAATAAACCCCATCTTCTTTATAAACTTACTATTAGCACTAACGAAGAAAAACTACGTAAGCATTAAAGAT 80 | GAGATAAATTTAATCTCATTATTTATAAAAGCCAACTCTAAAATTAATTCTACCTATAAGGATATATTGGAGTTTCGTCT 81 | TAACTCTTTAAAAAACAAAGTATCTCAAGGGAAAAACAACAATTCTAAAAATATGCTAATGAAAATTGCCCTGCTTATAT 82 | GTGGACAATTGCGAGGATATGAAGAAGCAATTCCTAGATTTGCCTCTAAATTTAGATTTCTTGGTAGCGTAGATGCATAT 83 | ATTAGCACTTGGGATAATATAGGTTCTACAAGATTTAATGCACAAAATAGCTATCGTATATTTGAAAAAGAGGCTTGTGA 84 | TTTTATTGCTAAAGAACAAGATATTTTTGATTTCTCAAAATTTGATACTGCGATAAATTCATATCTCTCCAATGATACTA 85 | TAGAAACAATAATAAAAGATAATATTTCAAACTATCTTCAATGGTGTAATCTTATCCAATTTAATATAAAAAAATATACT 86 | GAGTACCCATATAACTTGATGTCTAACTCTGAAAAAATGTATTACCATAATGCATATTGGGTAAATACTTTAGGAGAAGA 87 | ATATTTTAAACAATATGATCTTATAATCAAAATAAGACCTGATTATTTTTTCAAAGATAGTACTCCTCTTATTTTAGATA 88 | AAAGATTAAACGAATATAAAACTTTAATTACTGATACATCAAATTATCTATTCTTAGAATGGGGCTTTGGAATGGGAGAT 89 | CAATTATGGATAGGTAAACCAGATTCAATATTGCCTATACTTAAATGTCACAATCATTCAACAATATCATATCAGTTTAC 90 | TAGCAATACTTTAGAGAAGGGAGCTTACCATGGACACATAAACTGCGGATTAGAAGCTTGGGGAAATGCACTATCTCTAT 91 | TAGAAACACCTAGTTCTCTGCAAAAATCTAGATTATCAGGAACTAAACTTATACCTCTTAATGTCTTAAGAGATATGGAT 92 | ATTTATAAATAA 93 | >ecs5 94 | ATGAGCCTATTTATTATTCCTATGGCAGGGTTAAGCTCTCGTTTCTTTAAAGCTGGATATACAAAACCTAAATATCAATT 95 | AATGCTGAAAGATGAAAGTATTTTCTCGTGGTCAGTCCGTTCATTTGAGAAATACTTTGAAACTGATACATTTATTTTCG 96 | TATATAGAGATATTTATAATACTAAAGAATTTATAGAGAAAGAAATTTCTCATTTAGGCATCAAAAACTTTCATCTAGTT 97 | TGCCTTGATAAAGAGACATTGGGACAAGCAGATACTGTTTATCAAGGCTTAAAGCATATAGAAGCTGACGATGAAGTATA 98 | TATTTTCAATATTGATTCAAAAATCATTAATTTTATTAAACCTAAATGGGTTAATTCATGTGATGGTTACTTAGAAGTGT 99 | TTAAAGGTGAAGGAGATCATTGGTCATTCGCACTAGCAGAAGAAAATACCTTGAAAGTAATTAAAACAGCAGAAAAAGAA 100 | AGAATCTCTGATTTTTGTAGCGATGGACTATATTACTTTAGCAAAAAATCTCTATTTGAAAATGCCTTTTTAAAGGCAAA 101 | AGCAAAGAATGAAAAAGTAAAAGAAGAATTTTACATAGCACCTTTATACAATACTTTAATTAGAGAAAATAATACTATCC 102 | TCTATGATCTTATTAATATCGAGAATATTTTATTTTGTGGCACGCCAGAGGAATATCTCGATATATTAGAAAAACAAAAG 103 | TGA 104 | >ecs6 105 | ATGAAAAGATTAATTGTTGATTTAGATAACACTATAACACTAACCCAAGATGGTAATTATGCAAGCGCCTCACCAATTCA 106 | AGATGTTATAGATAAATTAATAGAATATAAAAAAAATGGTTTTGAAATAGTTATTTCTTCTAGCAGAAACATGAGAACTT 107 | TTGAAGGAAACATTGGAAAAATAAATATTTATACACTTCCAACTATTATTCAATGGCTTAATTCCTATAATGTGCCATAT 108 | GATGAAATTTATATTGGTAAACCATGGTGTGGACATGATGGGTTCTATATTGATGATAGAGCAATTAGACCTGATGAGTT 109 | TACTTCATTAACTTATGAAGAAATAAGAAAAATCACAAAAATGGATACCTCAGAATGA 110 | >ecs7 111 | ATGATCATTATTAATTCCGCTGATTATGTTATTCCTGAATTTAGAAATGAGTTTGGTGCTATTCCACCTTCTTTTTTACC 112 | TATCGGGAATAAAAAACTTTTCACATTTCAAGTGAATAATTTAAGAAAAGTATTCAACGAAGAGAGGATATATTTATCTT 113 | TACCAGACAATTTTGAATTAGACAAGAACTCATTAAAACTTATTAGTAGTCTAAACATAATCCCTATATTTATTCCTACA 114 | GGAATATCTTTAGGAATGGCATTGCTGTATGCATTAAATACCATTGACTATAATGATAATGAAGTATTACGTTTACTTCA 115 | CGGCGATACACTACTCAGTGAAATACCGACAAAAGAAAATTGTATTGCCGTAGCAAGAACAAATGATAACTATGAATGGG 116 | AATATCAAAATAATTCTTTCTCTAGATTAGCCTGGTGTGGATATTTTGCATTTTCATCTATTAAAAAATTTATTCGTAGT 117 | TTAGCTAAAACACAAGGGAAATTTACTGAATCAATCCATAAATACTCGTTAGAAATACCTTGTGTATATGAAGAAGTAGA 118 | ACATTGGTATGATTTTGGGCATATTAATACATATTTCCGTTCTCGTTCAGAAATAACTACTCAAAGGGCATTTAATCACT 119 | TAAAAATTGCTAACGGGATTGTTTGGAAGTCAGGGGCTCCATCAATCAAAATAGAGGCTGAAGCAAATTGGTTCGCTTCC 120 | CTACCACCTCATCTAAAAAGATTTACGCCACAGCTATTACAAAGTGGTGAAGTTAATGGACTGGTATTTTATGAAACGGA 121 | ATATTTACCTTATCTTCCATTAAATGAGATTTTTGTTCACGGTTCAAATCCTCCAGAGTTTTGGGAAAAAATTTTCGATT 122 | CAATTTCATTATATATGAACGAATGCAGAACCCCAGATTTTTTAATTAATGAAGATCCAGAGAAAATTACTTTAGATTCT 123 | ATTGGGCTATACAAAAATAAAACGTTTGAAAGATTACACGAATATGCCCAAAAAATTAAATTAGATATTCATAAACAAAC 124 | TATATACGATGGCAAGACATTACCATCTATATATAAAATCGCTGAAGAATGTATAAATAAAACTCTAGAACTCCCTATCA 125 | TTCCATCAATACTTCATGGTGACTTATGTTTTAGTAATATTATGTTCGACTCTAGATGTAATACAATTAAAGTTATTGAT 126 | CCAAGAGGAATTAACCTAAATAAAGAAAAAACGATTTATGGCAACCAGACATATGATTTAGCTAAATTGTGTCACTCTTT 127 | TATTGGGTTATATGATTTTATTATTTCAGATTATTTTGAGCTAGAACATTCTGAATCAAATGGCATTAAAATTAAATTTA 128 | GCATTAGTGAAAGAATAAAACTAATTCAAAATAAATTCATGGAAAAAAATTTGATTCCTAATATCAATAATAAATATATT 129 | TTGCCAGCAACCATTCTTTTGTTCTTATCTATGATACCATTGCATTTTGATAAACCGAAAAGACAAGAAGCTATGCTAGC 130 | AAATGCATTAAGATTATATGTAATGTGGAAAGGACTATAA 131 | >ecs8 132 | ATGAAAATTTACTTAATCAGTGATTCTCTTACAAGCCATTCGTTAAATTTAGAGAATGACACTAAGGTAAGAGAATCATG 133 | GTTTTTATTTAATAAAATTAATAATCCAATATTACTCGTTGAATCAGCTTGGCAAGGCTACCGAAACTGTTGGAAATACA 134 | AAATAGCTTCTTATCCAGATTATCCTAATCGAACTAATGAAAAATTAGTTCGATTAGTTGAAAATGCAAAAGAAAAAGAT 135 | ATTCCAACAGTCTTTTGGAATAAAGAGGATGCTGTTCATTTTGATCGCTTTATTGATTCTGCGAAGCACTTTGATCATGT 136 | GTTTACTGTTGATGAAAATTGCATTCCTAAATATAAAGCAGTGATGGGGGAAAATGCTTCTGTCCATACATTAATGTTTG 137 | CAGTGCAACCAAAGTTTCATTCTTTTACTGGTTTTAATTTTAAATATCATAAAGCAAACTTTGTAGGTAGTTACAGCCAC 138 | CATATTCATGATGTTAGACGACAATGGCAAAATAGCTTATTTTCAACTGCGCTAATAAGTGGATTGGGATTAGCTGTTTT 139 | TGATCGAAATTCAGATAGAAAATCGCAAAATTATCGTTATCCGAATTTAGAGGGAATTAATATTCATCCAGCTTTGAAAT 140 | ATCCTGATACGGCAAAAATCTATAAGGATTACTTAGTTTCTTTAAATGTCAACACTGTTACAGATTCACCGACAATGTTT 141 | TCTCGTAGATTGATAGAAATTCTTGCTTGCGGGGGTATTTCAGTAACCAATCCATCACTAGCCGTAGAACGTTTATTTAA 142 | AGATTATTGCTACACTGTTCACTCTGAAGAAGAAATGTTAGAACTATTTAATCGACTAAAATATGGCCCAAACCCACTAG 143 | ATTTAGAACGAGCAAAAGCCGGTGCGGATTATGTAGCTAATCATCATACTTGGGCTCATCGGTTAAAACAAATTGCTGAT 144 | GTTATAGGATTAGACTAA 145 | -------------------------------------------------------------------------------- /hicap/database/type_f.fasta: -------------------------------------------------------------------------------- 1 | >fcs1 2 | ATGAAAAAACTAAAAAAATTTGTTACGAAGCCACACATATTTTTTCGTGACGCATTGAATAATAAATACCCTATTATAAA 3 | TAATGAACAAGGAATTAAAGAATTAGATGAACGAGCTGTTCTCTCTCATCAAGAAAATCTGGAAAAACTAGAAAGCTCGC 4 | TAATGAATACACCAATACCTATTGATGTCGTTTTCACATGGGTTAATGATAAAGATGAAAAATGGCAGGAAAAGAAACAG 5 | CACTATTCGAAACTAGCAAACAACTATGCATTCTATGCGAAAGATAATGTCAGATTTGAAGAACATAACGAGCTATTTTA 6 | CTCTGTCAAAAGTGTACAAAAATTCTTACCTTGGGTACGGTACATTTTTATCGTAACGGATAATCAAATACCACATTGGC 7 | TTAATAATGAAGATTCCCAAATTAAAATTGTGGATCATCGTGAGATCATTGATCACGATTATCTTCCTACGTTTAATTCA 8 | CATGTTATTGAGGCTAATCTACATAAAATTCCAAACCTAAGTGAACATTTTATTTATTTTAATGATGATGTATTTGTAGC 9 | TAAACCTTTACAAAAAAGCCATTTTTTTAAACCTAATGGGCTAGCCTCTATTTTCCTATCCATTAAAAACTTAGATAAAA 10 | TGTATGCAAAAGGTACAACTACGCCTACATTACTCGCTTCAATGAATTCAAGACGCTTATTACGAAAAATGTATGGACAA 11 | GAATTAAACATACAAACACCACTAATTCACTCCTATATTCCACTCAAGAAAAGTGTTTTTGAAAAAATATGGAGTGTGTT 12 | TAAAGAAGAGATTGAAAGTTTTTTATCAAATAGATTTAGGGGTAAAAACGATCTTAATCTCGCTACTTTTTTTGTACCTT 13 | ATGCCATGTATTTAGAAGGGAAAAGTGTTCTTACGCCTGAAATTTGCTATTACTTTAATATTCGCTCCGCAAATGCTAAG 14 | GCACAGTATAAAAAGTTATTACAAAAAAAAGAGAATGGAAATAGACCACATTCTTTTTGTATTAATGATACTTCTAGTTC 15 | TAATAACCATTTTTATCATAAAAATTTTAACACTTTCATAAATCTATATTTTTAG 16 | >fcs2 17 | ATGAAAACCAATTTCATATTCAGTATAATCATGCCAATTTATAATGTTGACCAATGGTTAGAAGAAGCAATATTAAGTAT 18 | AATAAATCAAAAGAAAATTAATTTTGAAGAAAATGTTCAATTAATTTTAGTTAATGATTGTAGCCCTGATAACAGTGAAG 19 | AAATATGTCTAAAATTTAGAAAAAAATATCCTAATAATATTTTATATTACAAGAATGAGAAGAACCTAGGATTATCTGGA 20 | ACAAGAAATAAAGGATTAACCCTTGCAGAAGGGAAATACATTAATTTCTTTGATCCTGATGATACATTATCTCCATCTGT 21 | ACTTTATGAAGTAAATAAATTTTTTACACAAAATTCTTCTCAAAATTTAGCTCATATATCAATACCTTTAGTATTTTTTG 22 | AGGCTGCTTCTGGATTACATCCTAAATATAGATTACTTGGAAATAAAAACAGAATTATTGATTTAGATAAAGAACAACAT 23 | AACTTTATACTTTCATCTGCAAGTTCATTCTATCCAAGAGATAATATTAAGAAAAATAAATTTGATACCTCATTATTTGG 24 | AGAAGAAGACACCCTATTTAATTTTAATATCTACAGTAATATTAATAAATTTGGCTATGTGTGCGAAAATGGCGTTCAAT 25 | ACAACTATAGAAGAAGACAAGAAGGAGGATCACAAGTAGACCTAAGTAGAGTAAAACCACAAGCTTTTATTACCCCAATC 26 | CAAATATTAGAAAATGTTAATGCAAAAGATCAAGTTTTATTCTATGAACTAATAGCTTACCAGCTTAGATCAAGAATAAA 27 | AAATATAAAACCTGAAATATTCCAGAATAAGAATGATTATAATCATATAATTAATAGATATAGAGATTTTATGTCTCTAA 28 | TTCCTAAAGATTTTATTTTACATAAAACAAAGTATTTAGAAACACAAGAACAAAAAATTGACTTTATTTCAGAAATATAT 29 | AGAAAGAATCTAACAATAGATGAAGATGCTTATATTAACATAGATGATTGTAAAATATTTAAATGCAATGATTTACCATT 30 | GGATATAAAAAATATTAGTATTGAAAAAAATGTTCTTATAATTGAAACATTATTTAATAATTTTAACATCGAAGATCTTA 31 | GCATTGTTATAATGGACAAAGGTAAAAATATTATAAAACCAATTAAAGAATATTATTGCGACAGCCTCTATATTCATAAA 32 | TGCTGTGATATAAAATCAAGTAATAACATATTATATTCTAGATTCGAAATACCAGTATTTAGAAAAGGTGAATATCGACT 33 | TTATTTTAAGAGAAAAAGCAATGGCTTCTTACATATAGTAAATAGACTTAGAACATATAGCGAAAGTCCATTCCTTGGCA 34 | ATGGCGTATTTAATTCAAATTTATTTAAGCTTTATTCTGAACAGAATACTAGTATATCTTTATATAAAAAAGCTTTTTAT 35 | ATAAAAAGCTCTACTGTAATTAATAAAATATCAAATAGGATAAAATCATTATTTTTAATAAGAAAAAGACATAAAACATG 36 | GAAATGGTTAAGATTATTAAAACTTAATAAACCTAAGTACTGGCTATTTAATGACCGACCAATTAATGCTAATGATAATG 37 | CAGAAGCATTCTTTACGTATATTAATAAATCGGTTCCTCATATCGCTAAGAACTCTTATTTTGTTCTAGATAAAAATTCC 38 | CCAGATATAAGTAGAATCAAGAAAATAGGTAAAGTTATCATTCAAAATAGCCTAAAACATAAGTTACTTTATTTAAATTC 39 | TAAGTATATATTTACATCGCATTTAGCAACATCATTTTTTAAACCAATATCATTTAAGCATTTAAAATATTATAATGATT 40 | TGATAGAAACAAAAATTATATGGTTACAGCATGGTATAACTATGAATAACATAGAAATAGCTGCAAATAAATTTAACAAG 41 | CATATTTATAAAATTGTAACGGCAGCAAACTTTGAAAATTCAATATTTAAAAATAAGAATTTCTTTTTTAATAAAGAAGA 42 | CTTATTTAATGTGGGTTTTCCAAGATATGATAAATTAATTAAGAAAAAAGATGAAGATAAGATTGTACTCATTATGCCCA 43 | CATGGAGATCCTATCTAAGTGGAAATATTCTAAAAAATGGATTGCATGCTGAATTAGAAATCTTTAAAGAATCTGACTAC 44 | TATAAAAATTTTGTCGATTTATTATCAAATAAATTACTAATTAATACATTAAAAGAAAATAATGTTATTATTAAATTTGT 45 | TTTACATCCTGGATTTAAACAGTATGCTAAATACTTTAAACAGTTAGAATCAAATGAAATTCTTATTATCGATGAATTAT 46 | CTCTATCTTACAAGGATCTTTTTAATGAAGCATCATTATTAATAACGGATTATTCTAGTGTGTTTTTTGATTTCTCTTAC 47 | AAAGAAAAACCATCTATATTTTTCCAATTTGATGAAGATGAATTCTATTCAAAACACTATAAAAAAGGATTCTTTGACTT 48 | TACTAGCATGGCGCCAGGAAAAGTAACTTATAACACAGATGATTTAATATCTGAAATTATTAAAAGTATAATTTCTAATT 49 | TTTCTATTAAAAATGAATATCTATATAGAATTAGAAATATGTATAAATATAATGATAATAAAAACTGTGAAAGATTATTA 50 | AATGAGGTATTGAAAAATGAATAA 51 | >fcs3 52 | ATGAATAATAAGAGACACATTAGACTAAAAGAATTTTTTCCGGGAATCCATAGAGTTCATACACCATCAGAAAGTTATAT 53 | AAAAAAATCCCCCTTACTACAAAAAAATAGATCTTATTTTCAGAAAGTTGACAATAATGGATTTATGCAATCTCATTTAA 54 | ATATCCAAGAAGATAAAAAAATTTTTTTAGTTGGTGATTCATTCATAGAAAGTATTTTTATCGATGAATCAAAGAGAATA 55 | AACGCAATTATGGAAGAAAGCTTTCTATTTCAAGAAGGAAAAGAAGTAAAAGTATATAATGCTGGAGTATCTGGTTCTAC 56 | AGGGTTAAACTTATTTAACCTTATACTTAATAAAATTATTATTTTAAAGCCTGACGTTATTATATACTCTCAACCTTCCT 57 | GTGATTTTTCTGCTTTACTATATGAAAATGGATATTATAACAATAGTAAATATTTTTCTAATATTATTCCATCAGTAGAA 58 | AGTGATGTTTTTAGATTCAAAACTATTCAAGATAATTTAATTCAGATACAGAATAATATTATTATGCTATCTAAACTATG 59 | TGAGTTATACAGTATCGATCTCTTTATATCAACTTGCTGTTCAAATTCATCTAAACGCCAACTTAAAATGATGAATGATA 60 | TTATTAGAGAGAATTCTTATCTTGGGTATAAGGTTATTGATTTGGACTTGATAGTACCAAAAACAGAGGCCTATTTTTAT 61 | GATAAACAACACTTAAATGAATATGGTAGTAATTTAGTTGCTAATATTTATCTATATAACGTTAGAAATTTTTCAGATGA 62 | CATGCCAAAAAAAACAATACAAAAACATCATATACAAAAAATAAATGGCGTCTTTGAAATAACCTCAAACAACTTAGAAA 63 | AAGAGAGCAACTCTATTTTGTTAAAAATAAAAAACAATGAAAAACAAAATCAAGATTTTGAAATAAAAATAACATATTTC 64 | AATGAAGGAGAAATAATAAAGAATGATGTAAAAAAAATATTATTGTTACCATTGCATAGTATAGAATGCTCATATTTTAT 65 | AGAAGAACTACATCAGACTAAAGTACTTATAGAACCAATTTCTATATCAAAAAATATTGAAATAGAAATCATAAAATATA 66 | CTATTACTTTATTATGTTAG 67 | -------------------------------------------------------------------------------- /hicap/genbank.py: -------------------------------------------------------------------------------- 1 | import Bio.Graphics.GenomeDiagram 2 | import Bio.Seq 3 | import Bio.SeqFeature 4 | import Bio.SeqRecord 5 | 6 | 7 | from . import locus 8 | 9 | 10 | SEQ_PADDING = 1000 11 | 12 | 13 | def create_genbank_record(locus_data, contig_sequences): 14 | # Create base records 15 | position_deltas, gb_records = create_base_records(contig_sequences) 16 | 17 | # Add ORF hits 18 | orf_hits = locus.get_all_orf_hits(locus_data.regions) 19 | for contig, contig_hits in locus.sort_hits_by_contig(orf_hits).items(): 20 | add_region_hit_features(contig_hits, position_deltas, contig, gb_records) 21 | 22 | # Add blast hits 23 | blast_hits = locus.get_all_blast_hits(locus_data) 24 | for contig, contig_hits in locus.sort_hits_by_contig(blast_hits).items(): 25 | add_region_hit_features(contig_hits, position_deltas, contig, gb_records) 26 | 27 | # Add IS1016 hits 28 | for contig, contig_hits in locus.sort_hits_by_contig(locus_data.is_hits).items(): 29 | add_is_hit_features(contig_hits, position_deltas, contig, gb_records) 30 | 31 | # Add nearby ORFs 32 | orf_counter = 0 33 | for contig, orfs in locus.sort_orfs_by_contig(locus_data.nearby_orfs).items(): 34 | orf_counter = add_misc_orf_features(orfs, position_deltas, orf_counter, contig, gb_records) 35 | 36 | # Sort features by location 37 | for contig in gb_records.keys(): 38 | gb_records[contig].features = sorted(gb_records[contig].features, key=lambda f: f.location.start) 39 | return [record for record in gb_records.values()] 40 | 41 | 42 | def create_base_records(contig_sequences): 43 | # For some programs (like EMBOSS seqret) to parse the output correctly, there must be a valid 44 | # entry between '^ORGANISM +\.$'. The 'COMMENT' field works for this purpose 45 | anno = { 46 | 'comment': 'created by hicap', 47 | 'molecule_type': 'DNA', 48 | } 49 | position_deltas = dict() 50 | gb_records = dict() 51 | for contig, (position_delta, sequence) in contig_sequences.items(): 52 | sequence_record = Bio.Seq.Seq(sequence) 53 | gb_records[contig] = Bio.SeqRecord.SeqRecord(seq=sequence_record, name=contig, annotations=anno) 54 | position_deltas[contig] = position_delta 55 | return position_deltas, gb_records 56 | 57 | 58 | def add_region_hit_features(contig_hits, position_deltas, contig, gb_records): 59 | position_delta = position_deltas[contig] 60 | for hit in sorted(contig_hits, key=lambda h: locus.get_hit_start(h)): 61 | # Get appropriate representation of gene name 62 | region = hit.region if hit.region else locus.get_gene_region(hit.sseqid) 63 | qualifiers = {'gene': hit.sseqid, 'note': 'region_%s' % region} 64 | if hit.broken: 65 | qualifiers['note'] += ';fragment' 66 | # Get object with info relating to input query sequence 67 | if getattr(hit, 'orf'): 68 | element = hit.orf 69 | elif getattr(hit, 'seq_section'): 70 | element = hit.seq_section 71 | qualifiers['note'] += ';no_orf' 72 | # Create feature record 73 | start, end = element.start, element.end 74 | feature = create_cds_feature(start, end, position_delta, element.strand, qualifiers) 75 | gb_records[contig].features.append(feature) 76 | 77 | 78 | def add_is_hit_features(contig_hits, position_deltas, contig, gb_records): 79 | position_delta = position_deltas[contig] 80 | for hit in sorted(contig_hits, key=lambda h: locus.get_hit_start(h)): 81 | # Get appropriate representation of gene name 82 | # TODO: maybe change the use of the gene field here 83 | qualifiers = {'gene': 'IS1016', 'note': 'insertion_sequence'} 84 | # Create feature record 85 | start, end = hit.seq_section.start, hit.seq_section.end 86 | feature = create_cds_feature(start, end, position_delta, hit.seq_section.strand, qualifiers) 87 | gb_records[contig].features.append(feature) 88 | 89 | 90 | def add_misc_orf_features(orfs, position_deltas, orf_counter, contig, gb_records): 91 | position_delta = position_deltas[contig] 92 | for orf in sorted(orfs, key=lambda o: o.start): 93 | orf_counter += 1 94 | qualifiers = {'gene': 'orf_%s' % orf_counter, 'note': 'misc_orf'} 95 | # Create feature record 96 | feature = create_cds_feature(orf.start, orf.end, position_delta, orf.strand, qualifiers) 97 | gb_records[contig].features.append(feature) 98 | return orf_counter 99 | 100 | 101 | def add_locus_feature(gb_records): 102 | locus_features = 0 103 | for record in gb_records: 104 | # Skip records with no cap hits 105 | if not any('region' in feature.qualifiers['note'] for feature in record.features): 106 | continue 107 | # Create qualifiers 108 | locus_features += 1 109 | quals = {'note': 'locus_%s' % locus_features} 110 | # Location - only include features that are part of the locus 111 | flocs = (f.location for f in record.features if 'region' in f.qualifiers['note']) 112 | flocs = sorted(flocs, key=lambda l: l.start) 113 | start, end = flocs[0].start, flocs[-1].end 114 | floc = Bio.SeqFeature.FeatureLocation(start=start, end=end) 115 | # Feature 116 | feature = Bio.SeqFeature.SeqFeature(location=floc, type='misc_feature', qualifiers=quals) 117 | record.features.insert(0, feature) 118 | 119 | 120 | def collect_contig_sequences(fasta, locus_data): 121 | # Sort all Orfs and SeqSections by contig 122 | hits = locus.get_all_hits(locus_data) 123 | contig_elements = dict() 124 | for hit in hits: 125 | # Get element 126 | if getattr(hit, 'orf'): 127 | element = hit.orf 128 | elif getattr(hit, 'seq_section'): 129 | element = hit.seq_section 130 | # Add 131 | try: 132 | contig_elements[element.contig].add(element) 133 | except: 134 | contig_elements[element.contig] = {element} 135 | 136 | # Add nearby ORF hits 137 | for orf in locus_data.nearby_orfs: 138 | try: 139 | contig_elements[orf.contig].add(orf) 140 | except: 141 | contig_elements[orf.contig] = {orf} 142 | 143 | contig_sequences = dict() 144 | for contig, elements in contig_elements.items(): 145 | # Get the most left and most right element associated with a hit 146 | elements_sorted = sorted(elements, key=lambda e: e.start) 147 | element_start = None 148 | element_end = None 149 | for element in elements_sorted: 150 | if element in locus_data.nearby_orfs: 151 | continue 152 | element_end = element 153 | if not element_start: 154 | element_start = element 155 | 156 | # Apply sequencing padding - extend if we do not extend beyond nearby orfs 157 | start = element_start.start - SEQ_PADDING 158 | if start > elements_sorted[0].start: 159 | start = elements_sorted[0].start - 16 160 | start = max(start, 0) 161 | end = element_end.end + SEQ_PADDING 162 | if end < elements_sorted[-1].end: 163 | end = elements_sorted[-1].end + 16 164 | end = min(end, len(fasta[contig])) 165 | contig_sequences[contig] = (start, fasta[contig][start:end]) 166 | return contig_sequences 167 | 168 | 169 | def create_cds_feature(start, end, delta, strand, qualifiers): 170 | feature_start = start - delta if (start - delta) > 1 else 1 171 | feature_end = end - delta 172 | feature_loc = Bio.SeqFeature.FeatureLocation(start=feature_start-1, end=feature_end, strand=strand) 173 | return Bio.SeqFeature.SeqFeature(location=feature_loc, type='CDS', qualifiers=qualifiers) 174 | -------------------------------------------------------------------------------- /hicap/graphic.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import logging 3 | import re 4 | import tempfile 5 | import xml.etree.ElementTree as ET 6 | 7 | 8 | import Bio.Graphics.GenomeDiagram 9 | import Bio.SeqFeature 10 | import reportlab.lib.colors 11 | 12 | 13 | COLOURS_COMPLETE = { 14 | 'one': '#7bcebe', 15 | 'two': '#f9958b', 16 | 'three': '#ffe589', 17 | 'none': '#d3d3d3' 18 | } 19 | COLOURS_BLAST = { 20 | 'one': '#b0e6db', 21 | 'two': '#ffcbbf', 22 | 'three': '#ffeea7' 23 | } 24 | COLOURS_BROKEN = { 25 | 'one': '#8fa8a3', 26 | 'two': '#d3a7a2', 27 | 'three': '#d8ceab' 28 | } 29 | 30 | LABEL_SIZE = 12 31 | TRACK_LABEL_SIZE = 18 32 | 33 | # Groups show in brackets 34 | # '(90) 56.775, (1709.957) 56.775, 1709.957 93.225, 90 93.225' 35 | HPOINTS_RE = re.compile(r'^([0-9.]+)[^,]+, ([0-9.]+).+$') 36 | 37 | # '90 56.775, 1709.957 56.775, 1709.957 93.225, 90 (93.225)' 38 | VPOINTS_RE = re.compile(r'^.+ ([0-9.]+)$') 39 | 40 | # 'M (1709.957101),56.775000 L (1709.957101),93.225000 Z' 41 | PATH_RE = re.compile(r'^M ([0-9.]+).+?L ([0-9.]+).+Z$') 42 | 43 | # Matches only inner brackets - outer are literal 44 | # ' matrix((1.000000),0.000000,-0.000000,1.000000,(132.856235),(93.225000))' 45 | LABEL_RE = re.compile(r'^ matrix\(([-10.]+).+? ?([0-9.]+), ?([0-9.]+)\)') 46 | 47 | # Matches all instances of: 48 | # '(172.493076 69.532500),' or '(172.493076 62.242500)$' (endline is not literal) 49 | # in a points array for an arrow 50 | SA_PATH_RE = re.compile(r'([0-9.]+ [0-9.]+)(?:,|$)') 51 | 52 | 53 | TRANSFORM_TEMPLATE = ' matrix(1.000000, 0.000000, -0.000000, 1.000000, %s, %s)' 54 | 55 | 56 | def prepare_genbank(records): 57 | # Check if we need to rotate any records 58 | for record in records: 59 | last_position = 0 60 | for i, feature in enumerate(record.features): 61 | if feature.location.start - last_position > 5000: 62 | # Must rotate 63 | break 64 | last_position = feature.location.end 65 | else: 66 | # If we don't break, then go to next record 67 | continue 68 | # Apply rotation 69 | rotate_locus(record, i) 70 | 71 | # Order records from longest to shortest 72 | return sorted(records, key=lambda r: len(r.seq), reverse=True) 73 | 74 | 75 | def rotate_locus(record, index): 76 | features_lower = record.features[:index] 77 | features_upper = record.features[index:] 78 | upper_block_size = len(record.seq) - features_upper[0].location.start 79 | 80 | # Rotate features 81 | upper_block_offset = features_upper[0].location.start 82 | for feature in features_upper: 83 | feature.location._start = Bio.SeqFeature.ExactPosition(feature.location.start - upper_block_offset) 84 | feature.location._end = Bio.SeqFeature.ExactPosition(feature.location.end - upper_block_offset) 85 | for feature in features_lower: 86 | feature.location._start = Bio.SeqFeature.ExactPosition(feature.location.start + upper_block_size) 87 | feature.location._end = Bio.SeqFeature.ExactPosition(feature.location.end + upper_block_size) 88 | record.features = sorted(record.features, key=lambda f: f.location.start) 89 | 90 | # Rotate sequence and trim 91 | sequence = record.seq[upper_block_offset:] + record.seq[:upper_block_offset] 92 | record.seq = sequence[:record.features[-1].location.end] 93 | logging.warning('The contig "%s" has been rotated for the graphical output', record.name) 94 | 95 | 96 | def create_graphic(records, prefix): 97 | graphic = Bio.Graphics.GenomeDiagram.Diagram(prefix) 98 | for record in records: 99 | feature_track = graphic.new_track(1, name=record.name, greytrack=True, start=0, end=len(record)) 100 | track_features = feature_track.new_set() 101 | for feature in record.features: 102 | if feature.type != 'CDS': 103 | continue 104 | # TODO: can we clean this up a little? 105 | # Accept quals as list or single item for interop 106 | notes = process_notes(get_qualifier(feature.qualifiers['note'])) 107 | if notes['region'] != 'none': 108 | gene_name = get_qualifier(feature.qualifiers['gene']) 109 | gene_border = reportlab.lib.colors.HexColor(0x000000) # black 110 | sigil = 'BIGARROW' 111 | else: 112 | gene_name = '' 113 | gene_border = reportlab.lib.colors.HexColor(0x808080) # gray 114 | sigil = 'ARROW' 115 | 116 | if notes['fragment']: 117 | # Truncated hit with ORF 118 | gene_colour = COLOURS_BROKEN[notes['region']] 119 | elif notes['no_orf']: 120 | # Blast hit without ORF 121 | gene_colour = COLOURS_BLAST[notes['region']] 122 | gene_border = reportlab.lib.colors.HexColor(0x00000000, hasAlpha=True) # remove gene border 123 | elif notes['is']: 124 | # IS hit 125 | gene_colour = reportlab.lib.colors.HexColor(0x7aa7cc) # dark(ish) pastel blue 126 | gene_border = reportlab.lib.colors.HexColor(0x000000) # black 127 | else: 128 | # Complete hit with ORF 129 | gene_colour = COLOURS_COMPLETE[notes['region']] 130 | label_position = 'start' if feature.strand == 1 else 'end' 131 | 132 | track_features.add_feature(feature, sigil=sigil, label=True, name=gene_name, 133 | border=gene_border, label_position=label_position, 134 | label_angle=0, label_size=LABEL_SIZE, color=gene_colour) 135 | 136 | # TODO: Scale width with size 137 | # TODO: add contig boundaries symbols 138 | height = len(records) * 150 139 | end = max(len(record) for record in records) 140 | graphic.draw(format='linear', pagesize=(1800, height), fragments=1, track_size=0.30, start=0, end=end) 141 | return graphic 142 | 143 | 144 | def process_notes(note_str): 145 | notes = {'region': 'none', 'fragment': False, 'no_orf': False, 'is': False} 146 | for note_token in note_str.split(';'): 147 | if note_token.startswith('region_'): 148 | notes['region'] = note_token.replace('region_', '') 149 | elif note_token == 'fragment': 150 | notes['fragment'] = True 151 | elif note_token == 'no_orf': 152 | notes['no_orf'] = True 153 | elif note_token == 'insertion_sequence': 154 | notes['is'] = True 155 | return notes 156 | 157 | 158 | def patch_graphic(graphic_data): 159 | # TODO: dodge labels for very short contigs 160 | svg_data = get_svg_data(graphic_data) 161 | svg_tree = ET.fromstring(svg_data) 162 | visual_parent = svg_tree.find('.//{http://www.w3.org/2000/svg}g[@transform=""]') 163 | 164 | # Get track bound sizes - must round to 3 significant digits for backwards compatibility 165 | track_style = 'stroke: rgb(96%,96%,96%); stroke-linecap: butt; stroke-width: 1; fill: rgb(96%,96%,96%);' 166 | track_backgrounds = svg_tree.findall('.//*[@style="%s"]' % track_style) 167 | track_hbounds = set() 168 | for track_background in track_backgrounds: 169 | bounds = HPOINTS_RE.match(track_background.get('points')).groups() 170 | bounds = tuple(round(float(bound), 3) for bound in bounds) 171 | track_hbounds.add(bounds) 172 | 173 | # Send the mid-lines backwards 174 | patch_track_midlines(visual_parent, track_hbounds, svg_tree) 175 | 176 | # Move small arrows to center of track 177 | patch_small_arrow_annotations(svg_tree) 178 | 179 | # Fix reversed, mirrored labels and pad other labels 180 | # Genes on the non-coding strand have their labels upside down which is difficult to read 181 | patch_element_labels(svg_tree) 182 | 183 | # Remove original track labels and add new ones 184 | patch_track_name_labels(visual_parent, track_hbounds, track_backgrounds, svg_tree, graphic_data) 185 | return ET.tostring(svg_tree, encoding='unicode') 186 | 187 | 188 | def patch_track_midlines(visual_parent, track_hbounds, svg_tree): 189 | '''Move the track mid lines to the back (but in front of the gray background''' 190 | # Place them behind the gene symbols but in front track background shading 191 | paths = svg_tree.findall('.//{http://www.w3.org/2000/svg}g[@transform=""]/{http://www.w3.org/2000/svg}path') 192 | line_elements = list() 193 | for path in paths: 194 | # Round to 3 significant digits for backwards compatibility 195 | path_hbounds = tuple(round(float(bound), 3) for bound in PATH_RE.match(path.get('d')).groups()) 196 | if path_hbounds in track_hbounds: 197 | # Remove mid lines and store for later insert at appropriate position 198 | line_elements.append(path) 199 | visual_parent.remove(path) 200 | elif path_hbounds[0] not in {p for hbounds in track_hbounds for p in hbounds}: 201 | # Remove x-axis ticks 202 | visual_parent.remove(path) 203 | 204 | # Insert track midpoint lines immediately after track background elements 205 | for line_element in line_elements: 206 | visual_parent.insert(len(track_hbounds), line_element) 207 | 208 | 209 | def patch_small_arrow_annotations(svg_tree): 210 | '''Vertically center small arrow annotations on the track''' 211 | # Collect all elements to center 212 | element_styles = [ 213 | 'stroke: rgb(0%,0%,0%); stroke-linecap: round; stroke-width: 1; fill: rgb(47%,65%,80%);', 214 | 'stroke: rgb(50%,50%,50%); stroke-linecap: round; stroke-width: 1; fill: rgb(82%,82%,82%);', 215 | ] 216 | elements = list() 217 | for style in element_styles: 218 | elements.extend(svg_tree.findall('.//*[@style="%s"]' % style)) 219 | 220 | for element in elements: 221 | # Get arrow point coordinates 222 | coords_str = SA_PATH_RE.findall(element.get('points')) 223 | coord_gen = (coord.split(' ') for coord in coords_str) 224 | coords = [(float(x), float(y)) for x, y in coord_gen] 225 | # Calculate move distance - half the height of the arrow 226 | # Determine move direction by finding direction of arrow 227 | move_dist = (coords[2][1] - coords[4][1]) / 2 228 | if coords[0][0] > coords[1][0]: 229 | move_dist *= -1 230 | # Apply move distance and build points string 231 | points_strings = list() 232 | for x, y in coords: 233 | points_strings.append('%s %s' % (x, y-move_dist)) 234 | points_string = ', '.join(points_strings) 235 | # Assign new points string 236 | element.attrib['points'] = points_string 237 | 238 | 239 | def patch_element_labels(svg_tree): 240 | '''Mirror and move non-coding strand labels''' 241 | # Set the padding to be equal 242 | texts = svg_tree.findall('.//{http://www.w3.org/2000/svg}g[@transform=""]/{http://www.w3.org/2000/svg}g') 243 | for text in texts: 244 | a, x, y = LABEL_RE.match(text.get('transform')).groups() 245 | if float(a) == -1: 246 | y_adjusted = float(y) - LABEL_SIZE 247 | transform = TRANSFORM_TEMPLATE % (x, y_adjusted) 248 | text.set('transform', transform) 249 | else: 250 | y_adjusted = float(y) + 3 251 | transform = TRANSFORM_TEMPLATE % (x, y_adjusted) 252 | text.set('transform', transform) 253 | 254 | 255 | def patch_track_name_labels(visual_parent, track_hbounds, track_backgrounds, svg_tree, graphic_data): 256 | # Remove original track name label - on short tracks, these don't even appear 257 | name_style = 'font-family: Helvetica; font-size: 8px; fill: rgb(60%,60%,60%);' 258 | names = svg_tree.findall('.//*[@style="%s"]..' % name_style) 259 | for name in names: 260 | visual_parent.remove(name) 261 | 262 | # Add contig names as track labels 263 | contig_names = [track.name for track in graphic_data.tracks.values()] 264 | track_vbounds = [VPOINTS_RE.match(tb.get('points')).group(1) for tb in track_backgrounds] 265 | 266 | # Get the correct position to insert these labels 267 | for insert_index, element in enumerate(visual_parent): 268 | if element.tag == '{http://www.w3.org/2000/svg}g': 269 | break 270 | 271 | # Create new elements and place them into the svg document 272 | text_format = 'font-family: Helvetica; font-size: %spx; fill: rgb(0%%,0%%,0%%);' % TRACK_LABEL_SIZE 273 | text_transform = 'translate(0,0) scale(1,-1)' 274 | text_attribs = {'style': text_format, 'transform': text_transform, 'x': '0', 'y': '0'} 275 | text_element = ET.Element('{http://www.w3.org/2000/svg}text', attrib=text_attribs) 276 | for contig_name, vbound, hbounds in zip(contig_names, track_vbounds, track_hbounds): 277 | x = hbounds[0] 278 | y = float(vbound) + TRACK_LABEL_SIZE 279 | name_group = ET.Element('{http://www.w3.org/2000/svg}g', attrib={'transform': TRANSFORM_TEMPLATE % (x, y)}) 280 | name_text = copy.deepcopy(text_element) 281 | name_text.text = contig_name 282 | name_group.append(name_text) 283 | visual_parent.insert(insert_index, name_group) 284 | 285 | 286 | def get_svg_data(graphic_data): 287 | # Writing to string fails under Python3, must write to disk 288 | with tempfile.TemporaryFile('w+') as fh: 289 | graphic_data.write(fh, 'SVG') 290 | fh.seek(0) 291 | return fh.read() 292 | 293 | 294 | def get_qualifier(qualifier): 295 | return qualifier[0] if isinstance(qualifier, list) else qualifier 296 | -------------------------------------------------------------------------------- /hicap/locus.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import pathlib 3 | import tempfile 4 | 5 | 6 | from . import annotation 7 | from . import database 8 | from . import region_common 9 | from . import region_specific 10 | 11 | 12 | RTWO_FLANK_DIST = 5000 13 | NEARBY_FLANK_DIST = 1000 14 | 15 | 16 | class LocusData: 17 | 18 | def __init__(self): 19 | self.regions = dict() 20 | self.is_hits = None 21 | self.nearby_orfs = None 22 | 23 | 24 | class Region: 25 | 26 | def __init__(self, orf_hits, *, serotypes=None, contigs=None): 27 | self.orf_hits = orf_hits 28 | self.serotypes = serotypes 29 | self.contigs = contigs 30 | self.blast_hits = set() 31 | 32 | if self.contigs and len(self.contigs) <= 1: 33 | hits_sorted = sorted(self.orf_hits, key=lambda h: h.orf.start) 34 | self.start = hits_sorted[0].orf.start 35 | self.end = hits_sorted[-1].orf.end 36 | else: 37 | self.start = None 38 | self.end = None 39 | 40 | 41 | def get_gene_region(gene_name): 42 | '''Determine region a gene belongs to given the gene name''' 43 | for region, region_genes in database.SCHEME.items(): 44 | if gene_name in region_genes: 45 | return region 46 | for serotype, region_two_genes in database.SEROTYPES.items(): 47 | if gene_name in region_two_genes: 48 | return 'two' 49 | else: 50 | raise ValueError('Could not find %s gene in database scheme' % gene_name) 51 | 52 | 53 | def discover_region_clusters(hits_complete, hits_remaining, region, filter_params): 54 | if region in {'one', 'three'}: 55 | return region_common.discover_clusters(hits_complete, hits_remaining, region, filter_params) 56 | else: 57 | return region_specific.discover_clusters(hits_complete, hits_remaining, filter_params) 58 | 59 | 60 | def count_missing_genes(hits, expected_genes): 61 | hit_counts = dict.fromkeys(expected_genes, 0) 62 | for hit in hits: 63 | hit_counts[hit.sseqid] += 1 64 | expected_count = max(hit_counts.values()) 65 | 66 | # In the absence of complete hits, attempt to find nonetheless 67 | if not expected_count: 68 | expected_count = 1 69 | 70 | missing_count = dict() 71 | for hit, count in hit_counts.items(): 72 | missing_count[hit] = expected_count - count 73 | return missing_count 74 | 75 | 76 | def collect_missing_genes(hits, genes_missing): 77 | hits_missing = set() 78 | gene_hits = sort_hits_by_gene(hits) 79 | for gene, count in genes_missing.items(): 80 | if gene not in gene_hits: 81 | continue 82 | hits_sorted = sorted(gene_hits[gene], key=lambda k: (1-k.evalue, k.bitscore), reverse=True) 83 | hits_missing.update(hits_sorted[:count]) 84 | return hits_missing 85 | 86 | 87 | def locate_fragmented_region_two(groups, hits_remaining, filter_params): 88 | # Collect all possible hits for region two 89 | genes_rtwo_all = {gene for genes in database.SEROTYPES.values() for gene in genes} 90 | hits_rtwo_all = {hit for hit in hits_remaining if hit.sseqid in genes_rtwo_all} 91 | hits_rtwo_filtered = database.filter_hits(hits_rtwo_all, **filter_params) 92 | if not hits_rtwo_filtered: 93 | return groups['two'] 94 | 95 | # Hits upstream and downstream of region one and three 96 | hits_candidate = set() 97 | for region in ('one', 'three'): 98 | for contig, contig_hits in sort_hits_by_contig(groups[region].orf_hits).items(): 99 | hits_start, hits_end = get_elements_bounds(contig_hits) 100 | range_start = hits_start - RTWO_FLANK_DIST 101 | range_end = hits_end + RTWO_FLANK_DIST 102 | hits_candidate |= collect_elements_in_bounds(range_start, range_end, contig, hits_rtwo_filtered) 103 | 104 | # Select best hits and set them to broken 105 | hits_remaining -= hits_candidate 106 | group = region_specific.discover_clusters(hits_candidate, hits_remaining, filter_params) 107 | for hit in group.orf_hits: 108 | hit.broken = True 109 | return group 110 | 111 | 112 | def find_proximal_fragments(region_groups, hits_remaining, contig_fasta): 113 | # Get proximal distances 114 | hits = {hit for region_data in region_groups.values() for hit in region_data.orf_hits} 115 | contig_ranges = get_proximal_ranges(hits, contig_fasta) 116 | 117 | # Find hits within the locus ranges 118 | hit_orfs = {hit.orf for hit in hits} 119 | hits_fragmented = set() 120 | for contig, contig_hits in sort_hits_by_contig(hits_remaining).items(): 121 | if contig not in contig_ranges: 122 | continue 123 | for hit in contig_hits: 124 | # Skip hit if ORF is already assigned a hit or is not in any locus range 125 | if hit.orf in hit_orfs: 126 | continue 127 | if not any(hit.orf.start in r or hit.orf.end in r for r in contig_ranges[contig]): 128 | continue 129 | # Apply some sanity filtering here - not exposed to user 130 | if hit.bitscore < 200: 131 | continue 132 | hits_fragmented.add(hit) 133 | 134 | # Group by ORF and select best hit 135 | hits_selected = {'one': set(), 'two': set(), 'three': set()} 136 | for orf, orf_hits in sort_hits_by_orf(hits_fragmented).items(): 137 | [region] = {database.get_region(hit.sseqid) for hit in orf_hits} 138 | if region in {'one', 'three'}: 139 | [hit_best] = region_common.select_best_hits(orf_hits) 140 | else: 141 | orfs_hits = sort_hits_by_orf(hits) 142 | serotype = region_specific.determine_serotype(orf, orf_hits, region_specific.NEIGHBOUR_DIST, orfs_hits) 143 | hit_best = region_specific.perform_selection(orf_hits, serotype) 144 | hits_selected[region].add(hit_best) 145 | 146 | # Update region_group and hit.broken status 147 | for region, hits_fragmented in hits_selected.items(): 148 | contigs_new = {hit.orf.contig for hit in hits_fragmented} 149 | region_groups[region].orf_hits.update(hits_fragmented) 150 | region_groups[region].contigs.update(contigs_new) 151 | hits_remaining -= hits_fragmented 152 | for hit in hits_fragmented: 153 | hit.broken = True 154 | 155 | 156 | def get_proximal_ranges(hits, contig_fastas): 157 | contig_ranges = dict() 158 | for contig, hits in sort_hits_by_contig(hits).items(): 159 | first_hit, *hits_sorted = sorted(hits, key=lambda h: h.orf.start) 160 | start = last_position = first_hit.orf.end 161 | contig_ranges[contig] = list() 162 | for hit in hits_sorted: 163 | if hit.orf.start - last_position > 5000: 164 | # Record 165 | end_bound = last_position + 5000 166 | start_bound = start - 5000 167 | contig_ranges[contig].append(range(start_bound, end_bound)) 168 | # Restart 169 | start = hit.orf.start 170 | # Update 171 | last_position = hit.orf.end 172 | # Catch dangling 173 | end_bound = last_position + 5000 174 | start_bound = start - 5000 175 | contig_ranges[contig].append(range(start_bound, end_bound)) 176 | 177 | # If are hits near a contig boundary, allow fragments to be found near any contig boundary 178 | # TODO: is there a better way to do this without a switch? 179 | allow_near_boundary = False 180 | for contig, ranges in contig_ranges.items(): 181 | contig_start_pad = 2000 182 | contig_end_pad = len(contig_fastas[contig]) - 2000 183 | if any(min(r) <= contig_start_pad or max(r) >= contig_end_pad for r in ranges): 184 | allow_near_boundary = True 185 | break 186 | if allow_near_boundary: 187 | # Blindly add additional ranges, may overlap 188 | for contig in contig_fastas: 189 | if contig not in contig_ranges: 190 | contig_ranges[contig] = list() 191 | right_start = len(contig_fastas[contig]) - 2000 192 | contig_ranges[contig].append(range(0, 2000)) 193 | contig_ranges[contig].append(range(right_start, len(contig_fastas[contig]))) 194 | 195 | return contig_ranges 196 | 197 | 198 | def collect_nearby_orfs(locus_data, orfs_all): 199 | hits_selected = {hit for group in locus_data.regions.values() for hit in group.orf_hits} 200 | orfs_selected = sort_hits_by_orf(hits_selected) 201 | orfs_remaining = set(orfs_all) - set(orfs_selected) 202 | 203 | # If there are no ORFs without hits, make an early exit 204 | if not orfs_remaining: 205 | return set() 206 | 207 | nearby_orfs = set() 208 | for contig, contig_hits in sort_hits_by_contig(hits_selected).items(): 209 | orfs = run_nearby_orf_collection(contig, contig_hits, orfs_remaining) 210 | # Apply some sanity filtering here - not exposed to user 211 | orfs_filtered = set() 212 | for orf in orfs: 213 | if (orf.end - orf.start) <= 200: 214 | continue 215 | orfs_filtered.add(orf) 216 | # Exclude ORFs which fall within IS1016 blast hits 217 | orfs_selected = set() 218 | is_bounds = [range(h.seq_section.start, h.seq_section.end) for h in locus_data.is_hits] 219 | for orf in orfs_filtered: 220 | if any(orf.start in r or orf.end in r for r in is_bounds): 221 | continue 222 | orfs_selected.add(orf) 223 | nearby_orfs |= orfs_selected 224 | return nearby_orfs 225 | 226 | 227 | def run_nearby_orf_collection(contig, contig_hits, orfs_remaining): 228 | hits_start, hits_end = get_elements_bounds(contig_hits) 229 | range_start = hits_start - NEARBY_FLANK_DIST 230 | range_end = hits_end + NEARBY_FLANK_DIST 231 | 232 | # The cap locus can be split and found at either end of a large contig, check for this 233 | if range_end - range_start > 60000: 234 | last_position = 0 235 | contig_hits_sorted = sorted(contig_hits, key=lambda h: h.orf.start) 236 | for i, hit in enumerate(contig_hits_sorted): 237 | if hit.orf.start - last_position > 5000: 238 | break 239 | last_position = hit.orf.end 240 | # Recursing on split elements 241 | orfs_lower = run_nearby_orf_collection(contig, contig_hits_sorted[:i], orfs_remaining) 242 | orfs_upper = run_nearby_orf_collection(contig, contig_hits_sorted[i:], orfs_remaining) 243 | return orfs_lower | orfs_upper 244 | else: 245 | return collect_elements_in_bounds(range_start, range_end, contig, orfs_remaining) 246 | 247 | 248 | def get_elements_bounds(elements): 249 | elements_sorted = sorted(elements, key=lambda k: k.orf.start) 250 | start = min(elements_sorted[0].orf.start, elements_sorted[0].orf.end) 251 | end = max(elements_sorted[-1].orf.start, elements_sorted[-1].orf.end) 252 | return start, end 253 | 254 | 255 | def collect_elements_in_bounds(start, end, contig, elements): 256 | # Apply some lambda madness 257 | test_element = list(elements)[0] 258 | if hasattr(test_element, 'start'): 259 | getter = lambda e: e 260 | elif hasattr(test_element, 'orf'): 261 | getter = lambda e: e.orf 262 | 263 | # TODO: optimise if required 264 | elements_selected = set() 265 | for element in elements: 266 | if getter(element).contig != contig: 267 | continue 268 | element_start = min(getter(element).start, getter(element).end) 269 | element_end = max(getter(element).start, getter(element).end) 270 | if start <= element_start <= end: 271 | elements_selected.add(element) 272 | elif start <= element_end <= end: 273 | elements_selected.add(element) 274 | return elements_selected 275 | 276 | 277 | def blast_missing_genes(region_groups, contig_fastas, database_fps): 278 | # Find missing genes - currently only operating as missing or not 279 | # TODO: uses counts - then select best n hits 280 | missing_genes = set() 281 | for region, region_data in region_groups.items(): 282 | genes = {hit.sseqid for hit in region_data.orf_hits} 283 | if region in {'one', 'three'}: 284 | missing_genes |= genes ^ database.SCHEME[region] 285 | elif region == 'two': 286 | for serotype in region_data.serotypes: 287 | missing_genes |= genes ^ database.SEROTYPES[serotype] 288 | 289 | if not missing_genes: 290 | return 291 | logging.info('Performing homology search for missing genes') 292 | 293 | # Get nucleotide sequence including and around locus 294 | locus_sequences, query_contigs, query_offsets = collect_proximal_locus_sequence(region_groups, contig_fastas) 295 | 296 | # Write out query sequences and run alignment 297 | with tempfile.TemporaryDirectory() as dh: 298 | query_fp = pathlib.Path(dh, 'locus_seq.fasta') 299 | with query_fp.open('w') as fh: 300 | for i, sequence in enumerate(locus_sequences): 301 | print('>%s' % i, sequence, sep='\n', file=fh) 302 | hits_missing = database.run_search(query_fp, database_fps) 303 | 304 | # Filter for missing genes and apply some sanity filtering here - not exposed to user 305 | hits_filtered = {hit for hit in hits_missing if hit.sseqid in missing_genes} 306 | hits_filtered = {hit for hit in hits_filtered if hit.bitscore >= 200} 307 | 308 | # Create and add annotation.SeqSection to each blast hit 309 | for hit in hits_filtered: 310 | hit.seq_section = create_seq_section(hit, query_offsets, query_contigs) 311 | 312 | # Ensure there are no overlaps - select if there are 313 | # TODO: allow small amount of overlap with ORFs 314 | hits_selected = set() 315 | hits = get_all_orf_hits(region_groups) 316 | orfs = {hit.orf for hit in hits} 317 | orf_ranges = [range(orf.start, orf.end) for orf in orfs] 318 | for hit in hits_filtered: 319 | if any(hit.seq_section.start in r or hit.seq_section.end in r for r in orf_ranges): 320 | continue 321 | hits_selected.add(hit) 322 | 323 | # Add hits to region group 324 | for hit in hits_selected: 325 | region = database.get_region(hit.sseqid) 326 | region_groups[region].blast_hits.add(hit) 327 | 328 | 329 | def collect_proximal_locus_sequence(region_groups, contig_fastas): 330 | hits = get_all_orf_hits(region_groups) 331 | locus_ranges = get_proximal_ranges(hits, contig_fastas) 332 | locus_sequences = list() 333 | query_offsets = list() 334 | query_contigs = list() 335 | for contig, locus_ranges in locus_ranges.items(): 336 | for locus_range in locus_ranges: 337 | start = locus_range.start if locus_range.start > 0 else 0 338 | sequence = contig_fastas[contig][start:locus_range.stop] 339 | locus_sequences.append(sequence) 340 | query_offsets.append(start) 341 | query_contigs.append(contig) 342 | return locus_sequences, query_contigs, query_offsets 343 | 344 | 345 | def create_seq_section(hit, query_offsets, query_contigs): 346 | query_index = int(hit.qseqid) 347 | contig = query_contigs[query_index] 348 | start = hit.qstart + query_offsets[query_index] 349 | end = hit.qend + query_offsets[query_index] 350 | # Determine strand 351 | strand = -1 if hit.sstart > hit.send else 1 352 | # Ensure start is always lower than end 353 | if start > end: 354 | start, end = end, start 355 | return annotation.SeqSection(contig, start, end, strand) 356 | 357 | 358 | def discover_is1016(region_groups, contig_fastas, database_fp): 359 | # Get nucleotide sequence including and around locus 360 | locus_sequences, query_contigs, query_offsets = collect_proximal_locus_sequence(region_groups, contig_fastas) 361 | 362 | # Write out query sequences and run search 363 | with tempfile.TemporaryDirectory() as dh: 364 | query_fp = pathlib.Path(dh, 'locus_seq.fasta') 365 | with query_fp.open('w') as fh: 366 | for i, sequence in enumerate(locus_sequences): 367 | print('>%s' % i, sequence, sep='\n', file=fh) 368 | hits = database.run_search(query_fp, database_fp) 369 | 370 | # Apply some sanity filtering here - not exposed to user 371 | hits_filtered = set() 372 | for hit in hits: 373 | if hit.bitscore < 200: 374 | continue 375 | if hit.length < 200: 376 | continue 377 | if hit.evalue > 0.5: 378 | continue 379 | if hit.pident < 60: 380 | continue 381 | hits_filtered.add(hit) 382 | 383 | # TODO: set threshold to define a hit has truncated/ broken 384 | # TODO: rather than selecting proximal regions and then BLASTing (eventhough this is reusing 385 | # code), it is simplier to BLAST entire genome and select nearby hits 386 | 387 | # Create and add annotation.SeqSection to each blast hit 388 | hits_contigs = dict() 389 | for hit in hits_filtered: 390 | hit.seq_section = create_seq_section(hit, query_offsets, query_contigs) 391 | if hit.seq_section.contig not in hits_contigs: 392 | hits_contigs[hit.seq_section.contig] = set() 393 | hits_contigs[hit.seq_section.contig].add(hit) 394 | 395 | # Remove duplicates 396 | hits_selected = set() 397 | for hits in hits_contigs.values(): 398 | exclude = set() 399 | hit_list = list(hits) 400 | for i in range(len(hits)-1): 401 | for j in range(i+1, len(hits)): 402 | ss_i = hit_list[i].seq_section 403 | ss_j = hit_list[j].seq_section 404 | if ss_i.start == ss_j.start or ss_i.end == ss_j.end: 405 | exclude.add(hit_list[i]) 406 | hits_selected |= (hits ^ exclude) 407 | 408 | return hits_selected 409 | 410 | 411 | def get_all_hits(locus_data): 412 | hits_all = set() 413 | for region, region_data in locus_data.regions.items(): 414 | hits_all |= region_data.orf_hits | region_data.blast_hits 415 | return hits_all | locus_data.is_hits 416 | 417 | 418 | def get_all_orf_hits(region_groups): 419 | return {hit for region_data in region_groups.values() for hit in region_data.orf_hits} 420 | 421 | 422 | def get_all_blast_hits(locus_data): 423 | return {hit for region in locus_data.regions.values() for hit in region.blast_hits} 424 | 425 | 426 | def sort_hits_by_orf(hits): 427 | orfs_hits = dict() 428 | for hit in hits: 429 | try: 430 | orfs_hits[hit.orf].add(hit) 431 | except KeyError: 432 | orfs_hits[hit.orf] = {hit} 433 | return orfs_hits 434 | 435 | 436 | def sort_hits_by_gene(hits): 437 | gene_hits = dict() 438 | for hit in hits: 439 | try: 440 | gene_hits[hit.sseqid].add(hit) 441 | except KeyError: 442 | gene_hits[hit.sseqid] = {hit} 443 | return gene_hits 444 | 445 | 446 | def sort_hits_by_contig(hits): 447 | contigs_hits = dict() 448 | for hit in hits: 449 | # Get contig 450 | if getattr(hit, 'orf'): 451 | contig = hit.orf.contig 452 | elif getattr(hit, 'seq_section'): 453 | contig = hit.seq_section.contig 454 | # Add 455 | try: 456 | contigs_hits[contig].add(hit) 457 | except KeyError: 458 | contigs_hits[contig] = {hit} 459 | return contigs_hits 460 | 461 | 462 | def sort_hits_by_region(hits): 463 | region_hits = {region: list() for region in database.SCHEME} 464 | for hit in hits: 465 | if not hit.region: 466 | hit.region = get_gene_region(hit.sseqid) 467 | region_hits[hit.region].append(hit) 468 | return region_hits 469 | 470 | 471 | def sort_orfs_by_contig(orfs): 472 | contigs_orfs = dict() 473 | for orf in orfs: 474 | try: 475 | contigs_orfs[orf.contig].add(orf) 476 | except KeyError: 477 | contigs_orfs[orf.contig] = {orf} 478 | return contigs_orfs 479 | 480 | 481 | def get_hit_start(hit): 482 | return get_hit_bound(hit, 'start') 483 | 484 | 485 | def get_hit_end(hit): 486 | return get_hit_bound(hit, 'end') 487 | 488 | 489 | def get_hit_bound(hit, bound): 490 | if hit.orf: 491 | return getattr(hit.orf, bound) 492 | elif hit.seq_section: 493 | return getattr(hit.seq_section, bound) 494 | else: 495 | return None 496 | -------------------------------------------------------------------------------- /hicap/main.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sys 3 | 4 | 5 | from . import annotation 6 | from . import arguments 7 | from . import database 8 | from . import locus 9 | from . import report 10 | from . import utility 11 | 12 | 13 | def main(): 14 | # Init 15 | args = arguments.get_args() 16 | utility.initialise_logging(args.log_level, args.log_fp) 17 | utility.check_dependencies() 18 | arguments.check_args(args) 19 | 20 | # Check FASTA input contig names aren't too long for the genbank format 21 | if any(len(desc) > 20 for desc in utility.read_fasta(args.query_fp)): 22 | msg = ('One or more contig names exceed the genbank spec limit of 20 characters.' 23 | ' These will be truncated in the genbank output file') 24 | logging.warning(msg) 25 | 26 | # Collect ORFs from input assembly then align ORFs to database and assign ORFs to hits 27 | orfs_all = annotation.collect_orfs(args.query_fp, args.model_fp) 28 | logging.info('Searching for ORF hits in database') 29 | hits = database.search(orfs_all, args.gene_database_fps, args.threads) 30 | hits = database.assign_hit_orfs(hits, orfs_all) 31 | 32 | # Find complete hits 33 | logging.info('Finding complete ORF hits') 34 | hits_complete = database.filter_hits(hits, coverage_min=args.gene_coverage, identity_min=args.gene_identity) 35 | hits_remaining = hits - hits_complete 36 | if not hits_complete: 37 | logging.info('No hits to any cap locus gene found, exiting') 38 | sys.exit(0) 39 | 40 | # Selected best complete hits and search for hits of broken/ truncated genes 41 | locus_data = locus.LocusData() 42 | all_region_hits = locus.sort_hits_by_region(hits_complete) 43 | filter_params = {'identity_min': args.broken_gene_identity, 'length_min': args.broken_gene_length} 44 | logging.info('Finding truncated ORFs') 45 | for region, region_hits in all_region_hits.items(): 46 | region_data = locus.discover_region_clusters(region_hits, hits_remaining, region, filter_params) 47 | locus_data.regions[region] = region_data 48 | 49 | # If no completed hits were found for region two, attempt to find fragmented ORFs 50 | if not locus_data.regions['two'].orf_hits: 51 | logging.info('No complete region two ORFs found, searching for truncated ORFs') 52 | region_data = locus.locate_fragmented_region_two(locus_data.regions, hits_remaining, filter_params) 53 | locus_data.regions['two'] = region_data 54 | 55 | # For any gene, attempt to find fragments proximal to previously discovered ORFs 56 | logging.info('Searching for ORF fragments') 57 | contig_fastas = utility.read_fasta(args.query_fp) 58 | locus.find_proximal_fragments(locus_data.regions, hits_remaining, contig_fastas) 59 | 60 | # For any genes which are missing, attempt to find via basic BLAST 61 | locus.blast_missing_genes(locus_data.regions, contig_fastas, args.gene_database_fps) 62 | 63 | # Collect ORFs not apart of the Hi cap loci in surrounding areas and search for IS1016 64 | logging.info('Searching for IS1016 sequences') 65 | locus_data.is_hits = locus.discover_is1016(locus_data.regions, contig_fastas, args.is_database_fp) 66 | logging.info('Collecting ORFs proximal to capsule locus') 67 | locus_data.nearby_orfs = locus.collect_nearby_orfs(locus_data, orfs_all) 68 | 69 | # Generate output data and files 70 | logging.info('Writing outputs') 71 | report.write_outputs(locus_data, args) 72 | -------------------------------------------------------------------------------- /hicap/model/prodigal_hi.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scwatts/hicap/8b7f1385ec5ff167b6498e136ceacd0f04f34af1/hicap/model/prodigal_hi.bin -------------------------------------------------------------------------------- /hicap/region_common.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | 4 | from . import database 5 | from . import locus 6 | 7 | 8 | def discover_clusters(hits_complete, hits_remaining, region, filter_params): 9 | hits_selected = select_best_hits(hits_complete) 10 | genes_missing = locus.count_missing_genes(hits_selected, database.SCHEME[region]) 11 | hits_filtered = database.filter_hits(hits_remaining, **filter_params) 12 | hits_missing = locus.collect_missing_genes(hits_filtered, genes_missing) 13 | # Select best hits for each discovered missing ORF 14 | if hits_missing: 15 | logging.info('Collecting missing region %s genes', region) 16 | hits_broken = select_best_hits(hits_missing) 17 | for hit in hits_broken: 18 | hit.broken = True 19 | hits_selected |= hits_broken 20 | 21 | # Create and return locus.Region 22 | hits_remaining -= hits_selected 23 | contigs = {hit.orf.contig for hit in hits_selected} 24 | return locus.Region(hits_selected, contigs=contigs) 25 | 26 | 27 | def select_best_hits(hits): 28 | '''Retaining hits which are a part of region one and three''' 29 | hits_selected = set() 30 | for orf_hits in locus.sort_hits_by_orf(hits).values(): 31 | best_hit = max(orf_hits, key=lambda h: (h.evalue, h.bitscore)) 32 | hits_selected.add(best_hit) 33 | return hits_selected 34 | -------------------------------------------------------------------------------- /hicap/region_specific.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | 4 | from . import database 5 | from . import locus 6 | 7 | 8 | NEIGHBOUR_DIST = 5000 9 | 10 | 11 | def discover_clusters(hits_complete, hits_remaining, filter_params): 12 | # Find best hits, determine missing genes, find missing genes, and select best 13 | logging.info('Predicting serotype') 14 | hits_selected, serotypes = select_best_genes(hits_complete, NEIGHBOUR_DIST) 15 | genes_missing = dict() 16 | for serotype in serotypes: 17 | hits_serotype = {hit for hit in hits_selected if hit.sseqid in database.SEROTYPES[serotype]} 18 | missing_serotype_genes = locus.count_missing_genes(hits_serotype, database.SEROTYPES[serotype]) 19 | genes_missing.update(missing_serotype_genes) 20 | hits_filtered = database.filter_hits(hits_remaining, **filter_params) 21 | hits_missing = locus.collect_missing_genes(hits_filtered, genes_missing) 22 | if hits_missing: 23 | logging.info('Collecting missing region two genes') 24 | for hit in hits_missing: 25 | hit.broken = True 26 | hits_candidate = hits_selected | hits_missing 27 | hits_selected, serotypes = select_best_genes(hits_candidate, NEIGHBOUR_DIST) 28 | 29 | # Create and return locus.Region 30 | hits_remaining -= hits_selected 31 | contigs = {hit.orf.contig for hit in hits_selected} 32 | return locus.Region(hits_selected, serotypes=serotypes, contigs=contigs) 33 | 34 | 35 | def select_best_genes(hits, distance): 36 | hits_selected = set() 37 | serotypes = set() 38 | orfs_hits = locus.sort_hits_by_orf(hits) 39 | for orf, orf_hits in orfs_hits.items(): 40 | # Determine serotype current orf belongs to 41 | serotype = determine_serotype(orf, orf_hits, distance, orfs_hits) 42 | serotypes.add(serotype) 43 | 44 | # Get the best hit 45 | hit_best = perform_selection(orf_hits, serotype) 46 | hits_selected.add(hit_best) 47 | return hits_selected, serotypes 48 | 49 | 50 | def perform_selection(hits, serotype): 51 | # Keep singular hit 52 | if len(hits) <= 1: 53 | return list(hits)[0] 54 | # Select the orfs first hit of the serotype 55 | hits_sorted = sorted(hits, key=lambda h: h.evalue) 56 | for hit in hits_sorted: 57 | if hit.sseqid in database.SEROTYPES[serotype]: 58 | return hit 59 | else: 60 | # Retain the best hit when no hits of serotype found 61 | return list(hits_sorted)[0] 62 | 63 | 64 | def collect_neighbourhood_hits(start, end, contig, orfs_hits): 65 | orfs_neighbouring = list() 66 | for orf, orf_hits in orfs_hits.items(): 67 | if contig != orf.contig: 68 | continue 69 | if orf.start < start: 70 | continue 71 | if orf.end > end: 72 | continue 73 | orfs_neighbouring.append(orf_hits) 74 | return orfs_neighbouring 75 | 76 | 77 | def determine_serotype(orf, orf_hits, distance, orfs_hits): 78 | # Check if we have unambiguous hits 79 | gene_hits = {orf_hit.sseqid for orf_hit in orf_hits if orf_hit.region == 'two'} 80 | if len(gene_hits) == 1: 81 | return database.get_serotype_group(*gene_hits) 82 | 83 | # Search for any unambiguous hits in the neighbourhood 84 | start = orf.start - distance 85 | end = orf.end + distance 86 | neighbour_orfs_hits = collect_neighbourhood_hits(start, end, orf.contig, orfs_hits) 87 | for neighbour_orf_hits in neighbour_orfs_hits: 88 | neighbour_gene_hits = {orf_hit.sseqid for orf_hit in neighbour_orf_hits if orf_hit.region == 'two'} 89 | if len(neighbour_gene_hits) == 1: 90 | return database.get_serotype_group(*neighbour_gene_hits) 91 | 92 | # See if there are hits anywhere which are unambiguous 93 | all_unambiguous_st = set() 94 | for all_orf_hits in orfs_hits.values(): 95 | all_gene_hits = {orf_hit.sseqid for orf_hit in all_orf_hits if orf_hit.region == 'two'} 96 | if len(all_gene_hits) == 1: 97 | serotype = database.get_serotype_group(*all_gene_hits) 98 | all_unambiguous_st.add(serotype) 99 | # Unambiguous hits must only be present for one of the ORF hits 100 | unambiguous_st = all_unambiguous_st & {database.get_serotype_group(orf.sseqid) for orf in orf_hits} 101 | if len(unambiguous_st) == 1: 102 | return list(unambiguous_st)[0] 103 | 104 | # Make best guess 105 | neighbourhood_hits_all = {hit for hits in neighbour_orfs_hits for hit in hits} 106 | neighbourhood_hits_rtwo = {h for h in neighbourhood_hits_all if h.region == 'two'} | orf_hits 107 | return most_frequent_serotype(neighbourhood_hits_rtwo) 108 | 109 | 110 | def most_frequent_serotype(hits): 111 | counts = {stype: list() for stype in database.SEROTYPES} 112 | for hit in hits: 113 | serotype = database.get_serotype_group(hit.sseqid) 114 | counts[serotype].append(hit) 115 | most_frequent = max(counts, key=lambda k: len(counts[k])) 116 | 117 | # Check for ties 118 | most_frequent_serotypes = {st for st in counts if len(counts[st]) == len(counts[most_frequent])} 119 | if len(most_frequent_serotypes) == 1: 120 | return most_frequent 121 | else: 122 | return break_most_frequent_type_tie(counts, most_frequent_serotypes) 123 | 124 | 125 | def break_most_frequent_type_tie(counts, most_frequent_serotypes): 126 | # Break by highest accumulative bitscore 127 | # This assumes that at least one ORF has n hits (where n is the number of serotypes) 128 | orf_hits = dict() 129 | for serotype in most_frequent_serotypes: 130 | for hit in counts[serotype]: 131 | try: 132 | orf_hits[hit.orf].append(hit) 133 | except KeyError: 134 | orf_hits[hit.orf] = [hit] 135 | serotype_bitscores = {serotype: 0 for serotype in most_frequent_serotypes} 136 | for orf, orf_hits in orf_hits.items(): 137 | if len(orf_hits) <= 1: 138 | continue 139 | best_hit = max(orf_hits, key=lambda k: k.bitscore / k.length) 140 | best_hit_serotype = database.get_serotype_group(best_hit.sseqid) 141 | serotype_bitscores[best_hit_serotype] += best_hit.bitscore / best_hit.length 142 | return max(serotype_bitscores, key=lambda k: serotype_bitscores[k]) 143 | -------------------------------------------------------------------------------- /hicap/report.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | 3 | 4 | import Bio.SeqIO 5 | 6 | 7 | from . import database 8 | from . import genbank 9 | from . import graphic 10 | from . import locus 11 | from . import utility 12 | 13 | 14 | class SummaryData: 15 | 16 | def __init__(self): 17 | self.completeness = dict.fromkeys(database.SCHEME, None) 18 | self.truncated_genes = dict.fromkeys(database.SCHEME, None) 19 | self.hits_without_orfs = dict.fromkeys(database.SCHEME, None) 20 | self.duplicated = None 21 | self.multiple_contigs = None 22 | self.serotypes = None 23 | self.hits_by_contig = None 24 | self.is_hits = None 25 | 26 | 27 | def write_outputs(locus_data, args): 28 | # Report 29 | prefix = pathlib.Path(args.query_fp.stem).stem if args.query_fp.name.endswith('gz') else args.query_fp.stem 30 | output_report_fp = pathlib.Path(args.output_dir, '%s.tsv' % prefix) 31 | fasta = utility.read_fasta(args.query_fp) 32 | summary_data = create_summary(locus_data, fasta) 33 | with output_report_fp.open('w') as fh: 34 | write_summary(summary_data, prefix, fh) 35 | 36 | # Genbank - create 37 | # We allow the user to request the full input sequence to be present in the output. The most 38 | # simple approach is therefore to generate a genbank record set for the image (which will 39 | # always have a substring of the full FASTA sequence) and another genbank record set for the 40 | # genbank output file if required 41 | # Genbank spec requires contig names/ locus names of less than 20 characters but 42 | # we want full contigs names in the graphic. So we'll truncate the names after 43 | # generating the graphic 44 | contig_sequences = genbank.collect_contig_sequences(fasta, locus_data) 45 | genbank_data = genbank.create_genbank_record(locus_data, contig_sequences) 46 | 47 | # Graphic 48 | # TODO: legend? 49 | # Loci on a single contig can be split at either end - rotate for graphic if required 50 | genbank_data = graphic.prepare_genbank(genbank_data) 51 | output_svg_fp = pathlib.Path(args.output_dir, '%s.svg' % prefix) 52 | graphic_data = graphic.create_graphic(genbank_data, prefix) 53 | svg_data = graphic.patch_graphic(graphic_data) 54 | with output_svg_fp.open('w') as fh: 55 | fh.write(svg_data) 56 | 57 | # Genbank - finalise and write 58 | output_gbk_fp = pathlib.Path(args.output_dir, '%s.gbk' % prefix) 59 | # Use full input sequence if requested 60 | if args.full_sequence: 61 | contig_sequences = {contig: (0, fasta[contig]) for contig in fasta} 62 | genbank_data = genbank.create_genbank_record(locus_data, contig_sequences) 63 | # Truncate names for legal genbank format 64 | for record in genbank_data: 65 | record.name = record.name.split()[0][:15] 66 | record.id = record.id.split()[0][:15] 67 | # Add misc_feature for cap locus (or locus fragments) - done in place 68 | genbank.add_locus_feature(genbank_data) 69 | for record in genbank_data: 70 | record.features = sorted(record.features, key=lambda f: f.location.start) 71 | with output_gbk_fp.open('w') as fh: 72 | Bio.SeqIO.write(genbank_data, fh, 'genbank') 73 | 74 | 75 | def create_summary(locus_data, contig_sequences): 76 | summary_data = SummaryData() 77 | for region in ('one', 'two', 'three'): 78 | group = locus_data.regions[region] 79 | # Completeness and truncated genes 80 | genes_found = {hit.sseqid for hit in group.orf_hits} 81 | if region in ('one', 'three'): 82 | genes_expected = database.SCHEME[region] 83 | else: 84 | genes_expected = set() 85 | for serotype in group.serotypes: 86 | genes_expected.update(database.SEROTYPES[serotype]) 87 | genes_missing = genes_expected - genes_found 88 | summary_data.completeness[region] = (genes_missing, len(genes_found), len(genes_expected)) 89 | summary_data.truncated_genes[region] = {hit for hit in group.orf_hits if hit.broken} 90 | summary_data.hits_without_orfs[region] = {hit for hit in group.blast_hits} 91 | # Duplication. Verbose for clarity 92 | if group.orf_hits and is_duplicated(group.orf_hits, contig_sequences): 93 | summary_data.duplicated = True 94 | 95 | # Serotype and count of IS1016 hits 96 | summary_data.serotypes = locus_data.regions['two'].serotypes 97 | summary_data.is_hits = len(locus_data.is_hits) 98 | 99 | # Sort all hits by contig - use manaul sort here rather than generic function 100 | contig_hits = dict() 101 | for region_data in locus_data.regions.values(): 102 | for hit in region_data.orf_hits | region_data.blast_hits: 103 | # Get contig - check which attribute is not None 104 | if getattr(hit, 'orf'): 105 | contig = hit.orf.contig 106 | elif getattr(hit, 'seq_section'): 107 | contig = hit.seq_section.contig 108 | # Add 109 | try: 110 | contig_hits[contig].add(hit) 111 | except: 112 | contig_hits[contig] = {hit} 113 | 114 | # Locus on multiple contigs 115 | if len(contig_hits) > 1: 116 | summary_data.multiple_contigs = True 117 | 118 | # Store hits sorted by contig 119 | summary_data.hits_by_contig = contig_hits 120 | return summary_data 121 | 122 | 123 | def write_summary(data, prefix, fh): 124 | # Header 125 | header = ('isolate', 'predicted_serotype', 'attributes', 'genes_identified', 'locus_location', 126 | 'region_I_genes', 'region_II_genes', 'region_III_genes', 'IS1016_hits') 127 | print('#', end='', file=fh) 128 | print(*header, sep='\t', file=fh) 129 | 130 | # Isolate and predict serotypes 131 | print(prefix, end='\t', file=fh) 132 | print(','.join(data.serotypes), end='\t', file=fh) 133 | 134 | # Locus attributes 135 | attributes = list() 136 | if any(region_complete[0] for region_complete in data.completeness.values()): 137 | attributes.append('missing_genes') 138 | else: 139 | attributes.append('full_gene_complement') 140 | if any(data.truncated_genes.values()): 141 | attributes.append('truncated_genes') 142 | if any(data.hits_without_orfs.values()): 143 | attributes.append('matches_without_orfs') 144 | if data.multiple_contigs: 145 | attributes.append('fragmented_locus') 146 | if data.duplicated: 147 | attributes.append('duplicated') 148 | # missing orfs 149 | print(','.join(attributes), end='\t', file=fh) 150 | 151 | # Genes found and contigs with location 152 | contig_genes = dict() 153 | contig_bounds = dict() 154 | for contig, contig_hits in data.hits_by_contig.items(): 155 | hits_sorted = sorted(contig_hits, key=lambda h: locus.get_hit_start(h)) 156 | contig_genes[contig] = ','.join(get_gene_names(hits_sorted)) 157 | start = locus.get_hit_start(hits_sorted[0]) 158 | end = locus.get_hit_end(hits_sorted[-1]) 159 | contig_bounds[contig] = '%s:%s-%s' % (contig, start, end) 160 | print(*contig_genes.values(), sep=';', end='\t', file=fh) 161 | print(*contig_bounds.values(), sep=';', end='\t', file=fh) 162 | 163 | # Genes missing 164 | missing_genes = dict() 165 | for region, (genes, found, expected) in data.completeness.items(): 166 | text = '%s/%s' % (found, expected) 167 | if genes: 168 | text = '%s (missing: %s)' % (text, ','.join(genes)) 169 | missing_genes[region] = text 170 | print(*missing_genes.values(), sep='\t', end='\t', file=fh) 171 | 172 | # IS1016 hits 173 | print(data.is_hits, file=fh) 174 | 175 | 176 | def get_gene_names(hits): 177 | gene_names = list() 178 | for hit in hits: 179 | if hit.broken: 180 | # Truncated gene 181 | gene_names.append(hit.sseqid + '*') 182 | elif getattr(hit, 'seq_section'): 183 | # Blast hit only - no ORF assocaited 184 | gene_names.append(hit.sseqid + '^') 185 | else: 186 | gene_names.append(hit.sseqid) 187 | 188 | return gene_names 189 | 190 | 191 | def is_duplicated(hits, contig_sequences): 192 | genes_hits = locus.sort_hits_by_gene(hits) 193 | gene_counts = dict.fromkeys(genes_hits) 194 | # Sometimes a single gene is broken into multiple ORFs but wrt to duplication should 195 | # be considered as a single unit. We do this by setting a bound ~ to expected gene len 196 | for gene, gene_hits in genes_hits.items(): 197 | hit_first, *hits_sorted = sorted(gene_hits, key=lambda h: min(h.orf.start, h.orf.end)) 198 | upper_bound = min(hit_first.orf.start, hit_first.orf.end) + hit_first.slen * 1.5 199 | gene_counts[gene] = 1 200 | 201 | # If gene is close to a contig boundary, check nearby other boundaries for fragments 202 | contig_padding = hit_first.slen * 1.5 203 | near_bounds = near_contig_bounds(hit_first, contig_sequences, contig_padding) 204 | 205 | # Check for duplication 206 | for hit in hits_sorted: 207 | if max(hit.orf.start, hit.orf.end) < upper_bound: 208 | continue 209 | if near_bounds and near_contig_bounds(hit, contig_sequences, contig_padding): 210 | continue 211 | gene_counts[gene] += 1 212 | return any(gene_count > 1 for gene_count in gene_counts.values()) 213 | 214 | 215 | def near_contig_bounds(hit, contig_sequences, padding): 216 | # TODO: similar code is used elsewhere, refactor and simplify 217 | contig = hit.orf.contig 218 | contig_start_pad = padding 219 | contig_end_pad = len(contig_sequences[contig]) - padding 220 | return hit.orf.start <= contig_start_pad or hit.orf.end >= contig_end_pad 221 | -------------------------------------------------------------------------------- /hicap/utility.py: -------------------------------------------------------------------------------- 1 | from distutils.version import LooseVersion 2 | import logging 3 | import re 4 | import shutil 5 | import subprocess 6 | import sys 7 | 8 | 9 | import Bio.SeqIO.FastaIO 10 | 11 | 12 | def initialise_logging(log_level, log_file): 13 | log_handles = list() 14 | log_handles.append(logging.StreamHandler()) 15 | # Ensure that parent dir of log file exists, otherwise raise error during check_arguments 16 | if log_file and log_file.parent.exists(): 17 | log_handles.append(logging.FileHandler(log_file, mode='w')) 18 | 19 | log_message_format = '%(asctime)s %(levelname)s: %(message)s' 20 | log_formatter = logging.Formatter(fmt=log_message_format, datefmt='%d/%m/%Y %H:%M:%S') 21 | logger = logging.getLogger() 22 | for log_handle in log_handles: 23 | log_handle.setFormatter(log_formatter) 24 | logger.addHandler(log_handle) 25 | 26 | logger.setLevel(log_level) 27 | 28 | 29 | def check_filepath_exists(filepath, message_format): 30 | if not filepath.exists(): 31 | logging.error(message_format, filepath) 32 | sys.exit(1) 33 | 34 | 35 | def execute_command(command, check=True): 36 | logging.debug('command: %s', command) 37 | result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) 38 | # Manually decoding as subprocess.run decoding replaces \r with \n 39 | result.stdout = result.stdout.decode() 40 | result.stderr = result.stderr.decode() 41 | if check and result.returncode != 0: 42 | logging.critical('Failed to run command: %s', result.args) 43 | logging.critical('stdout: %s', result.stdout) 44 | logging.critical('stderr: %s', result.stderr) 45 | sys.exit(1) 46 | return result 47 | 48 | 49 | def check_dependencies(): 50 | logging.info('Checking dependencies') 51 | dependencies = { 52 | 'blastn': { 53 | 'vcommand': 'blastn -version', 54 | 'vregex': re.compile(r'^blastn: (.+)\n'), 55 | 'vrequired': '2.2.28'}, 56 | 'makeblastdb': { 57 | 'vcommand': 'makeblastdb -version', 58 | 'vregex': re.compile(r'^makeblastdb: (.+)\n'), 59 | 'vrequired': '2.2.28'}, 60 | 'prodigal': { 61 | 'vcommand': 'prodigal -v 2>&1', 62 | 'vregex': re.compile(r'.*Prodigal V(.+?):'), 63 | 'vrequired': '2.6.1'} 64 | } 65 | for dependency, version_data in dependencies.items(): 66 | if not shutil.which(dependency): 67 | logging.critical('Could not find dependency %s' % dependency) 68 | sys.exit(1) 69 | result = execute_command(version_data['vcommand'], check=False) 70 | try: 71 | version = version_data['vregex'].search(result.stdout).group(1) 72 | except AttributeError: 73 | # TODO: should we have an option to skip dependency check? 74 | logging.critical('Unable to determine version for %s' % dependency) 75 | sys.exit(1) 76 | if LooseVersion(version) < LooseVersion(version_data['vrequired']): 77 | msg = '%s version %s or high is required' 78 | logging.critical(msg % (dependency, version_data['vrequired'])) 79 | sys.exit(1) 80 | else: 81 | logging.debug('Found %s version %s' % (dependency, version)) 82 | 83 | 84 | def read_fasta(filepath): 85 | import gzip 86 | 87 | with (gzip.open(filepath, 'rt') if filepath.name.endswith('gz') else open(filepath, 'rt')) as fh: 88 | # TODO: cleaner way to do this? 89 | fasta = {desc: seq for desc, seq in Bio.SeqIO.FastaIO.SimpleFastaParser(fh)} 90 | if not fasta: 91 | logging.error('Could not parse any valid FASTA records from %s', filepath) 92 | sys.exit(1) 93 | return fasta 94 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | from __future__ import print_function # allow us to detect python2 w/o syntax error 3 | import setuptools 4 | import sys 5 | 6 | 7 | import hicap 8 | 9 | 10 | if sys.version_info < (3,5): 11 | msg = 'error: hicap requires Python 3.5+. Python %d.%d detected' 12 | print(msg % sys.version_info[:2]) 13 | sys.exit(1) 14 | 15 | setuptools.setup( 16 | name='hicap', 17 | version=hicap.__version__, 18 | description='in silico typing of H. influenzae cap loci', 19 | author='Stephen Watts', 20 | license='GPLv3', 21 | test_suite='tests', 22 | packages=setuptools.find_packages(), 23 | package_data={'hicap': ['database/*fasta', 'model/prodigal_hi.bin']}, 24 | entry_points={ 25 | 'console_scripts': ['hicap=hicap.main:main'], 26 | } 27 | ) 28 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import pathlib 3 | 4 | 5 | tests_directory = pathlib.Path(__file__).parent 6 | logging.getLogger().setLevel(51) 7 | -------------------------------------------------------------------------------- /tests/data/bad.fasta: -------------------------------------------------------------------------------- 1 | bad fasta 2 | imnotvalid 3 | -------------------------------------------------------------------------------- /tests/data/good.fasta: -------------------------------------------------------------------------------- 1 | >good 2 | atgc 3 | -------------------------------------------------------------------------------- /tests/data/type_a.fasta: -------------------------------------------------------------------------------- 1 | >Z37516 Z37516 Haemophilus influenzae serotype a capsulation locus region II DNA. 2 | cggcacagggctgataaaaaacgtctcagtctcaaacaggtgaaatttataggttatctt 3 | tttataaaatatttagtaatccatcgcctattttcataaattttatgatagaattaaaac 4 | ttaatatgacatacaaccggtaaaaagtggtctttttttaaattaaggctacagttttct 5 | tgtgtatgcaagataaatagatacaagatcttgttatctaaatgtcactttaccaaaaaa 6 | tattttaagctaatctgttgggatatcatatgttaaaaaataaaaacatagggatcattt 7 | tggctggtggcataggctctcgcatgggcctaggttacccaaaacaattttcaaaaattg 8 | caggtaaaacagcactagaacacacaattttcatttttcaagaacataaagaaattgatg 9 | aaattatcatcgtttctgagcgtacctcttatcgtcgtattgaagatatcgtatcaaaag 10 | ctggattttccaaagttaatcgtattatttttggtggtaaagaacgctctgattctactc 11 | tttctgcaatcacagctcttcaagatgaaccaagaaatacgaaattaatcattcatgatg 12 | ctgtacgacctttactagcgactgaaataatctctgaatgtattgcgaaattagataagt 13 | acaatgctgtagatgtggctattcctgcagttgataccattgttcatgttaataatgata 14 | cccaagaaattattaaaattcctaagcgtgctgaatactaccaaggccaaactccacaag 15 | catttaaactaggcacgctaaaaaaagcttacgatatttatacacaaggtggcatcgaag 16 | gtacttgtgattgttctattgtgttaaaaaccctacctgaagaaagagttggtatcgttt 17 | caggttttgaaaccaacattaaactaactcgcccagttgatctttttatcgctgataaat 18 | tattccaaagccgtagtcatttttcactacgtaatatcacctctattgatcgcctatatg 19 | atatgaaagatcaggtattagttgttattggtggaagctatggtattggcgcgcatatta 20 | tcgatgttgcaaaaaaatttggaattaaaacatatagccttagtcgttcaaatggtgtcg 21 | atgttggtgatgttaagtctattgaaaaagcattcgcaggaatttacggaaaagaacaca 22 | aaatagaccatatcgtaaatactgctgcggtgttaaatcataaaacgttagcatcaatgt 23 | cttatgaagaaattgtaactagtatcaatgtaaactacacgggcatgattaatgctgtga 24 | taacagcttatccttacttaaaacaaactcatggtagttttttaggtttcacatcaagct 25 | cgtatacacgaggccgtccattctatgctatttactcttctgcaaaagcagctgtggtaa 26 | acttaactcaagccatctctgaagaatggttaccggataatattaaaattaactgcgtta 27 | atccagagagaacaaaaacaccaatgagaaccaaagcattcggtattgaaccagaaggca 28 | cactacttgatcccaaaacggtagcatttgcttctcttactgtactcgctagcagagaga 29 | ctggtaacatcatcgatgttgtattaaaagatgaagaatatatttcccatattttagctg 30 | atctttataaataaatttgagtgagtctgttatggctaatacaccctattttatttatct 31 | tgacaccaaaattattggcgcagtaaagcaaacaattacctttttcgaacatggtgtgtt 32 | ttctcgtggaaacacaaccattcttgtgaaaaagtataagcataagtcagcaaaaataat 33 | tgagcgagctttaattaaagcctcgctcaattatcattttgtcaatgccgcctaccttga 34 | tcgattaacagaaggtgttattttttacccatttaatgcacagtcaaattgccgagcagt 35 | agcaaaccgtaaacttactcatatttttatcactcatggtgaaagcaataaaatcacctc 36 | agttaagcctattactcgcatttatgatcatgttattactgcaggtaaagctggtgtaga 37 | tcgctttctttcccataaaattttctctcaatatgatgttgatacaggcagaatcattcc 38 | tatgggagatacatttattgggaaaacaggactagattgtacaggtaaaggcactccggt 39 | catcttttatgctccaacatgggaaggcggtattgagcaagaaaattactctagccttgc 40 | tcatataaatcaagttgtggcaaccatcttacaacttagcgaatactatcaagtgaagca 41 | tgtcgccattcgtccacacctaaacacaggacaccgcagaccagaatatcacaatttttt 42 | attacgaataatagaaagcttacaagcaaaatcactaaaactcgtacttttcaaacctta 43 | cttgaatttttcttttgcccaagaatggaaattaaagcggagagatgttgtttttaaaac 44 | aaacttcagtgagtttagtgctgtagttggcctgtgcgatatttctgcaatggaaactca 45 | attacttaacgaaaatatttattactacttattctgctctgaagagtacaagcagtatct 46 | attgacgttaaagaacagtgaatactatcaaaataacgcattaatctttgattgcgggga 47 | attgattccttctcaagaattagaaaatttccaacatttaaagtcttatctaatagattc 48 | taacttctctgaaattccaatttcagaaagattgagatttttattgacaaacttaataat 49 | gagctaatcaggaaatcatgaaaaaacgtaatttatttagaaaaaaatttaaaaataatg 50 | ctccgcgtaatgagcgtatcgatgtaagcatcattatcccaatgtataatgtagaaaatt 51 | taattggtaaaactattgaatgcttaaaaaataatttctgtaaaatggaagtattgctta 52 | ttgacgatggttcaaaagataacactgttaataatgcaaaattagccgttgctaacgata 53 | aaagatttactattcttcgaaaagaaaattctggtgtttcctctactagaaactttggaa 54 | taaaaaaaggaaaaggagaattcatttttttctgtgattctgatgacattttagaaggaa 55 | atgctattgataaactactcattgcagcatttgctgaaaatgcggattatatttacggtg 56 | gcatcaaaaaatttaataaagaaaaagagtggactattcctgttcacgacaaaaataatc 57 | tattcctacaaggaacaaagaccatcgataagaatacagaactatttttatcaatgtctc 58 | ctggggcaaaattaatacatcggtcactgttaaagaataaattttttccagaagatattc 59 | attgtgtctattgtatcggtaactatatctacaaatatacagaagatcaggtcatattct 60 | tcaatatatttttagatgctaaaaaaatctattgtatcggtaactatatctacaaatata 61 | gagagcgagatttagaaaacaatgaacgatcaattacacagcaacgtgatataaaagcct 62 | ttgcattttttattgatattttgtcagttgttgaaatcaatagaaaagttttggaagaat 63 | ctgctttaactgactctcaaaaaaaacttgttcttaaagcatattttgaaagagccttaa 64 | cctttgatgtatggcctctatttctacgtgtcttaaagtttgacaataaaaaatctagcg 65 | aggcgataactctgataatcaatctaattaatagtgtagataaagagtttttgaattaca 66 | ctccaggatttagatattttttcttaagagttttaattgataatattgattatattagca 67 | tcaaagattatttactatacaaatcactagtagctctaatcatttcaaacttacaagaaa 68 | aaactatagaggtttgtgaaaattcgccaaactggggaaatagattgacagaaaataaaa 69 | gtattatagctaaaaatggattcttaaactttttattattacgtcagaagaaaaaacttt 70 | ctagatttttaaatagaaatagagaatttattggtaaaaatttatttttccctttaatga 71 | aacttattcctatcaataagaataagattgtgtttgctacatcatcaaaaggaaaagcat 72 | ctagcaatttcacatatctgctaaatgaactaaaaaaagataacaagaattatgagataa 73 | aaaaattccttggtttatcaaatgaactaaaaagaaacttataccgctattatcatttag 74 | ccactgcaggaacaatttttttagaaagctattatagccccctatataatgtaaaattaa 75 | gaaaaagtactaaagtagttcaattatggcatgcttgtgccggctttaaaaaattcgcat 76 | atagctcactaggtcaaggcgatgctaactccgaagaatttgagtatcatgctcataagt 77 | tttatacacatgttatgacaagctcagatgataccagtattatatattctgaagcattca 78 | acttacctttagagaaaatgcatagtttaggtgttcctagaactgatttcttcttcaata 79 | gaagaaaaatgaattctgtacgaaatgaaattttagaaaaataccctgaatctaagaata 80 | ctaaaaatgtactttattctccaacatttagaggaaatcctagagagcgtaaaaacttca 81 | aattaccatttgattttaaacaatttgataaattaccttatgaatataagataattatca 82 | aattgcacccagcagtcgatatttcaagtataaaaataccatatcattatagaaatcgtt 83 | ttttattattagatagttccgaagatgttaaccaatggttatgctttagtgatatattaa 84 | ttacggattattcttcattaatttttgaatatgcattactagataacaattatttatatg 85 | cgtatgatatcgatgagtacttcgatgaacgtggtttctataatccatatgaaacttatg 86 | catatggagaaatagtcacaaataagagaaggcttattgatgctattttaactactgaaa 87 | ataacatggatgattatgctcagaaaaaagaagcttttaaagaaaaatttatgtctggct 88 | gtgatggcaaatcatctataaaaattctatcttatattatgaaataaatttgaggcttat 89 | atgaggaacataaaaacgttattagaactcataaaaaatgaagataaaaacttttctttt 90 | tataaatcattttacaataaatctatctattatgattttccattctttcatcacaaagag 91 | aataaatgggataattttaccgtcagcattgatttagtaaaacaaagattttatttttat 92 | ctacgctctcacttaaaatcaaaatcgtatcgtctgtttagctacatgaatgggaaatac 93 | tattgttatcacatcgctaaattaactgacctagatgtgtcaggttatatatttacttac 94 | aaaatgatcgaaaatttatctatttataacacacctaacatagagttagaaaaataatac 95 | attatatatttacttatactaattaaaagcaccaaaaaatttccacttaaaagttaattg 96 | agttatttattaaaaataaaattttaatataaaacatcatatataattattttttagcta 97 | tctttctattcacttgaaagatagatcgcaaacttatcatttacataaaggaatattaaa 98 | tttgcagaataaatctaatatattgcggggaaagagcagataaaaccatgtcatctgccc 99 | tcattttttcatacggaattaaggaaatccctcacctagcctcattttttcctaatgaag 100 | aa 101 | -------------------------------------------------------------------------------- /tests/data/type_a_variant.fasta: -------------------------------------------------------------------------------- 1 | >Z37516 Z37516 Haemophilus influenzae serotype a capsulation locus region II DNA. 2 | cggcacagggctgataaaaaacgtctcagtctcaaacaggtgaaatttataggttatctt 3 | tttataaaatatttagtaatccatcgcctattttcataaattttatgatagaattaaaac 4 | ttaatatgacatacaaccggtaaaaagtggtctttttttaaattaaggctacagttttct 5 | tgtgtatgcaagataaatagatacaagatcttgttatctaaatgtcactttaccaaaaaa 6 | tattttaagctaatctgttgggatatcatatgttaaaaaataaaaacatagggatcattt 7 | tggctggtggcataggctctcgcatgggcctaggttacccaaaacaattttcaaaaattg 8 | caggtaaaacagcactagaacacacaattttcatttttcaagaacataaagaaattgatg 9 | aaattatcatcgtttctgagcgtacctcttatcgtcgtattgaagatatcgtatcaaaag 10 | ctggattttccaaagttaatcgtattatttttggtggtaaagaacgctctgattctactc 11 | tttctgcaatcacagctcttcaagatgaaccaagaaatacgaaattaatcattcatgatg 12 | ctgtacgacctttactagcgactgaaataatctctgaatgtattgcgaaattagataagt 13 | acaatgctgtagatgtggctattcctgcagttgataccattgttcatgttaataatgata 14 | cccaagaaattattaaaattcctaagcgtgctgaatactaccaaggccaaactccacaag 15 | gtacttgtgattgttctattgtgttaaaaaccctacctgaagaaagagttggtatcgttt 16 | caggttttgaaaccaacattaaactaactcgcccagttgatctttttatcgctgataaat 17 | tattccaaagccgtagtcatttttcactacgtaatatcacctctattgatcgcctatatg 18 | atatgaaagatcaggtattagttgttattggtggaagctatggtattggcgcgcatatta 19 | tcgatgttgcaaaaaaatttggaattaaaacatatagccttagtcgttcaaatggtgtcg 20 | atgttggtgatgttaagtctattgaaaaagcattcgcaggaatttacggaaaagaacaca 21 | aaatagaccatatcgtaaatactgctgcggtgttaaatcataaaacgttagcatcaatgt 22 | cttatgaagaaattgtaactagtatcaatgtaaactacacgggcatgattaatgctgtga 23 | taacagcttatccttacttaaaacaaactcatggtagttttttaggtttcacatcaagct 24 | cgtatacacgaggccgtccattctatgctatttactcttctgcaaaagcagctgtggtaa 25 | acttaactcaagccatctctgaagaatggttaccggataatattaaaattaactgcgtta 26 | atccagagagaacaaaaacaccaatgagaaccaaagcattcggtattgaaccagaaggca 27 | cactacttgatcccaaaacggtagcatttgcttctcttactgtactcgctagcagagaga 28 | ctggtaacatcatcgatgttgtattaaaagatgaagaatatatttcccatattttagctg 29 | atctttataaataaatttgagtgagtctgttatggctaatacaccctattttatttatct 30 | tgacaccaaaattattggcgcagtaaagcaaacaattacctttttcgaacatggtgtgtt 31 | ttctcgtggaaacacaaccattcttgtgaaaaagtataagcataagtcagcaaaaataat 32 | tgagcgagctttaattaaagcctcgctcaattatcattttgtcaatgccgcctaccttga 33 | tcgattaacagaaggtgttattttttacccatttaatgcacagtcaaattgccgagcagt 34 | agcaaaccgtaaacttactcatatttttatcactcatggtgaaagcaataaaatcacctc 35 | agttaagcctattactcgcatttatgatcatgttattactgcaggtaaagctggtgtaga 36 | tcgctttctttcccataaaattttctctcaatatgatgttgatacaggcagaatcattcc 37 | tatgggagatacatttattgggaaaacaggactagattgtacaggtaaaggcactccggt 38 | tatgggagatacatttattgggaaaacaggactagattgtacaggtaaaggcactccggt 39 | catcttttatgctccaacatgggaaggcggtattgagcaagaaaattactctagccttgc 40 | tcatataaatcaagttgtggcaaccatcttacaacttagcgaatactatcaagtgaagca 41 | tgtcgccattcgtccacacctaaacacaggacaccgcagaccagaatatcacaatttttt 42 | attacgaataatagaaagcttacaagcaaaatcactaaaactcgtacttttcaaacctta 43 | cttgaatttttcttttgcccaagaatggaaattaaagcggagagatgttgtttttaaaac 44 | aaacttcagtgagtttagtgctgtagttggcctgtgcgatatttctgcaatggaaactca 45 | attacttaacgaaaatatttattactacttattctgctctgaagagtacaagcagtatct 46 | attgacgttaaagaacagtgaatactatcaaaataacgcattaatctttgattgcgggga 47 | attgattccttctcaagaattagaaaatttccaacatttaaagtcttatctaatagattc 48 | taacttctctgaaattccaatttcagaaagattgagatttttattgacaaacttaataat 49 | gagctaatcaggaaatcatgaaaaaacgtaatttatttagaaaaaaatttaaaaataatg 50 | ctccgcgtaatgagcgtatcgatgtaagcatcattatcccaatgtataatgtagaaaatt 51 | taattggtaaaactattgaatgcttaaaaaataatttctgtaaaatggaagtattgctta 52 | ttgacgatggttcaaaagataacactgttaataatgcaaaattagccgttgctaacgata 53 | aaagatttactattcttcgaaaagaaaattctggtgtttcctctactagaaactttggaa 54 | taaaaaaaggaaaaggagaattcatttttttctgtgattctgatgacattttagaaggaa 55 | atgctattgataaactactcattgcagcatttgctgaaaatgcggattatatttacggtg 56 | gcatcaaaaaatttaataaagaaaaagagtggactattcctgttcacgacaaaaataatc 57 | tattcctacaaggaacaaagaccatcgataagaatacagaactatttttatcaatgtctc 58 | ctggggcaaaattaatacatcggtcactgttaaagaataaattttttccagaagatattc 59 | attgtgtctattgtatcggtaactatatctacaaatatacagaagatcaggtcatattct 60 | tcaatatatttttagatgctaaaaaaatctattgtatcggtaactatatctacaaatata 61 | gagagcgagatttagaaaacaatgaacgatcaattacacagcaacgtgatataaaagcct 62 | ttgcattttttattgatattttgtcagttgttgaaatcaatagaaaagttttggaagaat 63 | ctgctttaactgactctcaaaaaaaacttgttcttaaagcatattttgaaagagccttaa 64 | cctttgatgtatggcctctatttctacgtgtcttaaagtttgacaataaaaaatctagcg 65 | aggcgataactctgataatcaatctaattaatagtgtagataaagagtttttgaattaca 66 | ctccaggatttagatattttttcttaagagttttaattgataatattgattatattagca 67 | tcaaagattatttactatacaaatcactagtagctctaatcatttcaaacttacaagaaa 68 | aaactatagaggtttgtgaaaattcgccaaactggggaaatagattgacagaaaataaaa 69 | gtattatagctaaaaatggattcttaaactttttattattacgtcagaagaaaaaacttt 70 | ctagatttttaaatagaaatagagaatttattggtaaaaatttatttttccctttaatga 71 | aacttattcctatcaataagaataagattgtgtttgctacatcatcaaaaggaaaagcat 72 | ctagcaatttcacatatctgctaaatgaactaaaaaaagataacaagaattatgagataa 73 | aaaaattccttggtttatcaaatgaactaaaaagaaacttataccgctattatcatttag 74 | ccactgcaggaacaatttttttagaaagctattatagccccctatataatgtaaaattaa 75 | gaaaaagtactaaagtagttcaattatggcatgcttgtgccggctttaaaaaattcgcat 76 | atagctcactaggtcaaggcgatgctaactccgaagaatttgagtatcatgctcataagt 77 | tttatacacatgttatgacaagctcagatgataccagtattatatattctgaagcattca 78 | acttacctttagagaaaatgcatagtttaggtgttcctagaactgatttcttcttcaata 79 | gaagaaaaatgaattctgtacgaaatgaaattttagaaaaataccctgaatctaagaata 80 | ctaaaaatgtactttattctccaacatttagaggaaatcctagagagcgtaaaaacttca 81 | aattaccatttgattttaaacaatttgataaattaccttatgaatataagataattatca 82 | aattgcacccagcagtcgatatttcaagtataaaaataccatatcattatagaaatcgtt 83 | ttttattattagatagttccgaagatgttaaccaatggttatgctttagtgatatattaa 84 | ttacggattattcttcattaatttttgaatatgcattactagataacaattatttatatg 85 | cgtatgatatcgatgagtacttcgatgaacgtggtttctataatccatatgaaacttatg 86 | catatggagaaatagtcacaaataagagaaggcttattgatgctattttaactactgaaa 87 | ataacatggatgattatgctcagaaaaaagaagcttttaaagaaaaatttatgtctggct 88 | gtgatggcaaatcatctataaaaattctatcttatattatgaaataaatttgaggcttat 89 | atgaggaacataaaaacgttattagaactcataaaaaatgaagataaaaacttttctttt 90 | tataaatcattttacaataaatctatctattatgattttccattctttcatcacaaagag 91 | aataaatgggataattttaccgtcagcattgatttagtaaaacaaagattttatttttat 92 | ctacgctctcacttaaaatcaaaatcgtatcgtctgtttagctacatgaatgggaaatac 93 | tattgttatcacatcgctaaattaactgacctagatgtgtcaggttatatatttacttac 94 | aaaatgatcgaaaatttatctatttataacacacctaacatagagttagaaaaataatac 95 | attatatatttacttatactaattaaaagcaccaaaaaatttccacttaaaagttaattg 96 | agttatttattaaaaataaaattttaatataaaacatcatatataattattttttagcta 97 | tctttctattcacttgaaagatagatcgcaaacttatcatttacataaaggaatattaaa 98 | tttgcagaataaatctaatatattgcggggaaagagcagataaaaccatgtcatctgccc 99 | tcattttttcatacggaattaaggaaatccctcacctagcctcattttttcctaatgaag 100 | aa 101 | -------------------------------------------------------------------------------- /tests/test_blast.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Copyright 2018 Stephen Watts 3 | https://github.com/scwatts/hicap 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | ''' 18 | 19 | 20 | import pathlib 21 | import unittest 22 | 23 | 24 | from . import tests_directory 25 | import hicap.alignment 26 | 27 | 28 | class CreateDatabaseTestCase(unittest.TestCase): 29 | 30 | def setUp(self): 31 | self.blast_db_fp = None 32 | self.blast_db_ext = ('nhr', 'nin', 'nsq') 33 | 34 | def tearDown(self): 35 | for ext in self.blast_db_ext: 36 | blast_db_fp_part = pathlib.Path('%s.%s' % (self.blast_db_fp, ext)) 37 | if blast_db_fp_part.exists(): 38 | blast_db_fp_part.unlink() 39 | 40 | def test_create_database_1(self): 41 | fasta_fp = pathlib.Path(tests_directory, 'data/good.fasta') 42 | self.blast_db_fp = hicap.alignment.create_blast_database(fasta_fp, tests_directory) 43 | for ext in self.blast_db_ext: 44 | blast_db_fp_part = pathlib.Path('%s.%s' % (self.blast_db_fp, ext)) 45 | self.assertTrue(blast_db_fp_part.exists()) 46 | 47 | def test_create_database_2(self): 48 | fasta_fp = pathlib.Path(tests_directory, 'data/bad.fasta') 49 | with self.assertRaises(SystemExit): 50 | hicap.alignment.create_blast_database(fasta_fp, tests_directory) 51 | 52 | 53 | class QueryDatabaseTestCase(unittest.TestCase): 54 | 55 | @classmethod 56 | def setUpClass(cls): 57 | database_fp = pathlib.Path(tests_directory, 'data/type_a.fasta') 58 | cls.blast_db_fp = hicap.alignment.create_blast_database(database_fp, tests_directory) 59 | cls.blast_db_ext = ('nhr', 'nin', 'nsq') 60 | hicap.alignment.BlastFormat = {'qseqid': str, 61 | 'sseqid': str, 62 | 'qlen': int, 63 | 'slen': int, 64 | 'qstart': int, 65 | 'qend': int, 66 | 'sstart': int, 67 | 'send': int, 68 | 'length': int, 69 | 'mismatch': int, 70 | 'gaps': int} 71 | 72 | @classmethod 73 | def tearDownClass(cls): 74 | for ext in cls.blast_db_ext: 75 | blast_db_fp_part = pathlib.Path('%s.%s' % (cls.blast_db_fp, ext)) 76 | blast_db_fp_part.unlink() 77 | 78 | def test_query_database_1(self): 79 | first_hit = 'Z37516\tZ37516\t5882\t5882\t2161\t5882\t2161\t5882\t3722\t0\t0' 80 | last_hit = 'Z37516\tZ37516\t5882\t5882\t2965\t2976\t5696\t5685\t12\t0\t0' 81 | query_fp = pathlib.Path(tests_directory, 'data/type_a_variant.fasta') 82 | blast_stdout = hicap.alignment.align(query_fp, self.blast_db_fp) 83 | hits = [l for l in blast_stdout.rstrip().split('\n')] 84 | self.assertEqual(hits[0], first_hit) 85 | self.assertEqual(hits[-1], last_hit) 86 | 87 | def test_query_database_2(self): 88 | query_fp = pathlib.Path(tests_directory, 'data/good.fasta') 89 | blast_stdout = hicap.alignment.align(query_fp, self.blast_db_fp) 90 | self.assertEqual(blast_stdout, '') 91 | -------------------------------------------------------------------------------- /tests/test_util.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Copyright 2018 Stephen Watts 3 | https://github.com/scwatts/hicap 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | ''' 18 | 19 | 20 | import pathlib 21 | import unittest 22 | 23 | 24 | from . import tests_directory 25 | import hicap.utility 26 | 27 | 28 | class CommandExecuteTestCase(unittest.TestCase): 29 | 30 | def test_execute_command_1(self): 31 | result = hicap.utility.execute_command('echo test') 32 | self.assertEqual(result.returncode, 0) 33 | self.assertEqual(result.stdout.rstrip(), 'test') 34 | self.assertEqual(result.stderr, '') 35 | 36 | def test_execute_command_2(self): 37 | result = hicap.utility.execute_command('invalid_command', check=False) 38 | self.assertEqual(result.returncode, 127) 39 | self.assertEqual(result.stdout, '') 40 | 41 | def test_execute_command_3(self): 42 | with self.assertRaises(SystemExit): 43 | hicap.utility.execute_command('invalid_command') 44 | 45 | 46 | class FastaParserTestCase(unittest.TestCase): 47 | 48 | def test_read_query_fasta_1(self): 49 | input_fp = pathlib.Path(tests_directory, 'data/good.fasta') 50 | fasta = hicap.utility.read_fasta(input_fp) 51 | self.assertEqual(fasta['good'], 'atgc') 52 | 53 | def test_read_query_fasta_2(self): 54 | input_fp = pathlib.Path(tests_directory, 'data/bad.fasta') 55 | with self.assertRaises(SystemExit): 56 | hicap.utility.read_fasta(input_fp) 57 | --------------------------------------------------------------------------------