changeset 0:231e4c669675 draft

Initial commit - v0.10.3 git commit deeded0
author vimalkumarvelayudhan
date Tue, 27 Feb 2018 14:16:54 -0500
parents
children 9825b6a8728b
files LICENSE README.md VIGA.py tool_data/viga_blastdb.loc.sample tool_data/viga_diamonddb.loc.sample tool_data/viga_hmmdb.loc.sample tool_data/viga_rfamdb.loc.sample tool_data_table_conf.xml.sample wrapper.xml
diffstat 9 files changed, 2309 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    {one line to give the program's name and a brief idea of what it does.}
+    Copyright (C) {year}  {name of author}
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    {project}  Copyright (C) {year}  {fullname}
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,270 @@
+# VIGA
+De novo Viral Genome Annotator
+
+VIGA is a script written in Python 2.7 that annotates viral genomes automatically (using a de novo algorithm) and predict the function of their proteins using BLAST and HMMER.
+
+## REQUIREMENTS:
+
+Before using this script, the following Python modules and programs should be installed:
+
+* Python modules:
+	- BCBio (https://github.com/chapmanb/bcbio-nextgen)
+	- Biopython (Bio module; Cock et al. 2009)
+	- Numpy (https://github.com/numpy/numpy)
+	- Scipy (https://github.com/scipy/scipy)
+
+* Programs:
+	- GNU Parallel (Tange 2011): it is used to parallelize HMMER. The program is publicly available at https://www.gnu.org/software/parallel/ under the GPLv3 licence.
+	- LASTZ (Harris 2007): it is used to predict the circularity of the contigs. The program is publicly available at https://github.com/lastz/lastz under the MIT licence.
+	- Prodigal (Hyatt et al. 2010): it is used to predict the ORFs. When the contig is smaller than 20,000 bp, MetaProdigal (Hyatt et al. 2012) is automatically activated instead of normal Prodigal. This program is publicly available at https://github.com/hyattpd/prodigal/releases/ under the GPLv3 licence.
+	- BLAST+ (Camacho et al. 2008): it is used to predict the function of the predicted proteins according to homology. This suite is publicly available at ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ under the GPLv2 licence. Databases are available at ftp://ftp.ncbi.nlm.nih.gov/blast/db/
+	- DIAMOND (Buchfink et al. 2015): it is used to predict the function of proteins according to homology when "--noblast" parameter is used. This program is publicly available at https://github.com/bbuchfink/diamond under the GPLv3 licence. Databases must be created from FASTA files according to their instructions before running.
+	- HMMER (Finn et al. 2011): it is used to predict the function of the predicted proteins according to Hidden Markov Models. This suite is publicly available at http://hmmer.org/ under the GPLv3 licence. Databases must be in FASTA format and examples of potential databases are UniProtKB (ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz) or PFAM (http://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.fasta.gz).
+	- INFERNAL (Nawrocki and Eddy 2013): it is used to predict ribosomal RNA in the contigs when using the RFAM database (Nawrocki et al. 2015). This program is publicly available at http://eddylab.org/infernal/ under the BSD licence and RFAM database is available at ftp://ftp.ebi.ac.uk/pub/databases/Rfam/
+	- ARAGORN (Laslett and Canback 2004): it is used to predict tRNA sequences in the contig. This program is publicly available at http://mbio-serv2.mbioekol.lu.se/ARAGORN/ under the GPLv2 licence.
+	- PILERCR (Edgar 2007): it is used to predict CRISPR repeats in your contig. This program is freely available at http://drive5.com/pilercr/ under a public licence.
+	- Tandem Repeats Finder (TRF; Benson 1999): it is used to predict the tandem repeats in your contig. This program is freely available at https://tandem.bu.edu/trf/trf.html under a custom licence.
+	- Inverted Repeats Finder (IRF; Warburton et al. 2004): it is used to predict the inverted repeats in your contig. This program is freely available at https://tandem.bu.edu/irf/irf.download.html under a custom licence.
+
+Although you can install the programs manually, we strongly recommend the use of the Docker image to create an environment for VIGA. The link to the Docker image is https://hub.docker.com/r/vimalkvn/viga/
+
+However, you will need to download the databases for BLAST, HMMER, and INFERNAL:
+* BLAST DBs: https://ftp.ncbi.nlm.nih.gov/blast/db/
+* BLAST FASTA (DIAMOND): https://ftp.ncbi.nlm.nih.gov/blast/db/FASTA
+* RFAM (INFERNAL): http://ftp.ebi.ac.uk/pub/databases/Rfam/
+* UniProtKB (HMMER): ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_trembl.fasta.gz
+* PFAM (HMMER): http://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.fasta.gz
+
+Note that this bioinformatic pipeline only takes protein databases (i.e. "nr", "swissprot"...)!
+Additionally, before running the "ultrafast" mode, you need to convert the FASTA file to the DIAMOND DB format using the following command:
+
+	diamond makedb --in nr -d nr
+
+When using this program, you must cite their use:
+
+	VIGA v. 0.10.3 (https://github.com/EGTortuero/viga)
+
+## PARAMETERS:
+
+The program has the following two types of arguments:
+
+### Mandatory parameters:
+
+<table>
+<tr><td>--input FASTAFILE</td><td>Input file as a nucleotidic FASTA file. It can contains multiple sequences (e.g. metagenomic contigs)</td></tr>
+<tr><td>--rfamdb RFAMDB</td><td>RFAM database that will be used for the ribosomal RNA prediction.</td></tr>
+<tr><td>--modifiers TEXTFILE</td><td>Input file as a plain text file with the modifiers per every FASTA header according to SeqIn (https://www.ncbi.nlm.nih.gov/Sequin/modifiers.html). All modifiers must be written in a single line and are separated by a single space character. No space should be placed besides the = sign. For example: [organism=Serratia marcescens subsp. marcescens] [sub-species=marcescens] [strain=AH0650_Sm1] [moltype=DNA] [tech=wgs] [gcode=11] [country=Australia] [isolation-source=sputum]. This line will be copied and printed along with the record name as the definition line of every contig sequence.</tr></td>
+</table>
+
+### Advanced parameters:
+
+<table>
+<tr><td>--readlength INT</td><td>Read length for the circularity prediction (default: 101 bp)</td></tr>
+<tr><td>--windowsize INT</td><td>Window length used to determine the origin of replication in circular contigs according to the cumulative GC skew(default: 100 bp)</td></tr>
+<tr><td>--slidingsize INT</td><td>Sliding window length used to determine the origin of replication in circular contigs according to the cumulative GC skew(default: 10 bp)</td></tr>
+<tr><td>--out OUTPUTNAME</td><td>Name of the outputs files without extensions, as the program will add them automatically. By default, the program will use the input name as the output.</td></tr>
+<tr><td>--locus STRING</td><td>Name of the contigs. If the input is a multiFASTA file, please put a general name as the program will add the number of the contig at the end of the name. By default, the name of the contigs will be "LOC".</td></tr>
+<tr><td>--threads INT</td><td>Number of threads/CPUs. By default, the program will use 1 CPU.</td></tr>
+<tr><td>--gff</td><td>Printing the output as a General Feature Format (GFF) version 3. It is a flat table file with contains 9 columns of data (see http://www.ensembl.org/info/website/upload/gff3.html for more information). By default, the program will not print the GFF3 file (--gff False).</td></tr>
+<tr><td>--blastdb BLASTDB</td><td>BLAST database that will be used for the protein function prediction. The database MUST be for amino acids. This is only mandatory if the "ultrafast" mode is not active</td></tr>
+<tr><td>--diamonddb DIAMONDDB</td><td>DIAMOND database that will be used for the protein function prediction. The database MUST be for amino acids. This is only mandatory when "ultrafast" mode is active</td></tr>
+<tr><td>--blastevalue FLOAT</td><td>BLAST e-value threshold. By default, the threshold will be 1e-05.</td></tr>
+
+<tr><td>--nohmmer</td><td>Running the program without using PHMMER to predict protein function. In this case, the program will be as fast as Prokka (Seemann 2014) but the annotations will not be accurate. By default, this program had this flag disabled.</td></tr>
+<tr><td>--noblast</td><td>Running the program replacing BLAST by DIAMOND. In this case, the program will be fast but the annotations will not be accurate. By default, this program had this flag disabled.</td></tr>
+<tr><td>--hmmdb HMMDB</td><td>PHMMER Database that will be used for the protein function prediction according to Hidden Markov Models. In this case, HMMDB must be in FASTA format (e.g. UniProt). This parameter is mandatory if the "--fast" option is disabled. "</td></tr>
+<tr><td>--hmmerevalue FLOAT</td><td>PHMMER e-value threshold. By default, the threshold is 1e-03.</td></tr>
+<tr><td>--typedata BCT|CON|VRL|PHG</td><td>GenBank Division: One of the following codes:
+<table>
+<tr><td>BCT</td><td>Prokaryotic chromosome</td></tr>
+<tr><td>VRL</td><td>Eukaryotic/Archaea virus</td></tr>
+<tr><td>PHG</td><td>Phages</td></tr>
+<tr><td>CON</td><td>Contig</td></tr>
+</table>
+By default, the program will consider every sequence as a contig (CON)</td></tr>
+<tr><td>--gcode NUMBER</td><td>Number of GenBank translation table. At this moment, the available options are:
+<table>
+<tr><td>1</td><td>Standard genetic code [Eukaryotic]</td></tr>
+<tr><td>2</td><td>Vertebrate mitochondrial code</td></tr>
+<tr><td>3</td><td>Yeast mitochondrial code</td></tr>
+<tr><td>4</td><td>Mycoplasma/Spiroplasma and Protozoan/mold/coelenterate mitochondrial code</td></tr>
+<tr><td>5</td><td>Invertebrate mitochondrial code</td></tr>
+<tr><td>6</td><td>Ciliate/dasycladacean/Hexamita nuclear code</td></tr>
+<tr><td>9</td><td>Echinoderm/flatworm mitochondrial code</td></tr>
+<tr><td>10</td><td>Euplotid nuclear code</td></tr>
+<tr><td>11</td><td>Bacteria/Archaea/Phages/Plant plastid</td></tr>
+<tr><td>12</td><td>Alternative yeast nuclear code</td></tr>
+<tr><td>13</td><td>Ascidian mitochondrial code</td></tr>
+<tr><td>14</td><td>Alternative flatworm mitochondrial code</td></tr>
+<tr><td>16</td><td>Chlorophycean mitochondrial code</td></tr>
+<tr><td>21</td><td>Trematode mitochondrial code</td></tr>
+<tr><td>22</td><td>Scedenesmus obliquus mitochondrial code</td></tr>
+<tr><td>23</td><td>Thraustochytrium mitochondrial code</td></tr>
+<tr><td>24</td><td>Pterobranquia mitochondrial code</td></tr>
+<tr><td>25</td><td>Gracilibacteria and Candidate division SR1</td></tr>
+<tr><td>26</td><td>Pachysolen tannophilus nuclear code</td></tr>
+<tr><td>27</td><td>Karyorelict nuclear code</td></tr>
+<tr><td>28</td><td>Condylostoma nuclear code</td></tr>
+<tr><td>29</td><td>Mesodinium nuclear code</td></tr>
+<tr><td>30</td><td>Peritrich nuclear code</td></tr>
+<tr><td>31</td><td>Blastocrithidia nuclear code</td></tr>
+</table>
+By default, the program will use the translation table no. 11</td></tr>
+<tr><td>--mincontigsize INT</td><td>Minimum contig length to be considered in the final files. By default, the program only consider from 200 bp.</td></tr>
+<tr><td>--idthr FLOAT</td><td>Identity threshold to consider that a protein belong to a specific hit. By default, the threshold is 50.0 %</td></tr>
+<tr><td>--coverthr FLOAT</td><td>Coverage threshold to consider that a protein belong to a specific hit. By default, the threshold is 50.0 %</td></tr>
+<tr><td>--diffid FLOAT (>0.01)</td><td>Max allowed difference between the ID percentages of BLAST and HMMER. By default, the allowed difference is 5.00 % and we do not recommended to change such value.</td></tr>
+<tr><td>--minrepeat INT</td><td>Minimum repeat length for CRISPR detection (Default: 16)</td></tr>
+<tr><td>--maxrepeat INT</td><td>Maximum repeat length for CRISPR detection (Default: 64)</td></tr>
+<tr><td>--minspacer INT</td><td>Minimum spacer length for CRISPR detection (Default: 8)</td></tr>
+<tr><td>--maxspacer INT</td><td>Maximum spacer length for CRISPR detection (Default: 64)</td></tr>
+<tr><td>--blastexh</td><td>Use of exhaustive BLAST to predict the proteins by homology according to Fozo et al. (2010). In this case, the search will be done using a word size of 2, a gap open penalty of 8, a gap extension penalty of 2, the PAM70 matrix instead of the BLOSUM62 and no compositional based statistics. This method is more accurate to predict the functions of the proteins but it is slower than BLAST default parameters. By default, exhaustive BLAST is disabled.</td></tr>
+</table>
+
+## Examples
+An example of execution (using BLAST and HMMER) is:
+
+	python VIGA.py --input eukarya.fasta --blastdb databases/blast/nr/nr --hmmdb databases/UniProt/uniprot_trembl.fasta --rfamdb databases/rfam/Rfam.cm --gcode 1 --out eukarya_BENCHMARK --modifiers ../modifiers.txt --threads 10
+
+Another example (but this time using BLAST but not HMMER - "fast mode") is:
+
+	python VIGA.py --input bacteria.fasta --blastdb databases/blast/nr/nr --nohmmer --rfamdb databases/rfam/Rfam.cm --out bacteria_BENCHMARK --modifiers ../modifiers.txt --threads 10
+	
+Finally, an example using DIAMOND and not HMMER ("ultrafast mode") is:
+
+	python VIGA.py --input archaea.fasta --noblast --diamonddb databases/diamond/nr --nohmmer --rfamdb databases/rfam/Rfam.cm --out archaea_BENCHMARK --modifiers ../modifiers.txt --threads 10
+
+## Galaxy wrapper
+VIGA can be integrated into [Galaxy](https://galaxyproject.org) using the wrapper included in this repository.
+
+### Requirements
+
+[Docker](https://www.docker.com) should first be installed and working on the
+server where this Galaxy instance is setup. The user running Galaxy should be
+part of the **docker** user group.
+
+#### Manual installation of the wrapper from Github
+
+1. Download or clone this repository (as a submodule) in the **tools**
+   directory of the Galaxy installation.
+
+2. Update **config/tool_conf.xml** to add the VIGA wrapper in a relevant section of the tool panel. For example, "Annotation".
+
+		<section id="annotation" name="Annotation">
+			<tool file="viga/wrapper.xml" />
+		</section>
+
+3. Copy (or update the file if it is already present) the included
+   **tool_data_table_conf.xml.sample** file to
+   **config/tool_data_table_conf.xml**.
+
+		<!-- VIGA databases -->
+		<tables>
+		    <table name="viga_blastdb" comment_char="#">
+			<columns>value, dbkey, name, path</columns>
+			<file path="tool-data/viga_blastdb.loc" />
+		    </table>
+		    <table name="viga_diamonddb" comment_char="#">
+			<columns>value, dbkey, name, path</columns>
+			<file path="tool-data/viga_diamonddb.loc" />
+		    </table>
+		    <table name="viga_rfamdb" comment_char="#">
+			<columns>value, dbkey, name, path</columns>
+			<file path="tool-data/viga_rfamdb.loc" />
+		    </table>
+		    <table name="viga_hmmdb" comment_char="#">
+			<columns>value, dbkey, name, path</columns>
+			<file path="tool-data/viga_hmmdb.loc" />
+		    </table>
+		</tables>
+
+4. Copy the **.loc.sample** files from **viga/tool-data** to **galaxy/tool-data**
+   and rename them as **.loc**. For example:
+
+		viga_blastdb.loc.sample -> viga_blastdb.loc
+
+#### Update database paths in .loc files
+
+Edit the following files in the **tool-data** directory and add paths to
+corresponding databases
+
+* viga_blastdb.loc
+* viga_diamonddb.loc
+* viga_rfamdb.loc
+* viga_hmmdb.loc
+
+#### Create or update the Galaxy job configuration file
+
+If the file **config/job_conf.xml** does not exist, create it by copying the
+template **config/job_conf.xml.sample_basic** in the Galaxy directory. Then
+add a Docker destination for viga. Change ``/data/databases`` under
+``docker_volumes`` to the location where your databases are stored. Here is
+an example:
+
+	<?xml version="1.0"?>
+	<!-- A sample job config that explicitly configures job running the way it is configured by default (if there is no explicit config). -->
+	<job_conf>
+	    <plugins>
+		<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
+	    </plugins>
+	    <handlers>
+		<handler id="main"/>
+	    </handlers>
+	    <destinations default="local">
+		<destination id="local" runner="local"/>
+		<destination id="docker" runner="local">
+			<param id="docker_enabled">true</param>
+			<param id="docker_sudo">false</param>
+			<param id="docker_auto_rm">true</param>
+			<param id="docker_volumes">$defaults,/data/databases:ro</param>
+		</destination>
+	    </destinations>
+	    <tools>
+	      <tool id="viga" destination="docker"/>
+	    </tools>
+	</job_conf>
+
+
+**Restart Galaxy**. The tool will now be ready to use.
+
+
+## HISTORY OF THE SOURCE CODE:
+
+* v 0.10.3 - New output: all protein sequences per contig.
+* v 0.10.1 - Fixed error when the start coordinate of a gene is equal to one. In these cases, genes were annotated as if they started in the position zero (which it has no biological logic). Now, the program should be able to deal with these genes, annotate them from the position 1. Moreover, added new terms to reduce all non-informative protein descriptions before running the decision tree.
+* v 0.10.0 - Added the prediction of the origin and terminus of replication for circular contigs based on the cumulative GC skew (based on the iRep software - Brown et al (2016)). After detecting the origin coordinate, the chromosome is realigned from the origin. As a consequence of that, two new parameters ("--windowsize" and "--slidingsize") were added to determine the window size and the sliding window size respectively. Moreover, fixed error with the start position of the genes in the GenBank files, which were not related to the amino acid sequences and made that the sequence length was not multiple of three. Finally, added "/locus_tag" in the putative genes in the GenBank files
+* v 0.9.1 - Fixed a bug in creation of logfile
+* v 0.9.0 - Improved the BLAST/DIAMOND and HMMER parsers to reduce all non-informative protein descriptions (e.g. "hypothetical protein", "ORF") before running the decision tree algorithm. Additionally, a new output file (logfile.txt) is generated to harbour the information about the old contig names and the new ones (generated by the program).
+* v 0.8.2 - Fixed issue with DIAMOND when there is no protein sequence as input.
+* v 0.8.1 - The program is able to deal with tmRNA sequences in a proper way. There were an error due to the "(Permuted)" flag in ARAGORN files in some cases. Additionally, the name of the "--fast" and "--ultrafast" parameters were changed to "--nohmmer" and "--noblast" as their descriptions are more accurate.
+* v 0.8.0 - Added the "--ultrafast" parameter. In this case, DIAMOND (Buchfink et al. 2015) will be launch to predict protein function according to homology instead of BLAST. It is faster than the "fast" mode but the sensitivity of the annotations will not be the highest.
+* v 0.7.1 - Fixed error on the "--fast" parameter. All proteins that had no hits in BLAST analyses were not parsed properly. By now, these are identified as "Hypothetical proteins" in all files.
+* v 0.7.0 - Added the "--fast" parameter. In this case, the program will launch BLAST (but not PHMMER) to annotate protein function. In this case, the program will be as fast as Prokka (Seemann 2014) but the annotations will not be accurate. As a consequence of this new parameter, the "--hmmdb" parameter is only mandatory when this flag is NOT used (as by default).
+* v 0.6.2 - Removed the "--noparallel" parameter. After doing time benchmarks to test the speed of BLAST and HMMER when they are run using the multithreading option and as a parallel program, we found that BLAST tends to be faster using multithreading option while HMMER had the opposite behavior. For that, we decided to consider only the parallelization of HMMER and to run BLAST using multiple threads. 
+* v 0.6.1 - Fixed issue with parallel HMMER (the program tend to take all available CPUs independently of the parsed arguments) and with the BLAST/HMMER decision trees (typos).
+* v 0.6.0 - Replaced HHSUITE by HMMER 3.1 to predict protein function according to Hidden Markov Models. In a recent benchmark (as well as internal ones), we found that HHPred tends to be the slowest program to predict protein function (compared with PHMMER and BLASTP). Additionally, HMMER had a high accuracy when proteins are annotated (Saripella et al. 2016). Moreover, it has the advantage that the databases must be in FASTA format (such UniProt and, even, PFAM), which it is a standard format. For all these reasons, we replaced HHSUITE by HMMER 3.1. Additionally, fixed small issues related to the GenBank file (omission of the contig topology as well as the name of the locus).
+* v 0.5.0 - Implemented PILER-CR to predict CRISPR repeats regions. Additionally, fixed errors in the rRNA prediction and inverted and tandem repeats.
+* v 0.4.0 - Replaced RNAmmer v 1.2. by INFERNAL 1.1 + RFAM to predict rRNA in the contigs. In this case, you must specify where you have downloaded the RFAM database using the "--rfamdb" option.
+* v 0.3.0 - Implemented RNAmmer v 1.2 to predict rRNA in the contigs. If such program is able to predict ribosomal genes, a warning is printed (as viral sequences do not have ribosomal genes).
+* v 0.2.0 - Added parallelization of BLAST and HHSUITE. To do that, GNU Parallel (Tange 2011) is required. To disable this option, run the program with the "--noparallel" option.
+* v 0.1.0 - Original version of the program.
+
+## REFERENCES:
+
+	- Benson G (2008) Tandem repeats finder: a program to analyze DNA sequences. Nucleic Acids Research 27: 573–80.
+	- Brown CT, Olm MR, Thomas BC, Banfield JF (2016) Measurement of bacterial replication rates in microbial communities. Nature Biotechnology 34: 1256-63.
+	- Buchfink B, Xie C, Huson DH (2015) Fast and sensitive protein alignment using DIAMOND. Nature Methods 12: 59-60.
+	- Camacho C, Coulouris G, Avagyan V, Ma N, Papadopoulos J, Bealer K, Madden TL (2008) BLAST+: architecture and applications. BMC Bioinformatics 10: 421.
+	- Edgar RC (2007) PILER-CR: fast and accurate identification of CRISPR repeats. BMC Bioinformatics 8:18.
+	- Finn RD, Clements J, Eddy SR (2011) HMMER web server: interactive sequence similarity searching. Nucleic Acids Research 39: W29-37.
+	- Fozo EM, Makarova KS, Shabalina SA, Yutin N, Koonin EV, Storz G (2010) Abundance of type I toxin-antitoxin systems in bacteria: searches for new candidates and discovery of novel families. Nucleic Acids Research 38: 3743-59.
+	- Harris RS (2007) Improved pairwise alignment of genomic DNA. Ph.D. Thesis, The Pennsylvania State University. 
+	- Hyatt D, Chen GL, Locascio PF, Land ML, Larimer FW, Hauser LJ (2010) Prodigal: prokaryotic gene recognition and translation initiation site identification. BMC Bioinformatics 11: 119.
+	- Hyatt D, Locascio PF, Hauser LJ, Uberbacher EC (2012) Gene and translation initiation site prediction in metagenomic sequences. Bioinformatics 28: 2223-30.
+	- Laslett D, Canback B (2004) ARAGORN, a program to detect tRNA genes and tmRNA genes in nucleotide sequences. Nucleic Acids Research 32, 11–16.
+	- Nawrocki EP, Eddy SR (2013) Infernal 1.1: 100-fold faster RNA homology searches. Bioinformatics 29: 2933-35.
+	- Nawrocki EP, Burge SW, Bateman A, Daub J, Eberhardt RY, Eddy SR, Floden EW, Gardner PP, Jones TA, Tate J, Finn RD (2013) Rfam 12.0: updates to the RNA families database. Nucleic Acids Research 43: D130-7.
+	- Saripella GV, Sonnhammer EL, Forslund K (2016) Benchmarking the next generation of homology inference tools. Bioinformatics 32: 2636-41.
+	- Seemann T (2014) Prokka: rapid prokaryote genome annotation. Bioinformatics 30: 2068-9.
+	- Tange O (2011) GNU Parallel - The Command-Line Power Tool. ;login: The USENIX Magazine 36:42-7.
+	- Warburton PE, Giordano J, Cheung F, Gelfand Y, Benson G (2004) Inverted repeat structure of the human genome: The X-chromosome contains a preponderance of large, highly homologous inverted repeats that contain testes genes. Genome Research 14: 1861-9.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VIGA.py	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,997 @@
+#!/usr/bin/env python
+
+# -*- coding: utf-8 -*-
+
+# VIGA - De-novo VIral Genome Annotator
+#
+# Copyright (C) 2017 - Enrique Gonzalez-Tortuero
+#                      Vimalkumar Velayudhan
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Importing python libraries
+from __future__ import print_function
+import argparse
+import csv
+import fileinput
+import fractions
+import glob
+import numpy
+import os
+import os.path
+import re
+import sys
+import shutil
+import subprocess
+from BCBio import GFF
+from Bio import SeqIO
+from Bio import SeqFeature
+from Bio.Alphabet import IUPAC
+from Bio.Seq import Seq
+from Bio.SeqFeature import FeatureLocation
+from Bio.SeqRecord import SeqRecord
+from Bio.SeqUtils.ProtParam import ProteinAnalysis
+from collections import OrderedDict, defaultdict
+from itertools import product
+from scipy import signal
+from time import strftime
+
+# Preparing functions
+def batch_iterator(iterator, batch_size):
+	entry = True
+	while entry:
+		batch = []
+		while len(batch) < batch_size:
+			try:
+				entry = iterator.next()
+			except StopIteration:
+				entry = None
+			if entry is None:
+				break
+			batch.append(entry)
+		if batch:
+			yield batch
+
+def check_peaks(peaks, length):
+	# Checking if origin/terminus peaks are too close or too far apart. In that case, they are probably wrong
+    closest, farthest = int(length * float(0.45)), int(length * float(0.55))
+    pairs = []
+    for pair in list(product(*peaks)):
+        ### added this to make sure gets origin and ter right
+        tr, pk = sorted(list(pair), key = lambda x: x[1], reverse = False) # trough and peak
+        a = (tr[0] - pk[0]) % length
+        b = (pk[0] - tr[0]) % length
+        pt = abs(tr[1] - pk[1]) # distance between values
+        if (a <= farthest and a >= closest) or (b <=farthest and b >= closest):
+            pairs.append([pt, tr, pk])
+    if len(pairs) == 0:
+        return [False, False]
+    pt, tr, pk = sorted(pairs, reverse = True)[0]
+    return [tr[0], pk[0]]
+
+def cmd_exists(cmd):
+	return subprocess.call("type " + cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
+
+def GCskew(name, length, seq, window, slide):
+	replacements = {'G':1, 'C':-1, 'A':0, 'T':0, 'N':0}
+	gmc = [] # G - C
+	for base in seq:
+		try:
+			gmc.append(replacements[base])
+		except:
+			gmc.append(0)
+	# convert to G + C
+	gpc = [abs(i) for i in gmc] # G + C
+	# calculate sliding windows for (G - C) and (G + C)
+	weights = numpy.ones(window)/window
+	gmc = [[i, c] for i, c in enumerate(signal.fftconvolve(gmc, weights, 'same').tolist())]
+	gpc = [[i, c] for i, c in enumerate(signal.fftconvolve(gpc, weights, 'same').tolist())]
+	# calculate gc skew and cummulative gc skew sum
+	skew = [[], []] # x and y for gc skew
+	c_skew = [[], []] # x and y for gc skew cummulative sums
+	cs = 0 # cummulative sum
+	# select windows to use based on slide
+	for i, m in gmc[0::slide]:
+		p = gpc[i][1]
+		if p == 0:
+			gcs = 0
+		else:
+			gcs = m/p
+		cs += gcs
+		skew[0].append(i)
+		c_skew[0].append(i)
+		skew[1].append(gcs)
+		c_skew[1].append(cs)
+	ori, ter = find_ori_ter(c_skew, length)
+	return ori, ter, skew, c_skew
+
+def eprint(*args, **kwargs):
+	print(*args, file=sys.stderr, **kwargs)
+
+def find_ori_ter(c_skew, length):
+    # Find origin and terminus of replication based on cumulative GC skew min and max peaks
+    c_skew_min = signal.argrelextrema(numpy.asarray(c_skew[1]), numpy.less, order = 1)[0].tolist()
+    c_skew_max = signal.argrelextrema(numpy.asarray(c_skew[1]), numpy.greater, order = 1)[0].tolist()
+    # return False if no peaks were detected
+    if len(c_skew_min) == 0 or len(c_skew_min) == 0:
+        return [False, False]
+    else:
+        c_skew_min = [[c_skew[0][i], c_skew[1][i]] for i in c_skew_min]
+        c_skew_max = [[c_skew[0][i], c_skew[1][i]] for i in c_skew_max]
+        ori, ter = check_peaks([c_skew_min, c_skew_max], length)
+    return ori, ter
+
+def stringSplitByNumbers(x):
+	r = re.compile('(\d+)')
+	l = r.split(x)
+	return [int(y) if y.isdigit() else y for y in l]
+
+# Defining the program version
+version = "0.10.3"
+
+# Processing the parameters
+parser = argparse.ArgumentParser(description='VIGA is an automatic de novo VIral Genome Annotator.')
+basic_group = parser.add_argument_group('Basic options for VIGA [REQUIRED]')
+
+basic_group.add_argument("--input", dest="inputfile", type=str, required=True, help='Input file as a FASTA file', metavar="FASTAFILE")
+basic_group.add_argument("--rfamdb", dest="rfamdatabase", type=str, required=True, help='RFAM Database that will be used for the ribosomal RNA prediction. RFAMDB should be in the format "/full/path/to/rfamdb/Rfam.cm" and must be compressed accordingly (see INFERNAL manual) before running the script.', metavar="RFAMDB")
+basic_group.add_argument("--modifiers", dest="modifiers", type=str, required=True, help='Input file as a plain text file with the modifiers per every FASTA header according to SeqIn (https://www.ncbi.nlm.nih.gov/Sequin/modifiers.html). All modifiers must be written in a single line and are separated by a single space character. No space should be placed besides the = sign. For example: [organism=Serratia marcescens subsp. marcescens] [sub-species=marcescens] [strain=AH0650_Sm1] [topology=linear] [moltype=DNA] [tech=wgs] [gcode=11] [country=Australia] [isolation-source=sputum]. This line will be copied and printed along with the record name as the definition line of every contig sequence.', metavar="TEXTFILE")
+
+advanced_group = parser.add_argument_group('Advanced options for VIGA [OPTIONAL]')
+advanced_group.add_argument("--readlength", dest="read_length", type=int, default=101, help='Read length for the circularity prediction (default: 101 bp)', metavar="INT")
+advanced_group.add_argument("--windowsize", dest="window", type=int, default=100, help='Window size used to determine the origin of replication in circular contigs according to the cumulative GC skew (default: 100 bp)', metavar="INT")
+advanced_group.add_argument("--slidingsize", dest="slide", type=int, default=10, help='Window size used to determine the origin of replication in circular contigs according to the cumulative GC skew (default: 10 bp)', metavar="INT")
+advanced_group.add_argument("--out", dest="rootoutput", type=str, help='Name of the outputs files (without extension)', metavar="OUTPUTNAME")
+advanced_group.add_argument("--locus", dest="locus", type=str, default='LOC', help='Name of the sequences. If the input is a multiFASTA file, please put a general name as the program will add the number of the contig at the end of the name (Default: %(default)s)', metavar="STRING")
+advanced_group.add_argument("--gff", dest="gffprint", action='store_true', default=False, help='Printing the output as GFF3 file (Default: False)')
+advanced_group.add_argument("--threads", dest="ncpus", default=1, help='Number of threads/cpus (Default: %(default)s cpu)', metavar="INT")
+advanced_group.add_argument("--nohmmer", dest="nohmmer", action='store_true', default=False, help='Running only BLAST to predict protein function. (Default: False)')
+advanced_group.add_argument("--noblast", dest="noblast", action='store_true', default=False, help='Running DIAMOND instead of BLAST to predict protein function according to homology. This will be less sensitive but faster than BLAST. (Default: False)')
+advanced_group.add_argument("--blastdb", dest="blastdatabase", type=str, help='BLAST Database that will be used for the protein function prediction. The database must be an amino acid one, not nucleotidic. This argument is mandatory if --noblast option is disabled', metavar="BLASTDB")
+advanced_group.add_argument("--diamonddb", dest="diamonddatabase", type=str, help='DIAMOND Database that will be used for the protein function prediction. The database must be created from a amino acid FASTA file as indicated in https://github.com/bbuchfink/diamond. This argument is mandatory when --noblast option is enabled', metavar="DIAMONDDB")
+advanced_group.add_argument("--blastevalue", dest="blastevalue", default=0.00001, help='BLAST/DIAMOND e-value threshold (Default: 0.00001)', metavar="FLOAT")
+advanced_group.add_argument("--hmmdb", dest="hmmdatabase", type=str, help='PHMMER Database that will be used for the protein function prediction according to Hidden Markov Models. In this case, HMMDB must be in FASTA format (e.g. UniProt: "', metavar="HMMDB")
+advanced_group.add_argument("--hmmerevalue", dest="hmmerevalue", default=0.001, help='PHMMER e-value threshold (Default: 0.001)', metavar="FLOAT")
+
+type_choices = {'BCT': 'Prokaryotic chromosome', 'CON': 'Contig', 'PHG': 'Phages', 'VRL': 'Eukaryotic/Archaea virus'}
+type_help = ('GenBank Division: One of the following codes - {0}. (Default: %(default)s)'.format(', '.join('{0} ({1})'.format(k, v) for k, v in type_choices.items())))
+advanced_group.add_argument("--typedata", dest="typedata", type=str, default='CON', help=type_help, metavar="BCT|CON|VRL|PHG")
+
+gcode_choices = {'1': 'Standard genetic code [Eukaryotic]', '2': 'Vertebrate mitochondrial code', '3': 'Yeast mitochondrial code', '4': 'Mycoplasma/Spiroplasma and Protozoan/mold/coelenterate mitochondrial code', '5': 'Invertebrate mitochondrial code', '6': 'Ciliate, dasycladacean and hexamita nuclear code', '9': 'Echinoderm/flatworm mitochondrial code', '10': 'Euplotid nuclear code', '11': 'Bacteria/Archaea/Phages/Plant plastid', '12': 'Alternative yeast nuclear code', '13': 'Ascidian mitochondrial code', '14': 'Alternative flatworm mitochondrial code', '16': 'Chlorophycean mitochondrial code', '21': 'Trematode mitochondrial code', '22': 'Scedenesmus obliquus mitochondrial code', '23': 'Thraustochytrium mitochondrial code', '24': 'Pterobranquia mitochondrial code', '25': 'Gracilibacteria & Candidate division SR1', '26': 'Pachysolen tannophilus nuclear code', '27': 'Karyorelict nuclear code', '28': 'Condylostoma nuclear code', '29': 'Mesodinium nuclear code', '30': 'Peritrich nuclear code', '31': 'Blastocrithidia nuclear code'}
+gcode_help = ('Number of GenBank translation table. At this moment, the available options are {0}. (Default: %(default)s)'.format('{}'.format(', '.join('{0} ({1})'.format(k, v) for k, v in gcode_choices.items()))))
+advanced_group.add_argument("--gcode", dest="gcode", type=str, default='11', help=gcode_help, metavar="NUMBER")
+
+advanced_group.add_argument('--mincontigsize', dest="mincontigsize", type=int, default = 200, help = 'Minimum contig length to be considered in the final files (Default: 200 bp)', metavar="INT")
+advanced_group.add_argument("--idthr", dest="idthreshold", default=50.00, help='ID threshold (Default: 50.0)', metavar="FLOAT")
+advanced_group.add_argument("--coverthr", dest="covthreshold", default=50.00, help='Coverage threshold (Default: 50.0)', metavar="FLOAT")
+advanced_group.add_argument("--diffid", dest="diffid", default=5.00, help='Max allowed difference between the ID percentages of BLAST and HMMER. (Default = 5.00; Not recommended to change such value)', metavar="FLOAT (>0.01)")
+advanced_group.add_argument("--minrepeat", dest="minrepeat", type=int, default=16, help="Minimum repeat length for CRISPR detection (Default: 16)", metavar="INT")
+advanced_group.add_argument("--maxrepeat", dest="maxrepeat", type=int, default=64, help="Maximum repeat length for CRISPR detection (Default: 64)")
+advanced_group.add_argument("--minspacer", dest="minspacer", type=int, default=8, help="Minimum spacer length for CRISPR detection (Default: 8)")
+advanced_group.add_argument("--maxspacer", dest="maxspacer", type=int, default=64, help="Maximum spacer length for CRISPR detection (Default: 64)")
+advanced_group.add_argument("--blastexh", dest="blastexh", action='store_true', default=False, help='Use of exhaustive BLAST to predict the proteins by homology according to Fozo et al. (2010) Nucleic Acids Res (Default=FALSE)')
+
+args = parser.parse_args()
+
+root_output = args.rootoutput
+if not root_output:
+	root_output = '{}_annotated'.format(os.path.splitext(args.inputfile)[0])
+
+if args.noblast == False and args.blastdatabase == None:
+    sys.exit('You MUST specify BLAST database using the parameter --blastdb if you are not using --noblast option')
+
+if args.noblast == True and args.diamonddatabase == None:
+    sys.exit('You MUST specify DIAMOND database using the parameter --diamonddb if you are using --noblast option')
+
+if args.nohmmer == False and args.hmmdatabase == None:
+		sys.exit('You MUST specify HMMER database using the parameter --hmmdb if you are not using --nohmmer option')
+
+# Printing the header of the program 
+eprint("This is VIGA %s" % str(version))
+eprint("Written by Enrique Gonzalez Tortuero & Vimalkumar Velayudhan")
+eprint("Homepage is https://github.com/EGTortuero/virannot")
+eprint("Local time: ", strftime("%a, %d %b %Y %H:%M:%S"))
+eprint("\n\n")
+
+# checking the presence of the programs in the system
+
+if not cmd_exists("lastz")==True:
+	sys.exit("You must install LASTZ before using this script")
+elif not cmd_exists("cmscan")==True:
+	sys.exit("You must install INFERNAL before using this script")
+elif not cmd_exists("prodigal")==True:
+	sys.exit("You must install prodigal before using this script")
+elif not cmd_exists("parallel")==True:
+	sys.exit("You must install GNU Parallel before using this script")
+elif not cmd_exists("blastp")==True:
+	sys.exit("You must install BLAST before using this script")
+elif not cmd_exists("diamond")==True:
+	sys.exit("You must install DIAMOND before using this script")
+elif not cmd_exists("phmmer")==True:
+	sys.exit("You must install HMMER 3 before using this script")
+elif not cmd_exists("aragorn")==True:
+	sys.exit("You must install ARAGORN before using this script")
+elif not cmd_exists("pilercr")==True:
+	sys.exit("You must install PILERCR before using this script")
+elif not cmd_exists("trf")==True:
+	sys.exit("You must install Tandem Repeats Finder before using this script")
+elif not cmd_exists("irf")==True:
+	sys.exit("You must install Inverted Repeats Finder before using this script")
+
+eprint("Data type is {0} and GenBank translation table no is {1}\n".format(args.typedata, args.gcode))
+
+# Correcting the original file (long headers problem + multiple FASTA files)
+record_iter = SeqIO.parse(open(args.inputfile, "rU"),"fasta")
+counter = 1
+newnamessequences = {}
+for i, batch in enumerate(batch_iterator(record_iter, 1)):
+	seq_index = "CONTIG_%i" % (i + 1)
+	filename = "%s.temp.fna" % seq_index
+	newfilename = "%s.fna" % seq_index
+	with open(filename, "w") as handle:
+		count = SeqIO.write(batch, filename, "fasta")
+
+	with open(filename, "rU") as original, open(newfilename, "w") as corrected:
+		sequences = SeqIO.parse(original, "fasta", IUPAC.ambiguous_dna)
+		for record in sequences:
+			original_name = record.id
+			record.id = "%s_%i" % (args.locus, counter)
+			record.description = record.description
+			counter += 1
+			newnamessequences[record.id] = original_name
+			eprint("WARNING: The name of the sequence %s was corrected as %s" % (original_name, record.id))
+		SeqIO.write(record, corrected, "fasta")
+
+	with open("logfile.txt", "w") as logfile:
+		logfile.write("#Original\tNew\n")
+		for oldname in sorted(newnamessequences, key = stringSplitByNumbers):
+			logfile.write("%s\t%s\n" % (oldname, newnamessequences[oldname]))
+	os.remove(filename)
+
+for newfile in sorted(glob.glob("CONTIG_*.fna")):
+
+	# Predicting the shape of the contig (code based on Alex Crits-Christoph's find_circular.py script [https://github.com/alexcritschristoph/VICA/blob/master/find_circular.py])
+	eprint("Predicting the shape of the contig using LASTZ")
+	genomeshape = {}
+	with open(newfile, "rU") as targetfasta:
+		Sequence = SeqIO.parse(newfile, "fasta")
+		for record in Sequence:
+			seq_beginning = str(record.seq[0:args.read_length])
+			seq_ending = str(record.seq[len(record.seq)-args.read_length:len(record.seq)])
+			combined_seqs = SeqRecord(Seq(seq_beginning + seq_ending, IUPAC.ambiguous_dna), id = record.description)
+			SeqIO.write(combined_seqs, "temporal_circular.fasta", "fasta")
+			outputlastz = subprocess.check_output(["lastz", "temporal_circular.fasta", "--self", "--notrivial", "--nomirror", "--format=general-:start1,end1,start2,end2,score,strand1,strand2,identity,length1"])
+			resultslastz = outputlastz.split("\n")
+			for resultlastz in resultslastz:
+				if resultlastz != '':
+					start1 = resultlastz.split()[0]
+					end1 = resultlastz.split()[1]
+					start2 = resultlastz.split()[2]
+					end2 = resultlastz.split()[3]
+					strand1 = resultlastz.split()[5]
+					strand2 = resultlastz.split()[6]
+					identity = resultlastz.split()[7]
+					length = int(resultlastz.split()[9])
+					if strand1 == strand2 and length > 0.4 * args.read_length and float(fractions.Fraction(identity)) > 0.95 and int(start1) < 5 and int(start2) > args.read_length and int(end1) < args.read_length and int(end2) > args.read_length * 2 * 0.9:
+						genomeshape['genomeshape'] = "circular"
+						try:
+							if genomeshape['identity'] >= float(fractions.Fraction(identity)):
+								genomeshape['identity'] = float(fractions.Fraction(identity))
+								genomeshape['length'] = length
+						except KeyError:
+							genomeshape['identity'] = float(fractions.Fraction(identity))
+							genomeshape['length'] = length
+					else:
+						continue
+					if strand1 == strand2 and length > 0.4 * args.read_length and float(fractions.Fraction(identity)) > 0.95 and int(start1) < 5 and int(start2) > args.read_length and int(end1) < args.read_length and int(end2) > args.read_length * 2 * 0.9:
+						genomeshape['genomeshape'] = "circular"
+						try:
+							if genomeshape['identity'] >= float(fractions.Fraction(identity)):
+								genomeshape['identity'] = float(fractions.Fraction(identity))
+								genomeshape['length'] = length
+						except KeyError:
+							genomeshape['identity'] = float(fractions.Fraction(identity))
+							genomeshape['length'] = length
+			try:
+				if genomeshape['genomeshape'] == "":
+						genomeshape['genomeshape'] = "linear"
+			except KeyError:
+				genomeshape['genomeshape'] = "linear"
+			else:
+				genomeshape['genomeshape'] = "circular"
+				with open("temp.fasta", "w") as correctedcircular:
+					Corrseq = str(record.seq[int(genomeshape['length'])//2:-int(genomeshape['length'])//2])
+					Newseq = SeqRecord(Seq(Corrseq, IUPAC.ambiguous_dna), id = record.description)
+					SeqIO.write(Newseq, correctedcircular, "fasta")
+				os.rename("temp.fasta", "temp2.fasta")
+		eprint("LASTZ predicted that %s is %s\n" % (newfile, genomeshape['genomeshape']))
+		os.remove("temporal_circular.fasta")
+
+	# Calculate the cumulative GCskew in circular contigs to determine the origin of replication (Based on iRep -- Brown CT, Olm MR, Thomas BC, Banfield JF (2016) Measurement of bacterial replication rates in microbial communities. Nature Biotechnology 34: 1256-63.)
+	if genomeshape['genomeshape'] == "circular":
+		for record in SeqIO.parse("temp2.fasta", "fasta"):
+			length_contig = len(record.seq)
+			#if length < min_len:
+			#    print('%s: Too Short' % (name), file=sys.stderr)
+			#    continue
+			oric, term, gcskew, cgcskew = GCskew(record.id, length_contig, record.seq, args.window, args.slide)
+			valoric = oric
+			if oric == False:
+				oric, term = 'n/a', 'n/a'
+			else:
+				oric, term = '{:,}'.format(oric), '{:,}'.format(term)
+			eprint('%s -> Origin: %s Terminus: %s' % (record.id, oric, term))
+			#print('\t'.join(['# Name', 'Position', 'GC Skew', 'Cumulative GC Skew']))
+			#for i, pos in enumerate(gcskew[0]):
+			#	out = [record.id, pos, gcskew[1][i], cgcskew[1][i]]
+			#	print('\t'.join([str(i) for i in out]))
+			if valoric != False:
+				firstpartseq = str(record.seq[valoric:-1])
+				secondpartseq = str(record.seq[0:(valoric-1)])
+				combinedcorrectedseq = SeqRecord(Seq(firstpartseq + secondpartseq, IUPAC.ambiguous_dna), id = record.description)
+				SeqIO.write(combinedcorrectedseq, newfile, "fasta")
+			else:
+				eprint("As the program was unable to predict the origin of replication, %s was considered as is without correcting!" % record.id)
+				os.rename("temp2.fasta", newfile)
+		if os.path.isfile("temp2.fasta"):
+			os.remove("temp2.fasta")
+
+	# Predicting genes using PRODIGAL
+	eprint("\nRunning Prodigal to predict the genes in %s" % newfile)
+	for record in SeqIO.parse(newfile, "fasta"):
+		length_contig = len(record.seq)
+		if (length_contig >= 100000):
+			if genomeshape['genomeshape'] == 'linear':
+				subprocess.call(["prodigal", "-a", "pretemp.faa", "-i", newfile, "-o", "/dev/null", "-g", args.gcode, "-c", "-q"])
+			else:
+				subprocess.call(["prodigal", "-a", "pretemp.faa", "-i", newfile, "-o", "/dev/null", "-g", args.gcode, "-q"])
+		else:
+			if genomeshape['genomeshape'] == 'linear':
+				subprocess.call(["prodigal", "-a", "pretemp.faa", "-i", newfile, "-o", "/dev/null", "-p", "meta", "-g", args.gcode, "-c", "-q"])
+			else:
+				subprocess.call(["prodigal", "-a", "pretemp.faa", "-i", newfile, "-o", "/dev/null", "-p", "meta", "-g", args.gcode, "-q"])
+	num_seqs = len(list(SeqIO.parse("pretemp.faa", "fasta")))
+	eprint("PRODIGAL was able to predict %i genes in %s\n" % (num_seqs, newfile))
+	
+	with open("pretemp.faa", "rU") as originalfaa, open("temp.faa", "w") as correctedfaa:
+		sequences = SeqIO.parse(originalfaa, "fasta")
+		for record in sequences:
+			record.seq = record.seq.rstrip("*")
+			SeqIO.write(record, correctedfaa, "fasta")
+			
+	faa_file = "%s.faa" % newfile # TO DEBUG
+	shutil.copyfile("temp.faa", faa_file) # TO DEBUG
+	os.remove("pretemp.faa")
+
+	# Predicting the function of the proteins based on homology using BLAST
+	equivalence = {}
+	record_iter = SeqIO.parse(open("temp.faa"),"fasta")
+	for i, batch in enumerate(batch_iterator(record_iter, 1)):
+		seq_index = "SEQ_%i" % (i + 1)
+		filename = "%s.faa" % seq_index
+		with open(filename, "w") as handle:
+			count = SeqIO.write(batch, handle, "fasta")
+			equivalence[seq_index] = batch[0].id
+
+	if args.blastexh==True:
+		eprint("Running BLAST to predict the genes according to homology inference in %s using exhaustive mode (see Fozo et al. (2010) Nucleic Acids Res for details)" % newfile)
+		subprocess.call(['blastp', '-query', "temp.faa", '-db', args.blastdatabase, '-evalue', str(args.blastevalue), '-outfmt', '6 qseqid sseqid pident length qlen slen qstart qend evalue bitscore stitle', '-out', 'temp_blast.csv', '-max_target_seqs', '10', '-word_size', '2', '-gapopen', '8', '-gapextend', '2', '-matrix', '"PAM70"', '-comp_based_stats', '"0"', "-num_threads", str(args.ncpus)])
+		eprint("Done. BLAST was done to predict the genes by homology\n")
+		blast_log = "%s.blast.log" % newfile # TO DEBUG
+		shutil.copyfile("temp_blast.csv", blast_log) # TO DEBUG
+	elif args.noblast==True:
+		eprint("Running DIAMOND to predict the genes according to homology inference in %s using default parameters" % newfile)
+		with open("temp.faa", "r") as tempfile:
+			first_line = tempfile.readline()
+			if first_line.startswith(">"):
+				subprocess.call(['diamond', 'blastp', '-q', 'temp.faa', '-d', args.diamonddatabase, '-e', str(args.blastevalue), '-f', '6', 'qseqid', 'sseqid', 'pident', 'length', 'qlen', 'slen', 'qstart', 'qend', 'evalue', 'bitscore', 'stitle', '-o', 'temp_blast.csv', '-k', '10', "-p", str(args.ncpus), '--quiet'])
+			else:
+				open("temp_blast.csv", 'a').close()
+		blast_log = "%s.blast.log" % newfile # TO DEBUG
+		shutil.copyfile("temp_blast.csv", blast_log) # TO DEBUG
+		eprint("Done. DIAMOND was done to predict the genes by homology\n")
+	else:
+		eprint("Running BLAST to predict the genes according to homology inference in %s using default parameters" % newfile)
+		subprocess.call(['blastp', '-query', "temp.faa", '-db', args.blastdatabase, '-evalue', str(args.blastevalue), '-outfmt', '6 qseqid sseqid pident length qlen slen qstart qend evalue bitscore stitle', '-out', 'temp_blast.csv', '-max_target_seqs', '10', "-num_threads", str(args.ncpus)])
+		blast_log = "%s.blast.log" % newfile
+		shutil.copyfile("temp_blast.csv", blast_log) # TO DEBUG
+		eprint("Done. BLAST was done to predict the genes by homology\n") # TO DEBUG
+
+	# Parsing the results from BLAST
+	with open("temp_blast.csv", "rU") as blastresults:
+		hypotheticalpat = re.compile(r'(((((?i)hypothetical)|(?i)uncharacteri(z|s)ed|(?i)predicted)) protein)|((?i)ORF|((?i)unnamed protein product|(?i)gp\d+))')
+		reader = csv.DictReader(blastresults, delimiter='\t', fieldnames=['qseqid','sseqid','pident','length','qlen','slen','qstart','qend','evalue','bitscore','stitle'])
+		information_proteins_blast = {}
+		for row in reader:
+			perc_cover = round(100.00*(float(row['length'])/float(row['qlen'])),2)
+			perc_id = float(row['pident'])
+			infoprot_blast = {}
+			infoprot_blast['sseqid'] = row['sseqid']
+			infoprot_blast['pident'] = perc_id
+			infoprot_blast['pcover'] = perc_cover
+			infoprot_blast['evalue'] = row['evalue']
+			infoprot_blast['descr'] = row['stitle']
+			try:
+				data = information_proteins_blast[row['qseqid']]
+			except KeyError:
+				if not re.search(hypotheticalpat, infoprot_blast['descr']) and float(perc_id) >= float(args.idthreshold) and float(perc_cover) >= float(args.covthreshold) and float(row['evalue']) <= float(args.blastevalue):
+						information_proteins_blast[row['qseqid']] = infoprot_blast
+				else:
+					continue
+			else:
+				if not re.search(hypotheticalpat, infoprot_blast['descr']) and float(perc_id) >= float(args.idthreshold) and float(perc_id) >= float(infoprot_blast['pident']) and float(perc_cover) >= float(args.covthreshold) and float(perc_cover) >= float(infoprot_blast['pcover']) and float(row['evalue']) <= float(args.blastevalue):
+						information_proteins_blast[row['qseqid']] = infoprot_blast
+
+	## Predicting the function of the proteins based on HMM predictions using phmmer
+	if args.nohmmer == False:
+		with open("commands.sh", "w") as commands:
+			for singleprot in sorted(glob.glob("SEQ_*.faa")):
+				hhmtable = "%s.tbl" % singleprot
+				eprint("Creating file to run parallel PHMMER")
+				eprint("Adding %s to run PHMMER." % singleprot)
+				line2write = ' '.join(["phmmer", "--cpu", "1", "--domtblout", hhmtable, "-E", str(args.hmmerevalue), "-o", "/dev/null", singleprot, args.hmmdatabase, '\n'])
+				commands.write(line2write)
+
+		eprint("Running parallel PHMMER")
+		subprocess.call(['parallel', '-j', str(args.ncpus)], stdin=open('commands.sh'))
+		eprint("Done. PHMMER was done to predict the function of the genes according to Hidden Markov Models\n")
+		os.remove("commands.sh")
+
+		# Parsing the results from HMMER
+		information_proteins_hmmer = {}
+		hypotheticalpat = re.compile(r'(((((?i)hypothetical)|(?i)uncharacteri(z|s)ed|(?i)predicted)) protein)|((?i)ORF|((?i)unnamed protein product|(?i)gp\d+))')
+		for singletbl in sorted(glob.glob("*.faa.tbl")):
+			rootname = singletbl.replace(".faa.tbl", "")
+			with open(singletbl) as tblfile:
+				infoprot_hmmer = {}
+				for line in tblfile:
+					if line.startswith("#"):
+						continue
+					else:
+						try:
+							pat = re.compile("^(\S+)\s+\S\s+\d+\s+(\S+)\s+\S\s+(\d+)\s+((?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)\s+\S+\s+\S+\s+\S+\s+\S+\s+(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?\s+\S+\s+\S+\s+\S+\s+(\d+)\s+(\d+)\s+\d+\s+\d+\s+\S+\s+\S+\s+(\S+)\s+(.*)")
+							matchname, lociname, length, evaluehh, start, end, pident, description = re.match(pat, line).groups()
+						except AttributeError:
+							continue
+						else:
+							length = float(length)
+							pident = 100.00*float(pident)
+							protarea = 100.00*(((float(end)-1.00) - (float(start)-1.00))/length)
+							try:
+								data2 = infoprot_hmmer['lociname']
+							except KeyError:
+								if not re.search(hypotheticalpat, description) and float(protarea) >= float(args.covthreshold) and float(evaluehh) <= float(args.hmmerevalue) and float(pident) >= 50.00:
+									infoprot_hmmer['lociname'] = lociname
+									infoprot_hmmer['name'] = matchname
+									infoprot_hmmer['evalue'] = float(evaluehh)
+									infoprot_hmmer['pcover'] = float(protarea)
+									infoprot_hmmer['pident'] = float(pident)
+									infoprot_hmmer['descr'] = description
+								else:
+									try:
+										if not re.search(hypotheticalpat, description) and float(protarea) >= float(args.covthreshold) and float(evaluehh) <= float(args.hmmerevalue) and float(pident) >= 50.00 and float(pident) >= infoprot_hmmer['pident']:
+											infoprot_hmmer['lociname'] = lociname
+											infoprot_hmmer['name'] = matchname
+											infoprot_hmmer['evalue'] = float(evaluehh)
+											infoprot_hmmer['pcover'] = float(protarea)
+											infoprot_hmmer['pident'] = float(pident)
+											infoprot_hmmer['descr'] = description
+									except KeyError:
+											continue
+							else:
+								if not re.search(hypotheticalpat, description) and float(protarea) >= float(args.covthreshold) and float(evaluehh) <= float(args.hmmerevalue) and float(pident) >= 50.00 and float(pident) >= infoprot_hmmer['pident']:
+									infoprot_hmmer['lociname'] = lociname
+									infoprot_hmmer['name'] = matchname
+									infoprot_hmmer['evalue'] = float(evaluehh)
+									infoprot_hmmer['pcover'] = float(protarea)
+									infoprot_hmmer['pident'] = float(pident)
+									infoprot_hmmer['descr'] = description
+				information_proteins_hmmer[rootname] = infoprot_hmmer
+
+	#Storing protein information in memory
+	with open("temp.faa", "rU") as protsfile:
+		tempprotsdict = {}
+		for protseq in SeqIO.parse(protsfile, "fasta"):
+			tempindprot = {}
+			dataprot = protseq.description.split(' # ')
+			modseq = str(protseq.seq).replace("X","") # Removing all ambiguous amino acids to avoid problems with ProteinAnalysis module
+			analysed_seq = ProteinAnalysis(modseq)
+			tempindprot['length'] = len(protseq.seq)
+			tempindprot['isoelectricpoint'] = analysed_seq.isoelectric_point()
+			tempindprot['molweightkda'] = analysed_seq.molecular_weight()/1000.00
+			tempindprot['instability'] = analysed_seq.instability_index()
+			tempindprot['protein_id'] = dataprot[0]
+			tempindprot['strand'] = int(dataprot[3])
+			tempindprot['begin'] = int(dataprot[1])-1
+			tempindprot['end'] = int(dataprot[2])
+			tempprotsdict[dataprot[0]] = tempindprot
+
+	# Creation of table
+	debugtable = "%s.csv" % newfile
+	with open(debugtable, "w") as tablefile:
+		if args.nohmmer == False:
+			print("\t".join(["Identifier", "Start", "Stop", "Strand", "size_aa", "pI", "Mol_weight_kDa", "Instability_index", "ID_BLAST", "Descr_BLAST", "evalue_BLAST", "%ID_BLAST", "%Cover_BLAST", "ID_HMMER", "Descr_HMMER", "evalue_HMMER", "%ID_HMMER", "%Cover_HMMER"]), file=tablefile)
+			keylist = information_proteins_hmmer.keys()
+			keylist.sort()
+			for keyB in keylist:
+				keyB = keyB.replace(".faa.tbl", "")
+				try:
+					print("\t".join([equivalence[keyB], str(tempprotsdict[equivalence[keyB]]['begin']), str(tempprotsdict[equivalence[keyB]]['end']), str(tempprotsdict[equivalence[keyB]]['strand']), str(tempprotsdict[equivalence[keyB]]['length']), str(tempprotsdict[equivalence[keyB]]['isoelectricpoint']), str(tempprotsdict[equivalence[keyB]]['molweightkda']), str(tempprotsdict[equivalence[keyB]]['instability']), information_proteins_blast[equivalence[keyB]]['sseqid'], information_proteins_blast[equivalence[keyB]]['descr'], str(information_proteins_blast[equivalence[keyB]]['evalue']), str(information_proteins_blast[equivalence[keyB]]['pident']), str(information_proteins_blast[equivalence[keyB]]['pcover']), information_proteins_hmmer[keyB]['name'], information_proteins_hmmer[keyB]['descr'], str(information_proteins_hmmer[keyB]['evalue']), str(information_proteins_hmmer[keyB]['pident']), str(information_proteins_hmmer[keyB]['pcover'])]), file=tablefile)
+				except KeyError:
+					try:
+						print("\t".join([equivalence[keyB], str(tempprotsdict[equivalence[keyB]]['begin']), str(tempprotsdict[equivalence[keyB]]['end']), str(tempprotsdict[equivalence[keyB]]['strand']), str(tempprotsdict[equivalence[keyB]]['length']), str(tempprotsdict[equivalence[keyB]]['isoelectricpoint']), str(tempprotsdict[equivalence[keyB]]['molweightkda']), str(tempprotsdict[equivalence[keyB]]['instability']), information_proteins_blast[equivalence[keyB]]['sseqid'], information_proteins_blast[equivalence[keyB]]['descr'], str(information_proteins_blast[equivalence[keyB]]['evalue']), str(information_proteins_blast[equivalence[keyB]]['pident']), str(information_proteins_blast[equivalence[keyB]]['pcover']), "None", "None", "NA", "NA", "NA"]), file=tablefile)
+					except KeyError:
+						try:
+							print("\t".join([equivalence[keyB], str(tempprotsdict[equivalence[keyB]]['begin']), str(tempprotsdict[equivalence[keyB]]['end']), str(tempprotsdict[equivalence[keyB]]['strand']), str(tempprotsdict[equivalence[keyB]]['length']), str(tempprotsdict[equivalence[keyB]]['isoelectricpoint']), str(tempprotsdict[equivalence[keyB]]['molweightkda']), str(tempprotsdict[equivalence[keyB]]['instability']), "None", "None", "NA", "NA", "NA", information_proteins_hmmer[keyB]['name'], information_proteins_hmmer[keyB]['descr'], str(information_proteins_hmmer[keyB]['evalue']), str(information_proteins_hmmer[keyB]['pident']), str(information_proteins_hmmer[keyB]['pcover'])]), file=tablefile)
+						except KeyError:
+							print("\t".join([equivalence[keyB], str(tempprotsdict[equivalence[keyB]]['begin']), str(tempprotsdict[equivalence[keyB]]['end']), str(tempprotsdict[equivalence[keyB]]['strand']), str(tempprotsdict[equivalence[keyB]]['length']), str(tempprotsdict[equivalence[keyB]]['isoelectricpoint']), str(tempprotsdict[equivalence[keyB]]['molweightkda']), str(tempprotsdict[equivalence[keyB]]['instability']), "None", "None", "NA", "NA", "NA",  "None", "None", "NA", "NA", "NA"]), file=tablefile)
+		else:
+			print("\t".join(["Identifier", "Start", "Stop", "Strand", "size_aa", "pI", "Mol_weight_kDa", "Instability_index", "ID_BLAST", "Descr_BLAST", "evalue_BLAST", "%ID_BLAST", "%Cover_BLAST"]), file=tablefile)
+			keylist = equivalence.values()
+			keylist.sort()
+			for keyB in keylist:
+				try:
+					print("\t".join([keyB, str(tempprotsdict[keyB]['begin']), str(tempprotsdict[keyB]['end']), str(tempprotsdict[keyB]['strand']), str(tempprotsdict[keyB]['length']), str(tempprotsdict[keyB]['isoelectricpoint']), str(tempprotsdict[keyB]['molweightkda']), str(tempprotsdict[keyB]['instability']), information_proteins_blast[keyB]['sseqid'], information_proteins_blast[keyB]['descr'], str(information_proteins_blast[keyB]['evalue']), str(information_proteins_blast[keyB]['pident']), str(information_proteins_blast[keyB]['pcover'])]), file=tablefile)
+				except KeyError:
+					print("\t".join([keyB, str(tempprotsdict[keyB]['begin']), str(tempprotsdict[keyB]['end']), str(tempprotsdict[keyB]['strand']), str(tempprotsdict[keyB]['length']), str(tempprotsdict[keyB]['isoelectricpoint']), str(tempprotsdict[keyB]['molweightkda']), str(tempprotsdict[keyB]['instability']), "None", "None", "NA", "NA", "NA"]), file=tablefile)
+
+	# Algorithm of decisions (which one: BLAST/HMMER?)
+	multipleprots = {}
+	Hypotheticalpat = re.compile(r'(((((?i)hypothetical)|(?i)uncharacteri(z|s)ed|(?i)predicted)) protein)|((?i)ORF|((?i)unnamed protein product|(?i)gp\d+))')
+	if args.nohmmer == False:
+		keylist = information_proteins_hmmer.keys()
+		keylist.sort()
+		for keyB in keylist:
+			keyB = keyB.replace(".faa.tbl", "")
+			singleprot = {}
+			singleprot['name'] = equivalence[keyB]
+			if (equivalence[keyB] in information_proteins_blast) and (keyB in information_proteins_hmmer):
+				if re.search(Hypotheticalpat, information_proteins_blast[equivalence[keyB]]['descr']):
+					try:
+						if re.search(Hypotheticalpat, information_proteins_hmmer[keyB]['descr']):
+							singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+						else:
+							singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+					except KeyError:
+						singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+				else:
+					try:
+						if (float(information_proteins_blast[equivalence[keyB]]['pident'])>float(information_proteins_hmmer[keyB]['pident'])) and (float(information_proteins_blast[equivalence[keyB]]['pcover'])>float(information_proteins_hmmer[keyB]['pcover'])):
+							singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+						elif (float(information_proteins_blast[equivalence[keyB]]['pident'])<float(information_proteins_hmmer[keyB]['pident'])) and (float(information_proteins_blast[equivalence[keyB]]['pcover'])<float(information_proteins_hmmer[keyB]['pcover'])):
+							singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+						elif (float(information_proteins_blast[equivalence[keyB]]['pident'])>float(information_proteins_hmmer[keyB]['pident'])) and (float(information_proteins_blast[equivalence[keyB]]['pcover'])<float(information_proteins_hmmer[keyB]['pcover'])):
+							if (float(information_proteins_blast[equivalence[keyB]]['pident'])-float(information_proteins_hmmer[keyB]['pident']) >= args.diffid):
+								singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+							else:
+								singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+						else:
+							if (float(information_proteins_hmmer[keyB]['pident'])-float(information_proteins_blast[equivalence[keyB]]['pident']) >= args.diffid):
+								singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+							else:
+								singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+					except KeyError:
+						try:
+							if (float(information_proteins_blast[equivalence[keyB]]['pcover'])>float(information_proteins_hmmer[keyB]['pcover'])):
+								singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+							else:
+								singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+						except KeyError:
+							singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+			elif equivalence[keyB] in information_proteins_blast:
+				singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+			elif keyB in information_proteins_hmmer:
+				try:
+					singleprot['descr'] = information_proteins_hmmer[keyB]['descr']
+				except KeyError:
+					singleprot['descr'] = 'Hypothetical protein'
+			else:
+				singleprot['descr'] = information_proteins_blast[equivalence[keyB]]['descr']
+			multipleprots[keyB] = singleprot
+	else:
+		keylist = equivalence.values()
+		keylist.sort()
+		for keyB in keylist:
+			singleprot = {}
+			singleprot['name'] = keyB
+			try:
+				if information_proteins_blast[keyB]['descr'] == None:
+					singleprot['descr'] = 'Hypothetical protein'
+				elif re.search(Hypotheticalpat, information_proteins_blast[keyB]['descr']):
+					singleprot['descr'] = 'Conserved hypothetical protein'
+				else:
+					singleprot['descr'] = information_proteins_blast[keyB]['descr']
+			except KeyError:
+				singleprot['descr'] = 'Hypothetical protein'
+			multipleprots[keyB] = singleprot
+
+	#Storing protein information in memory
+	with open("temp.faa", "rU") as protsfile:
+		protsdict = {}
+		for protseq in SeqIO.parse(protsfile, "fasta"):
+			indprot = {}
+			dataprot = protseq.description.split(' # ')
+			indprot['translation'] = protseq.seq
+			indprot['protein_id'] = dataprot[0]
+			indprot['strand'] = int(dataprot[3])
+			indprot['begin'] = int(dataprot[1])-1
+			indprot['end'] = int(dataprot[2])
+			for keyOmega in sorted(multipleprots):
+				if multipleprots[keyOmega]['name'] == dataprot[0]:
+					indprot['product'] = multipleprots[keyOmega]['descr']
+			protsdict[dataprot[0]] = indprot
+
+	# Predicting the rRNA sequences
+	with open(newfile, "rU") as targetfasta, open("/dev/null", "w") as apocalypse:
+		eprint("Running INFERNAL+RFAM to predict rRNA-like sequences in %s" % newfile)
+		subprocess.call(["cmscan", "--rfam", "--cut_ga", "--nohmmonly", "--tblout", "rrnafile.csv", "--cpu", args.ncpus, args.rfamdatabase, newfile], stdout=apocalypse)
+
+	#Storing rRNA information in memory
+	with open("rrnafile.csv", "rU") as rrnafile:
+		namedict = {"SSU_rRNA_archaea": "16s_rRNA", "SSU_rRNA_bacteria": "16s_rRNA", "SSU_rRNA_eukarya": "18s_rRNA", "SSU_rRNA_microsporidia": "16s_rRNA", "LSU_rRNA_archaea": "23s_rRNA", "LSU_rRNA_bacteria": "23s_rRNA", "LSU_rRNA_eukarya": "28s_rRNA", "5S_rRNA": "5s_rRNA"}
+		rRNAdict = defaultdict(list)
+		for line in rrnafile:
+			if not line.startswith("#"):
+				InfoLINE = re.sub("\s+", ",", line)
+				line_splitted = InfoLINE.split(",")
+				item_type = line_splitted[0]
+				if item_type.startswith(('LSU', 'SSU', '5S')):
+					strand = 0
+					if line_splitted[9] == "+":
+						strand = 1
+					else:
+						strand = -1
+					rRNAdict[item_type].append({'score': float(line_splitted[14]), 'product': namedict[line_splitted[0]], 'begin': int(line_splitted[7]), 'end': int(line_splitted[8]), 'strand': strand})
+
+		subunits = {'LSU': {'max_score': 0 }, 'SSU': {'max_score': 0 }, '5S': {'max_score': 0 }}
+		for type_rRNA, rRNA_data in rRNAdict.items():
+			max_score = max([item['score'] for item in rRNAdict[type_rRNA]])
+			for item in ('LSU', 'SSU'):
+				if type_rRNA.startswith(item):
+					if max_score > subunits[item]['max_score']:
+						subunits[item]['listdata'] = rRNA_data
+						subunits[item]['max_score'] = max_score
+			if type_rRNA.startswith('5S'):
+				subunits['5S']['listdata'] = rRNA_data			
+				subunits['5S']['max_score'] = max_score
+		
+		for rRNA in subunits:
+			i = 0
+			try:
+				lengthlist = len(subunits[rRNA]['listdata'])
+			except KeyError:
+				continue
+			else:
+				while i < lengthlist:
+					eprint("%s harbours a %s from %i to %i" % (newfile, subunits[rRNA]['listdata'][i]['product'], int(subunits[rRNA]['listdata'][i]['begin']), int(subunits[rRNA]['listdata'][i]['end'])))
+					i += 1
+
+	# Predicting the tRNA sequences
+	eprint("Running ARAGORN to predict tRNA-like sequences in %s" % newfile)
+	genetictable = "-gc%s" % str(args.gcode)
+	with open("trnafile.fasta", "w") as trnafile:
+		if genomeshape['genomeshape'] == "circular":
+			subprocess.call(["aragorn", "-c", "-fon", genetictable, newfile], stdout=trnafile)
+		else:
+			subprocess.call(["aragorn", "-l", "-fon", genetictable, newfile], stdout=trnafile)
+	num_tRNA = len(list(SeqIO.parse("trnafile.fasta", "fasta")))
+	eprint("ARAGORN was able to predict %i tRNAs in %s\n" % (num_tRNA, newfile))
+
+	#Storing tRNA and tmRNA information in memory
+	with open("trnafile.fasta", "rU") as trnafile:
+		tRNAdict = {}
+		tmRNAdict = {}
+		for tRNAseq in SeqIO.parse(trnafile, "fasta"):
+			indtRNA = {}
+			indtmRNA = {}
+			tRNA_information = tRNAseq.description.split(" ")
+			tRNApat = re.compile("^tRNA-")
+			if tRNA_information[1] == "tmRNA":
+				if str(tRNA_information[2]) == "(Permuted)":
+					indtmRNA['product'] = "tmRNA"
+					tmRNA_coords = str(tRNA_information[3])
+					Beginningrevcomppat = re.compile("^c")
+					if re.match(Beginningrevcomppat, tmRNA_coords):
+						indtmRNA['strand'] = -1
+						tmRNA_coords = tmRNA_coords.replace("c[","").replace("]","").split(",")
+					else:
+						indtmRNA['strand'] = 1
+						tmRNA_coords = tmRNA_coords.replace("[","").replace("]","").split(",")
+					indtmRNA['begin'] = int(tmRNA_coords[0])
+					indtmRNA['end'] = int(tmRNA_coords[1])
+					tmRNAdict[tRNAseq.id] = indtmRNA
+				else:
+					indtmRNA['product'] = "tmRNA"
+					tmRNA_coords = str(tRNA_information[2])
+					Beginningrevcomppat = re.compile("^c")
+					if re.match(Beginningrevcomppat, tmRNA_coords):
+						indtmRNA['strand'] = -1
+						tmRNA_coords = tmRNA_coords.replace("c[","").replace("]","").split(",")
+					else:
+						indtmRNA['strand'] = 1
+						tmRNA_coords = tmRNA_coords.replace("[","").replace("]","").split(",")
+					indtmRNA['begin'] = int(tmRNA_coords[0])
+					indtmRNA['end'] = int(tmRNA_coords[1])
+					tmRNAdict[tRNAseq.id] = indtmRNA
+			elif re.match(tRNApat, tRNA_information[1]):
+				indtRNA['product'] = re.sub("\(\w{3}\)", "",  tRNA_information[1])
+				tRNA_coords = tRNA_information[2]
+				Beginningrevcomppat = re.compile("^c")
+				if re.match(Beginningrevcomppat, tRNA_coords):
+					indtRNA['strand'] = -1
+					tRNA_coords = tRNA_coords.replace("c[","").replace("]","").split(",")
+				else:
+					indtRNA['strand'] = 1
+					tRNA_coords = tRNA_coords.replace("[","").replace("]","").split(",")
+				indtRNA['begin'] = int(tRNA_coords[0])
+				indtRNA['end'] = int(tRNA_coords[1])
+				tRNAdict[tRNAseq.id] = indtRNA
+
+	#Predicting CRISPR repeats and others
+	eprint("Running PILERCR to predict CRISPR repeats in %s" % newfile)
+	subprocess.call(["pilercr", "-in", newfile, "-out", "crisprfile.txt", "-noinfo", "-minrepeat", str(args.minrepeat), "-maxrepeat", str(args.maxrepeat), "-minspacer", str(args.minspacer), "-maxspacer", str(args.maxspacer)])
+	eprint("Predicting repeats in the sequences using TRF and IRF")
+	with open("/dev/null", "w") as stderr:
+		subprocess.call(["trf", newfile, "2", "7", "7", "80", "10", "50", "500", "-h"], stderr=stderr)
+		os.rename("%s.2.7.7.80.10.50.500.dat" % newfile, "trf_temp.dat")
+	with open("/dev/null", "w") as stderr:
+		subprocess.call(["irf", newfile, "2", "3", "5", "80", "10", "40", "500000", "10000", "-d", "-h"], stderr=stderr)
+		os.rename("%s.2.3.5.80.10.40.500000.10000.dat" % newfile, "irf_temp.dat")
+
+	# Storing CRISPR repeats information
+	information_CRISPR = {}
+	with open("crisprfile.txt", "rU") as crisprfile:
+		for line in crisprfile:
+			if "SUMMARY BY POSITION" in line:
+				for line in crisprfile:
+					information_crispr_repeat = {}
+					try:
+						patC = re.compile('^\s+(\d+)\s+.{16}\s+(\d+)\s+(\d+)\s+\d+\s+\d+\s+\d+\s+\d?\s+(\w+)')
+						key, start, length, seq = re.match(patC, line).groups()
+					except AttributeError:
+						continue
+					else:
+						information_crispr_repeat['start'] = start
+						information_crispr_repeat['end'] = int(start) + int(length)
+						information_crispr_repeat['repeatseq'] = seq
+						information_crispr_repeat['repeatend'] = int(start) + len(seq)
+						information_CRISPR[key] = information_crispr_repeat
+
+	# Storing tandem repeats information
+	information_TRF = {}
+	count = 1
+	with open("trf_temp.dat", "rU") as trfile:
+		for line in trfile:
+			information_tandem_repeat = {}
+			try:
+				patT = re.compile('^(\d+)\s(\d+)\s\d+\s\d+\.\d+\s')
+				start, end = re.match(patT, line).groups()
+			except AttributeError:
+				continue
+			else:
+				information_tandem_repeat['start'] = start
+				information_tandem_repeat['end'] = end
+				information_TRF[count] = information_tandem_repeat
+				count += 1
+
+	# Storing inverted repeats information
+	information_IRF = {}
+	count = 1
+	with open("irf_temp.dat", "rU") as irfile:
+		for line in irfile:
+			information_inverted_repeat = {}
+			try:
+				patI = re.compile('^(\d+)\s(\d+)\s\d+\s\d+\s\d+')
+				start, end = re.match(patI, line).groups()
+			except AttributeError:
+				continue
+			else:
+				information_inverted_repeat['start'] = start
+				information_inverted_repeat['end'] = end
+				information_IRF[count] = information_inverted_repeat
+				count += 1
+
+	# Creating a new Genbank and GFF file
+	eprint("Creating the output files")
+	newtempgbk = "%s.temp.gbk" % newfile
+	with open(newfile, "rU") as basefile, open(newtempgbk, "w"):
+		for record in SeqIO.parse(basefile, "fasta", IUPAC.ambiguous_dna):
+			whole_sequence = SeqRecord(record.seq)
+			whole_sequence.id = str(record.id)
+			whole_sequence.annotations['data_file_division'] = args.typedata.upper()
+			whole_sequence.annotations['date'] = strftime("%d-%b-%Y").upper()
+			for protein in sorted(protsdict, key = stringSplitByNumbers):
+				putative_start = int(protsdict[protein]['begin'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(protsdict[protein]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos, strand=protsdict[protein]['strand'])
+				qualifiersgene = OrderedDict([('locus_tag', protsdict[protein]['protein_id'])])
+				new_data_gene = SeqFeature.SeqFeature(feature_location, type = "gene", strand = protsdict[protein]['strand'], qualifiers = qualifiersgene)
+				whole_sequence.features.append(new_data_gene)
+				qualifiers = [('locus_tag', protsdict[protein]['protein_id']), ('product', protsdict[protein]['product']), ('protein_id', protsdict[protein]['protein_id']), ('translation', protsdict[protein]['translation'])]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_cds = SeqFeature.SeqFeature(feature_location, type = "CDS", strand = protsdict[protein]['strand'], qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_cds)
+			for rRNA in sorted(subunits, key = stringSplitByNumbers):
+				i = 0
+				try:
+					lengthlist = len(subunits[rRNA]['listdata'])
+				except KeyError:
+					continue
+				else:
+					while i < lengthlist:
+						putative_start = int(subunits[rRNA]['listdata'][i]['begin'])
+						start_pos = SeqFeature.ExactPosition(putative_start)
+						end_pos = SeqFeature.ExactPosition(subunits[rRNA]['listdata'][i]['end'])
+						feature_location = SeqFeature.FeatureLocation(start_pos, end_pos, strand=subunits[rRNA]['listdata'][i]['strand'])
+						new_data_gene = SeqFeature.SeqFeature(feature_location, type = "gene", strand = subunits[rRNA]['listdata'][i]['strand'])
+						whole_sequence.features.append(new_data_gene)
+						qualifiers = [('product', subunits[rRNA]['listdata'][i]['product'])]
+						feature_qualifiers = OrderedDict(qualifiers)
+						new_data_rRNA = SeqFeature.SeqFeature(feature_location, type = "rRNA", strand = subunits[rRNA]['listdata'][i]['strand'], qualifiers = feature_qualifiers)
+						whole_sequence.features.append(new_data_rRNA)
+						i += 1
+			for tRNA in sorted(tRNAdict, key = stringSplitByNumbers):
+				putative_start = int(tRNAdict[tRNA]['begin'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(tRNAdict[tRNA]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos, strand=tRNAdict[tRNA]['strand'])
+				new_data_gene = SeqFeature.SeqFeature(feature_location, type = "gene", strand = tRNAdict[tRNA]['strand'])
+				whole_sequence.features.append(new_data_gene)
+				qualifiers = [('product', tRNAdict[tRNA]['product'])]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_tRNA = SeqFeature.SeqFeature(feature_location, type = "tRNA", strand = tRNAdict[tRNA]['strand'], qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_tRNA)
+			for tmRNA in sorted(tmRNAdict, key = stringSplitByNumbers):
+				putative_start = int(tmRNAdict[tmRNA]['begin'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(tmRNAdict[tmRNA]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos, strand=tmRNAdict[tmRNA]['strand'])
+				new_data_gene = SeqFeature.SeqFeature(feature_location, type = "gene", strand = tmRNAdict[tmRNA]['strand'])
+				whole_sequence.features.append(new_data_gene)
+				qualifiers = [('product', tmRNAdict[tmRNA]['product'])]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_tmRNA = SeqFeature.SeqFeature(feature_location, type = "tmRNA", strand = tmRNAdict[tmRNA]['strand'], qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_tmRNA)
+			for CRISPR in sorted(information_CRISPR, key = stringSplitByNumbers):
+				putative_start = int(information_CRISPR[CRISPR]['start'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(information_CRISPR[CRISPR]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos)
+				qualifiers = [('rpt_family', 'CRISPR'), ('rpt_type', 'direct'), ('rpt_unit_range', "%i..%i" % (int(information_CRISPR[CRISPR]['start']), int(information_CRISPR[CRISPR]['repeatend']))), ('rpt_unit_seq', information_CRISPR[CRISPR]['repeatseq'])]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_CRISPRrepeat = SeqFeature.SeqFeature(feature_location, type = "repeat_region", qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_CRISPRrepeat)
+			for tandem in sorted(information_TRF):
+				putative_start = int(information_TRF[tandem]['start'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(information_TRF[tandem]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos)
+				qualifiers = [('rpt_type', 'direct')]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_tandemrepeat = SeqFeature.SeqFeature(feature_location, type = "repeat_region", qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_tandemrepeat)
+			for inverted in sorted(information_IRF):
+				putative_start = int(information_IRF[inverted]['start'])
+				start_pos = SeqFeature.ExactPosition(putative_start)
+				end_pos = SeqFeature.ExactPosition(information_IRF[inverted]['end'])
+				feature_location = SeqFeature.FeatureLocation(start_pos, end_pos)
+				qualifiers = [('rpt_type', 'inverted')]
+				feature_qualifiers = OrderedDict(qualifiers)
+				new_data_invertedrepeat = SeqFeature.SeqFeature(feature_location, type = "repeat_region", qualifiers = feature_qualifiers)
+				whole_sequence.features.append(new_data_invertedrepeat)
+			SeqIO.write(whole_sequence, newtempgbk, "genbank")
+
+	newgbk = "%s.gbk" % newfile
+	with open(newtempgbk, "rU") as gbktempfile, open(newgbk, "w") as gbkrealfile:
+		newpat = re.compile("D|RNA\s+(CON|PHG|VRL|BCT)")
+		for line in gbktempfile:
+			if line.startswith("LOCUS ") and re.search(newpat, line):
+				if genomeshape['genomeshape'] == "linear":
+					newline = re.sub("bp    DNA\s+", "bp    DNA     linear   ", line)
+				else:
+					newline = re.sub("bp    DNA\s+", "bp    DNA     circular ", line)
+				gbkrealfile.write(newline)
+			else:
+				gbkrealfile.write(line)
+
+	for f in glob.glob("*.temp.gbk"):
+		os.remove(f)
+
+	if args.gffprint==True:
+		newgff = "%s.gff" % newfile
+		with open(newgff, "w") as outgff, open(newgbk, "rU") as ingbk:
+			GFF.write(SeqIO.parse(ingbk, "genbank"), outgff)
+
+	# Removing intermediate files
+	os.remove(newfile)
+	os.remove("temp.faa")
+	os.remove("temp_blast.csv")
+	os.remove("crisprfile.txt")
+	os.remove("trnafile.fasta")
+	os.remove("rrnafile.csv")
+	os.remove("trf_temp.dat")
+	os.remove("irf_temp.dat")
+	for f in glob.glob("SEQ*"):
+		os.remove(f)
+
+# Joining all GENBANK files into one
+listgbk = sorted(glob.glob('CONTIG_*.gbk'))
+gbkoutputfile = "%s.gbk" % root_output
+with open(gbkoutputfile, 'w') as finalgbk:
+	for fname in listgbk:
+		with open(fname) as infile:
+			for line in infile:
+				finalgbk.write(line)
+
+for tempgbk in glob.glob("CONTIG_*.gbk"):
+	os.remove(tempgbk)
+
+# Joining all GFF files into one
+if args.gffprint==True:
+	listgff = sorted(glob.glob('CONTIG_*.gff'))
+	gffoutputfile = "%s.gff" % root_output
+	with open(gffoutputfile, 'w') as finalgff:
+		for fname in listgff:
+			with open(fname) as infile:
+				for line in infile:
+					finalgff.write(line)
+	for tempgff in glob.glob("CONTIG_*.gff"):
+		os.remove(tempgff)
+
+# Joining all TABLE files into one
+listcsv = sorted(glob.glob('CONTIG_*.csv'))
+tbloutputfile = "%s.csv" % root_output
+with open(tbloutputfile, 'w') as finaltable:
+	for fname in listcsv:
+		with open(fname) as infile:
+			for line in infile:
+				finaltable.write(line)
+
+for temptbl in glob.glob("CONTIG_*.csv"):
+	os.remove(temptbl)
+
+# Preparing sequences for GenBank submission (Original code from Wan Yu's gbk2tbl.py script [https://github.com/wanyuac/BINF_toolkit/blob/master/gbk2tbl.py])
+allowed_qualifiers = ['locus_tag', 'gene', 'product', 'pseudo', 'protein_id', 'gene_desc', 'old_locus_tag', 'note', 'inference', 'organism', 'mol_type', 'strain', 'sub_species', 'isolation-source', 'country']
+newfastafile = "%s.fasta" % root_output
+newtablefile = "%s.tbl" % root_output
+with open(args.modifiers, "rU") as modifiers, open(gbkoutputfile, "r") as genbank_fh, open(newfastafile, "w") as fasta_fh, open(newtablefile, "w") as feature_fh: 
+	info = modifiers.readline()
+	wholelist = list(SeqIO.parse(genbank_fh, 'genbank'))
+	for record in wholelist:
+		if len(record) <= args.mincontigsize:
+			eprint("WARNING: Skipping small contig %s" % record.id)
+			continue
+		record.description = "%s %s" % (record.id, info)
+		SeqIO.write([record], fasta_fh, 'fasta')
+		print('>Feature %s' % (record.name), file=feature_fh)
+		for line in record.features:
+			if line.strand == 1:
+				print('%d\t%d\t%s' % (line.location.nofuzzy_start + 1, line.location.nofuzzy_end, line.type), file=feature_fh)
+			else:
+				print('%d\t%d\t%s' % (line.location.nofuzzy_end, line.location.nofuzzy_start + 1, line.type), file=feature_fh)
+			for (key, values) in line.qualifiers.iteritems():
+				if key not in allowed_qualifiers:
+					continue
+				for v in values:
+					print('\t\t\t%s\t%s' % (key, v), file=feature_fh)
+
+# Final statement
+eprint("Genome annotation done!")
+eprint("The GenBank file is %s" % gbkoutputfile)
+if args.gffprint==True:
+	eprint("The GFF3 file is %s" % gffoutputfile)
+eprint("The table file for GenBank submission is %s" % tbloutputfile)
+eprint("The FASTA file for GenBank submission is %s" % newfastafile)
+eprint("The table file with all protein information is %s" % newtablefile)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data/viga_blastdb.loc.sample	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,31 @@
+# virannot_blastdb.loc
+# This is a *.loc.sample file distributed with Galaxy that enables tools
+# to use a directory of indexed data files. This one is for Bowtie2 and Tophat2.
+# See the wiki: http://wiki.galaxyproject.org/Admin/NGS%20Local%20Setup
+# First create these data files and save them in your own data directory structure.
+# Then, create a bowtie_indices.loc file to use those indexes with tools.
+# Copy this file, save it with the same name (minus the .sample), 
+# follow the format examples, and store the result in this directory.
+# The file should include an one line entry for each index set.
+# The path points to the "basename" for the set, not a specific file.
+# It has four text columns seperated by TABS.
+#
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+# So, for example, if you had hg18 indexes stored in:
+#
+#    /data/databases/blast/nr/nr
+#
+# containing hg19 genome and hg19.*.bt2 files, such as:
+#    -rw-rw-r-- 1 james   james   914M Feb 10 18:56 hg19canon.fa
+#    -rw-rw-r-- 1 james   james   914M Feb 10 18:56 hg19canon.1.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 18:56 hg19canon.2.bt2
+#    -rw-rw-r-- 1 james   james   3.3K Feb 10 16:54 hg19canon.3.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 16:54 hg19canon.4.bt2
+#    -rw-rw-r-- 1 james   james   914M Feb 10 20:45 hg19canon.rev.1.bt2
+#    -rw-rw-r-- 1 james   james   683M Feb 10 20:45 hg19canon.rev.2.bt2
+#
+# then the virannot_blastdb.loc entry could look like this:
+
+nr	nr	Non_redundant (nr)	/data/databases/blast/nr/nr
+swissprot	swissprot	Swissprot (swissprot)	/data/databases/blast/swissprot/swissprot
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data/viga_diamonddb.loc.sample	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,5 @@
+#
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+
+nr	nr	Non_redundant (nr)	/data/databases/diamonddb/nr
+swissprot	swissprot	Swissprot (swissprot)	/data/databases/diamonddb/swissprot
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data/viga_hmmdb.loc.sample	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,5 @@
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+uniprot_trembl	uniprot_trembl	UniProt TrEMBL	/data/databases/SwissProt_UniProt/uniprot_trembl.fasta
+uniprot_sprot	uniprot_sprot	UniProt Swiss-Prot	/data/databases/SwissProt_UniProt/uniprot_sprot.fasta
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data/viga_rfamdb.loc.sample	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,4 @@
+# <unique_build_id>	<dbkey>	<display_name>	<file_base_path>
+#
+Rfam	Rfam	Rfam	/data/databases/rfam/Rfam.cm
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,19 @@
+<!-- Use the file tool_data_table_conf.xml.oldlocstyle if you don't want to update your loc files as changed in revision 4550:535d276c92bc-->
+<tables>
+    <table name="viga_blastdb" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/viga_blastdb.loc" />
+    </table>
+    <table name="viga_diamonddb" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/viga_diamonddb.loc" />
+    </table>
+    <table name="viga_rfamdb" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/viga_rfamdb.loc" />
+    </table>
+    <table name="viga_hmmdb" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/viga_hmmdb.loc" />
+    </table>
+</tables>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wrapper.xml	Tue Feb 27 14:16:54 2018 -0500
@@ -0,0 +1,304 @@
+<tool id="viga" name="viga" version="0.10.3">
+    <description>de novo VIral Genome Annotator</description>
+    <requirements>
+        <container type="docker">vimalkvn/viga</container>
+    </requirements>
+    <stdio>
+        <exit_code range="1:" />
+    </stdio>
+    <command><![CDATA[
+python $__tool_directory__/VIGA.py
+--input $input
+--rfamdb $rfamdb.fields.path
+--modifiers $modifiers
+--threads \${GALAXY_SLOTS:-5}
+--typedata $typedata_select
+--gcode $gcode_select
+--out "default"
+--minrepeat $minrepeat
+--maxrepeat $maxrepeat
+--minspacer $minspacer
+--maxspacer $maxspacer
+
+#if $readlength
+    --readlength $readlength
+#end if
+#if $windowsize
+    --windowsize $windowsize
+#end if
+#if $slidingsize
+    --slidingsize $slidingsize
+#end if
+#if $locus
+    --locus $locus
+#end if
+#if $gffprint
+    --gff
+#end if
+#if str($blastevalue)
+    --blastevalue $blastevalue
+#end if
+#if str($mincontigsize)
+    --mincontigsize $mincontigsize
+#end if
+#if str($idthr)
+    --idthr $idthr
+#end if
+#if str($coverthr)
+    --coverthr $coverthr
+#end if
+#if str($diffid)
+    --diffid $diffid
+#end if
+#if $blastexh
+    --blastexh
+#end if
+#if str($homologysearch.use_diamond) == "yes":
+   --noblast
+   --diamonddb $homologysearch.diamonddb.fields.path
+#else
+   --blastdb $homologysearch.blastdb.fields.path
+#end if
+#if str($hmmsearch.use_phmmer) == "yes":
+  --hmmdb $hmmsearch.hmmdb.fields.path
+  --hmmerevalue $hmmsearch.hmmerevalue
+#else
+  --nohmmer
+#end if
+]]></command>
+    <inputs>
+        <param name="input" type="data" format="fasta" label="(Viral) contigs to annotate" help="Input file as a FASTA file. It can contain multiple sequences (e.g. metagenomic contigs)" />
+        <param name="rfamdb" type="select" label="RFAM database used for ribosomal RNA prediction">
+            <options from_data_table="viga_rfamdb">
+                <filter type="sort_by" column="2"/>
+                <validator type="no_options" message="No indexes are available for the selected input dataset"/>
+            </options>
+        </param>
+        <param name="modifiers" type="data" format="txt" label="Metadata of the contigs" help="Modifiers per every FASTA header according to SeqIn (https://www.ncbi.nlm.nih.gov/Sequin/modifiers.html)" />
+	<param name="typedata_select" type="select" label="GenBank division (--typedata)">
+	    <option value="CON" selected="true">Contig</option>
+	    <option value="PHG">Phages</option>
+	    <option value="VRL">Eukaryotic/Archaea virus</option>
+	    <option value="BCT">Prokaryotic chromosome</option>
+	</param>
+	<param name="gcode_select" type="select" label="Number of GenBank translation table (--gcode)">
+	  <option value="1">Standard genetic code [Eukaryotic]</option>
+	  <option value="2">Vertebrate mitochondrial code</option>
+	  <option value="3">Yeast mitochondrial code</option>
+	  <option value="4">Mycoplasma/Spiroplasma and Protozoan/mold/coelenterate mitochondrial code</option>
+	  <option value="5">Invertebrate mitochondrial code</option>
+	  <option value="6">Ciliate, dasycladacean and hexamita nuclear code</option>
+	  <option value="9">Echinoderm/flatworm mitochondrial code</option>
+	  <option value="10">Euplotid nuclear code</option>
+	  <option value="11" selected="true">Bacteria/Archaea/Phages/Plant plastid</option>
+	  <option value="12">Alternative yeast nuclear code</option>
+	  <option value="13">Ascidian mitochondrial code</option>
+	  <option value="14">Alternative flatworm mitochondrial code</option>
+	  <option value="16">Chlorophycean mitochondrial code</option>
+	  <option value="21">Trematode mitochondrial code</option>
+	  <option value="22">Scedenesmus obliquus mitochondrial code</option>
+	  <option value="23">Thraustochytrium mitochondrial code</option>
+	  <option value="24">Pterobranquia mitochondrial code</option>
+	  <option value="25">Gracilibacteria and Candidate division SR1</option>
+	  <option value="26">Pachysolen tannophilus nuclear code</option>
+	  <option value="27">Karyorelict nuclear code</option>
+	  <option value="28">Condylostoma nuclear code</option>
+	  <option value="29">Mesodinium nuclear code</option>
+	  <option value="30">Peritrich nuclear code</option>
+	  <option value="31">Blastocrithidia nuclear code</option>
+	</param>
+        <param name="readlength" type="integer" value="101" min="1" optional="true" label="Read length (--readlength)" help="Read length for the circularity prediction"/>
+        <param name="windowsize" type="integer" value="100" min="2" optional="true" label="Window size (--windowsize)" help="Window size used to determine the origin of replication in circular contigs according to the cumulative GC skew"/>
+        <param name="slidingsize" type="integer" value="10" min="1" optional="true" label="sliding window size (--slidingsize)" help="Sliding window size for the origin of replication prediction"/>
+        <param name="locus" type="text" value="LOC" optional="true" label="Locus tag prefix (--locustag)" help="Name of the sequences. If the input is a multifasta file, please put a general name"/>
+        <param name="gffprint" type="boolean" checked="false" optional="true" label="Print the output also as GFF3 file" help="Printing the output as GFF3 file (Default: FALSE)" />
+        <param name="blastevalue" type="float" value="1e-5" min="0" optional="true" label="Blast e-value threshold" />
+
+	<conditional name="hmmsearch">
+	  <param name="use_phmmer" type="select" label="Use PHMMER to predict protein function using HMM">
+	    <option value="yes" selected="True">Yes (slow, more accurate)</option>
+	    <option value="no">No (fast, less accurate)</option>
+	  </param>
+	  <when value="yes">
+	    <param name="hmmdb" type="select" label="PHMMER database to use for protein function prediction">
+	      <options from_data_table="viga_hmmdb">
+		<filter type="sort_by" column="2"/>
+		<validator type="no_options" message="No indexes are available for the selected input dataset"/>
+	      </options>
+	    </param>
+	    <param name="hmmerevalue" type="float" value="0.001" label="PHMMER e-value threshold"/>
+		</when>
+	</conditional>
+	<conditional name="homologysearch">
+ 	  <param name="use_diamond" type="select" label="Use DIAMOND instead of BLAST to predict protein function">
+	    <option value="yes" selected="True">Yes (fast, less accurate)</option>
+	    <option value="no">No (slow, more accurate)</option>
+	  </param>
+	  <when value="yes">
+	    <param name="diamonddb" type="select" label="DIAMOND database" help="DIAMOND Protein Database that will be used for the protein function prediction">
+	      <options from_data_table="viga_diamonddb">
+		<filter type="sort_by" column="2"/>
+		<validator type="no_options" message="No indexes are available for the selected input dataset"/>
+	      </options>
+	    </param>
+ 	  </when>
+	  <when value="no">
+            <param name="blastdb" type="select" label="BLAST Database" help="BLAST Protein Database that will be used for the protein function prediction">
+              <options from_data_table="viga_blastdb">
+                <filter type="sort_by" column="2"/>
+                <validator type="no_options" message="No indexes are available for the selected input dataset"/>
+              </options>
+            </param>
+	  </when>
+	</conditional>
+	<param name="mincontigsize" type="integer" value="200" min="1" optional="true" label="Minimum contig length to be considered in the output" />
+        <param name="idthr" type="float" value="50.0" min="0.01" max="100.00" optional="true" label="ID threshold" />
+        <param name="coverthr" type="float" value="50.0" min="0.01" max="100.00" optional="true" label="Coverage threshold" />
+        <param name="diffid" type="float" value="5.00" min="0.01" max="100.00" optional="true" label="Max allowed difference between the ID percentages of BLAST and HHSEARCH" />
+
+        <param name="minrepeat" type="integer" value="16" min="1" optional="true" label="Minimum repeat length for CRISPR detection (--minrepeat)"/>
+        <param name="maxrepeat" type="integer" value="64" min="1" optional="true" label="Maximum repeat length for CRISPR detection (--maxrepeat)"/>
+        <param name="minspacer" type="integer" value="8" min="1" optional="true" label="Minimum spacer length for CRISPR detection (--minspacer)"/>
+        <param name="maxspacer" type="integer" value="64" min="1" optional="true" label="Maximum spacer length for CRISPR detection (--maxspacer)"/>	
+	
+        <param name="blastexh" type="boolean" checked="false" optional="true" label="Use exhaustive BLAST (--blastexh)" help="Use of exhaustive BLAST to predict the proteins by homology according to Fozo et al. (2010) Nucleic Acids Res (Default=FALSE)" />
+    </inputs>
+    <outputs>
+        <data name="default_csv" format="csv" label="${tool.name} on ${on_string}: csv" from_work_dir="default.csv" />
+        <data name="default_gff" format="gff" label="${tool.name} on ${on_string}: gff" from_work_dir="default.gff">
+            <filter>gffprint</filter>
+        </data>
+        <data name="default_gbk" format="txt" label="${tool.name} on ${on_string}: gbk" from_work_dir="default.gbk" />
+        <data name="default_fasta" format="fasta" label="${tool.name} on ${on_string}: fasta" from_work_dir="default.fasta" />
+        <data name="default_tbl" format="txt" label="${tool.name} on ${on_string}: tbl" from_work_dir="default.tbl" />
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" ftype="fasta" value="rubella.fasta" />
+            <param name="outputs" value="csv,gbk,fasta,tbl" />
+            <output name="default_csv" file="default.csv" />
+            <output name="default_gbk" file="default.gbk" />
+            <output name="default_fasta" file="default.fasta" />
+            <output name="default_tbl" file="default.tbl" />
+        </test>
+        <test>
+            <param name="input" ftype="fasta" value="mu.fasta" />
+            <param name="outputs" value="csv,gbk,fasta,tbl" />
+            <output name="default_csv" file="default.csv" />
+            <output name="default_gbk" file="default.gbk" />
+            <output name="default_fasta" file="default.fasta" />
+            <output name="default_tbl" file="default.tbl" />
+        </test>
+    </tests>
+    <help><![CDATA[
+**About VIGA**
+
+VIGA_ is a script written in Python 2.7 that annotates viral
+genomes automatically (using a de novo algorithm) and predict the
+function of their proteins using BLAST and HMMER.
+
+----
+
+**About this Galaxy wrapper**
+
+**Requirements**
+
+`Docker <https://www.docker.com>`_ should first be installed and working on the
+server where this Galaxy instance is setup. The user running Galaxy should be
+part of the **docker** user group.
+
+#. Download or clone the VIGA_ Github repository (as a submodule)
+   in to the ``tools`` directory.
+
+**Configuration**
+
+**Update database paths in .loc files**
+
+Edit the following files in the **tool-data** directory and add paths to
+corresponding databases:
+
+* viga_blastdb.loc
+* viga_diamonddb.loc
+* viga_rfamdb.loc
+* viga_hmmdb.loc
+
+**Create or update the Galaxy job configuration file**
+
+If the file **config/job_conf.xml** does not exist, create it by copying the
+template **config/job_conf.xml.sample_basic** in the Galaxy directory. Then
+add a Docker destination for viga. Change ``/data/databases`` under
+``docker_volumes`` to the location where your databases are stored. Here is
+an example::
+
+	<?xml version="1.0"?>
+	<!-- A sample job config that explicitly configures job running the way it is configured by default (if there is no explicit config). -->
+	<job_conf>
+	    <plugins>
+		<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
+	    </plugins>
+	    <handlers>
+		<handler id="main"/>
+	    </handlers>
+	    <destinations default="local">
+		<destination id="local" runner="local"/>
+		<destination id="docker" runner="local">
+			<param id="docker_enabled">true</param>
+			<param id="docker_sudo">false</param>
+			<param id="docker_auto_rm">true</param>
+			<param id="docker_volumes">$defaults,/data/databases:ro</param>
+		</destination>
+	    </destinations>
+	    <tools>
+	      <tool id="viga" destination="docker"/>
+	    </tools>
+	</job_conf>
+
+
+**Restart Galaxy**. The tool will now be ready to use.
+   
+----
+
+**Output files**
+
+VIGA creates the following output files:
+
+* tbl - Table file with all protein information.
+* gbk - GenBank format file with annotations.
+* fasta - FASTA format file for GenBank submission
+* csv - Table file for GenBank submission.
+* gff - GFF3 format file (if option is selected)
+
+----
+
+**License and citation**
+
+VIGA_ and this Galaxy wrapper - `GPLv3 <https://www.gnu.org/copyleft/gpl.html>`_.
+
+
+Galaxy
+
+- Goecks, J, Nekrutenko, A, Taylor, J and The Galaxy Team. "Galaxy: a
+  comprehensive approach for supporting accessible, reproducible, and
+  transparent computational research in the life sciences." 
+  Genome Biol. 2010 Aug 25;11(8):R86.
+
+- Blankenberg D, Von Kuster G, Coraor N, Ananda G, Lazarus R, Mangan M,
+  Nekrutenko A, Taylor J. "Galaxy: a web-based genome analysis tool for
+  experimentalists". Current Protocols in Molecular Biology. 
+  2010 Jan; Chapter 19:Unit 19.10.1-21.
+
+- Giardine B, Riemer C, Hardison RC, Burhans R, Elnitski L, Shah P, Zhang Y,
+  Blankenberg D, Albert I, Taylor J, Miller W, Kent WJ, Nekrutenko A. "Galaxy:
+  a platform for interactive large-scale genome analysis." 
+  Genome Research. 2005 Oct; 15(10):1451-5.
+
+You can use this tool only if you agree to the license terms of: `VIGA`_.
+
+.. _VIGA: https://github.com/EGTortuero/viga
+
+]]></help>
+<!--    <citations>
+        <citation type="doi">NOT YET</citation>
+    </citations>
+-->
+</tool>