diff --git a/.travis.yml b/.travis.yml index 8548595..6f1ae12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,6 @@ python: before_script: - chmod +x binaries # command to install dependencies -install: "pip install grapetree" +install: "pip install -r requirements.txt" # command to run tests script: pytest \ No newline at end of file diff --git a/README.rst b/README.rst deleted file mode 100644 index 448b86c..0000000 --- a/README.rst +++ /dev/null @@ -1,165 +0,0 @@ -========= -GrapeTree -========= - -Click here for the `live demo of GrapeTree! `_ -************************************************************************************************************** -|Build Status| |License| |Doc Status| - -GrapeTree is an integral part of EnteroBase and we advise that you use GrapeTree -through EnteroBase for the best results. However, many people have asked for a -stand-alone GrapeTree version that they could use offline or integrate into the -other applications. - -The stand-alone version emulates the EnteroBase version through a lightweight -webserver running on your local computer. You will be interacting with the -program as you would in EnteroBase; through a web browser. We recommend -`Google Chrome `_ for best results. - -**For detailed help please see:** http://enterobase.readthedocs.io/en/latest/grapetree/grapetree-about.html - -**For a formal description, please see the preprint:** https://www.biorxiv.org/content/early/2017/11/09/216788 - -Installing and Running GrapeTree --------------------------------- -There are number of different ways to interact with GrapeTree, the easiest is to -install with pip or download the software here: https://github.com/achtman-lab/GrapeTree/releases - -**Installing with pip** - -.. code-block:: - - pip install grapetree - grapetree - -**Running on Mac: Download GrapeTree_mac.zip** - -You will need to unzip GrapeTree_mac.zip (just double click). Inside there will -be an app you can drag into your Applications folder. You may be warned about -Security settings, if you right click on the GrapeTree app and then click "Open" -it should be fine. - -**Running on Windows: Download GrapeTree_win.zip** - -Once downloaded, you will need to untzip GrapeTree_win.zip and then open the -extracted folder and run GrapeTree_win.exe. When you run it the first time on -windows you might get a prompt about security. On Windows 10, click the small -text: "More info", and then the button "Run Anyway". - -**Running from Source code** - -EnteroMSTree - GrapeTree requires `Python 2.7 `_ and some additional python modules (listed in requirements.txt). The easiest way -to install these modules is with pip: - -.. code-block:: - - pip install -r requirements.txt - chmod +x binaries/ - -On Linux or MacOSX you need to make sure the binaries in binaries/ can be -executed. To run GrapeTree; - -#. Navigate to the directory where you installed GrapeTree. -#. Run it through python as below. - -.. code-block:: - - \GrapeTree>python main.py - * Running on http://127.0.0.1:8000/ (Press CTRL+C to quit) - -The program will automatically open your web browser and you will see the -GrapeTree Splash Screen. If at anytime you want to restart the page you can -visit http://localhost:8000 in your web browser. To -view a tree (newick or Nexus) or create a tree from an allele profile, just drag -and drop the file into the browser window. - -Configuration -------------- -Runtime behaviour can be configured in grapetree/config.py. - -Developers may wish to look at the `JavaScript documentation (JSDoc) `_. - -Tests ------ -To run tests, run pytests in the top level directory. - -.. code-block:: - - pytest - -Usage - Command line module for generating Trees - MSTrees.py -------------------------------------------------------------- - -.. code-block:: - - usage: MSTrees.py [-h] --profile PROFILE [--method METHOD] - [--matrix MATRIX_TYPE] [--recraft] - [--missing HANDLE_MISSING] [--wgMLST] - [--heuristic HEURISTIC] [--n_proc N_PROC] [--check] - - Parameters for command line version of GrapeTree. - You can drag the Newick output into the web interface. - - optional arguments: - -h, --help show this help message and exit - --profile PROFILE, -p PROFILE - A file contains either MLST / SNP profiles or multile aligned sequences in - fasta format. - --method METHOD, -m METHOD - backend algorithms to call. Allowed values are "MSTreeV2" [default], "MSTree" - and "NJ" - --matrix MATRIX_TYPE, -x MATRIX_TYPE - Either "symmetric" [default for MSTree and NJ] - or "asymmetric" [default for MSTreeV2]. - --recraft, -r Allows local branch recrafting after tree construction. Default in MSTreeV2. - --missing HANDLE_MISSING, -y HANDLE_MISSING - Alternative ways of handling missing data. - 0: missing data are ignored in pairwise comparisons [default]. - 1: Columns that have missing data are ignored in the whole analysis. - 2: missing data are treated as a special value (allele). - 3: Naive counting of absolute differences between profiles. - --wgMLST, -w Use when > 20 % of values in the input are missing. - --heuristic HEURISTIC, -t HEURISTIC - Tiebreak rules between co-optimal edges. Only used in MSTree [default: eBurst] - and MSTreeV2 [default: harmonic] - --n_proc N_PROC, -n N_PROC - Number of processes. Default: 5. - --check, -c Do not calculate the tree but only show the expected time/memory consumption. - - -License -------- -Copyright Warwick University 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/. - - -Citation --------- -If you use GrapeTree please cite the preprint: - -Z Zhou, NF Alikhan, MJ Sergeant, N Luhmann, C Vaz, AP Francisco, JA Carrico, -M Achtman (2017) "GrapeTree: Visualization of core genomic relationships -among 100,000 bacterial pathogens", bioRxiv 216788; doi: -https://doi.org/10.1101/216788 - -.. |Build Status| image:: https://travis-ci.org/achtman-lab/GrapeTree.svg?branch=master - :target: https://travis-ci.org/achtman-lab/GrapeTree - :alt: Build status - -.. |License| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg - :target: https://www.gnu.org/licenses/gpl-3.0 - :alt: GPLv3 - -.. |Doc status| image:: https://readthedocs.org/projects/enterobase/badge/ - :target: http://enterobase.readthedocs.io/en/latest/grapetree/grapetree-about.html - :alt: Build status of documentation diff --git a/build_win.bat b/build_win.bat index a584f09..705e6d7 100644 --- a/build_win.bat +++ b/build_win.bat @@ -1,6 +1,7 @@ pyinstaller -n GrapeTree_win --icon=GT_icon.ico ^ --add-binary binaries/edmonds.exe;binaries/ ^ --add-binary binaries/fastme.exe;binaries/ ^ - --add-data MSTree_holder.html;grapetree/MSTree_holder.html ^ - --add-data static/;grapetree/static/ ^ + --add-data MSTree_holder.html;. ^ + --add-data static/;static/ ^ + --hidden-import psutil ^ grapetree.py \ No newline at end of file diff --git a/grapetree.py b/grapetree.py index 449c55d..3a5c835 100644 --- a/grapetree.py +++ b/grapetree.py @@ -34,6 +34,8 @@ import os import sys from module.MSTrees import backend, add_args +import psutil + __licence__ = 'GPLv3' __author__ = 'EnteroBase development team' @@ -73,4 +75,6 @@ def main() : os._exit(1) if __name__ == "__main__": + import multiprocessing + multiprocessing.freeze_support() main() diff --git a/module/MSTrees.py b/module/MSTrees.py index 9422f56..0c9b190 100644 --- a/module/MSTrees.py +++ b/module/MSTrees.py @@ -623,7 +623,7 @@ def estimate_Consumption(platform, method, matrix, n_proc, n_loci, n_profile) : return max(time, 5), max(memory, 50*1024*1024) -if __name__ == '__main__' : - tre = backend(**add_args()) - print tre +#if __name__ == '__main__' : + #tre = backend(**add_args()) + #print tre diff --git a/module/__init__.py b/module/__init__.py index 062cdf6..00e34aa 100644 --- a/module/__init__.py +++ b/module/__init__.py @@ -4,7 +4,7 @@ import os if getattr(sys, 'frozen', False): - template_folder = os.path.join(sys._MEIPASS, 'grapetree','templates') + template_folder = sys._MEIPASS #os.path.join(sys._MEIPASS, 'templates') static_folder = os.path.join(sys._MEIPASS, 'static') app = Flask(__name__, template_folder=template_folder, static_folder=static_folder) else: diff --git a/module/views.py b/module/views.py index 3ac4973..361f337 100644 --- a/module/views.py +++ b/module/views.py @@ -20,7 +20,7 @@ def generate_tree(): for param in params: if isinstance(params[param], list): params[param] = params[param][0] - tree = backend (profile= params['profile'], + tree = backend(profile= params['profile'], method=params['method'], checkEnv = params['checkEnv'], ) diff --git a/requirements.txt b/requirements.txt index e7eefbd..7ba4e86 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,12 @@ -appdirs==1.4.3 click==6.7 -colorama==0.3.9 -decorator==4.0.11 -DendroPy==4.2.0 +decorator==4.3.0 +DendroPy==4.3.0 Flask==0.12.2 -future==0.16.0 +grapetree==1.3.2 itsdangerous==0.24 -Jinja2==2.9.6 +Jinja2==2.10 MarkupSafe==1.0 -networkx==1.11 -numpy==1.12.1 -packaging==16.8 -py==1.4.33 -pyparsing==2.2.0 -pytest==3.0.7 -psutil==5.4.3 -six==1.10.0 -Werkzeug==0.12.2 \ No newline at end of file +networkx==2.1 +numpy==1.14.2 +psutil==5.4.5 +Werkzeug==0.14.1