Package: pyrkviewer
Coyote: A visualization tool for reaction networks.IntroductionCoyote, also called PyRKViewer, is a cross-platform visualization tool for drawing reaction networks written with thewxPythonframework. It can draw reactants, products, reactions, and compartments, and its features include but are not limited to:Support for floating and boundary species.Reactions can be displayed using Bezier curves and straight lines.Plugin support, with some plugin examples: Arrow Designer, Random Network, Auto Layout, etc.Installment for UsersInstall Python 3.7, 3.8, 3.9 or 3.10 if not ready in the system.Go to the command line and typepip install pyrkviewer.If wxPython won't get installed automatically, please try to install wxPython 4.1.1 or 4.2.0 manually referring tohttps://wxpython.org/pages/downloads/index.html. Note wxPython 4.1.1 does not apply to Python 3.10.To run the application, simply type in the command linecoyote.DocumentationThe full documentation can be found at:https://sys-bio.github.io/PyRKViewer/Installment options for DevelopersInstalling with PoetryIf you do not have poetry installed on your computer, follow the quick steps shownhere.Once you have poetry installed, you will download Coyote. Click the green button at the top of this page that says “Code” and choose “Download ZIP”. You want to make sure you know where you have downloaded this. Unzip the folder to your desired directory.Next, open your terminal and navigate to the directory containing Coyote.Once inside the main folder of the application you can install the dependencies. To install the base dependencies simply runpoetry install. To install the optional ones as well, runpoetry install -E simulation. Note that this step may take a while. To learn more about which set of dependencies is right for you, refer to theDependenciessection below.Finally, you will run the application with the commandpoetry run coyote.After you have completed all of these steps, you will not have to repeat them every time you want to run the application. Once the setup is done you will only need to open the terminal, navigate into the folder that contains your Coyote application, and run the commandpoetry run coyote.Installing without PoetryAgain, we strongly advise following the steps above, as it makes the set-up process much faster and simpler. However, to install Coyote without Poetry, here is the process you will follow:First, download Coyote. Click the green button at the top of this page that says “Code” and choose “Download ZIP”. You want to make sure you know where you have downloaded this. Unzip the folder to your desired directory.Next, open your terminal and navigate to the directory containing Coyote.To install the base set of dependencies, you will runpip install -r requirements.txt. Then if you want to install the optional dependencies as well, runpip install -r requirements-simulation.txt. To learn more about which set of dependencies is right for you, refer to theDependenciessection below.Finally, you will run the application with the commandpython -m rkviewer.main.
After you have completed all of these steps, you will not have to repeat them every time you want to run the application. Once the setup is done you will only need to open the terminal, navigate into the folder that contains your Coyote application, and run the commandpython -m rkviewer.main.RunningIf you have poetry, simply runpoetry run coyote.Otherwise, in your virtual environment, runpython -m rkviewer.main.Then, check out thedocumentation.Development SetupDependenciesWe are usingpoetryfor dependency management. If you are just looking
to build and run, though, you can work solely withpipas well.There are currently three dependency groups: "base", "development", and "simulation"."base" is the bare minimum requirements to run the application without any plugins."development" includes the additional requirements for development, such as for documentation
and testing."simulation" includes a large set of dependencies required for running simulation related Plugins. (This is in addition to the base requirements).The dependency groups are specified inpyproject.tomlforpoetry. There are additionallyrequirement.txtfiles generated bypoetry, includingrequirements.txt,requirements-dev.txt,
andrequirements-simulation.txt. If you do not have poetry, you can opt for those as well. If you are
using linux, extra work would need to be done on installing wxPython. Please refer to the
"Linux Notes" section below.Installing Dependenciespoetryis recommended for installing dependencies. Simplypoetry installfor the base
dependencies andpoetry install -E simulationto install the optional ones as well.If you don't have poetry, you can simply runpip install -r <>for any of the aforementionedrequirements.txtfiles.Running locallyIf you have poetry, simplypoetry run coyote.Otherwise, in your virtual environment, runpython -m rkviewer.main.Development DistributingUsepoetry buildandpoetry publish. Refer topoetry docsfor more detail.To re-generate therequirements*.txt, runscripts/gen_requirements.py.Bundling an Executable with PyInstallerNOTE: This section is obsolete for now, as we are currently distributing with pip.Always runpyinstaller rkviewer.specwhenrkviewer.specis present.If somehowrkviewer.specwent missing or you want to regenerate the build specs, runpyinstaller -F --windowed --add-data ext/Iodine.dll;. main.pyon Windows orpyinstaller -F -- windowed --add-data ext/Iodine.dll:. main.pyon Linux/Mac to generate a file namedmain.spec. Note that if amain.specfile is already  presentit will be overwritten.Development for Different PlatformsThe python version for development was 3.7.7.Mac NotesNote that on MacOS, if you wish to use Coyote in a virtual environment, usevenvinstead ofvirtualenv, due to the latter's issues with wxPython.pyinstaller and wxPython require a python built withenable-frameworkon. Therefore, one should doenv PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.7and
use that Python installation for building.If the text is blurry in the app bundled bypyinstaller, one needs to add an entry in the pyinstaller settings as describedhere.Linux NotesTo install wxPython on linux, seehttps://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html.requirements-dev.txtandrequirements.txtassume the user is on Ubuntu 18.04 for readthedocs. If you have a different distro and have trouble usingrequirements.txt, just install wxPython manually using the previous link.Related to the last note, if readthedocs start having trouble building wxPython, understand that it might be because readthedocs updated its distro from Ubuntu 18.04. Go torequirements-dev.txtand change the line abovewxPythonto look in the appropriate link.i.e.-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ \n wxPython==4.1.1Future DevelopmentTesting and ProfilingTo run all tests, go to project root and runpython -m unittest discover.To run a specific test suite, run e.g.python -m unittest test.api.test_node.Or even more specific:python -m unittest test.api.test_node.TestNode.test_add_nodes.To profile the application, runpython -m cProfile -o rkviewer.stat main.py.To visualize the profile result, runtuna rkviewer.stat.Building Local DocsRunsphinx-apidoc -f -o docs/source/rkviewer rkviewer rkviewer/plugin rkviewer/resourcesto regenerate the full reference doc source
code, if new files were added to the package rkviewer.Runsphinx-build -b html docs\source docs\build.Note on StyleUsually snake_case is used for function names. However, to retain some degree of backwards
compatibility for wxPython, subclasses of wxPython classes use PascalCase for their methods, e.g.Canvas::RegisterAllChildren.TODOsENHANCEMENT: Add support for multiple net IDs. Currently all net IDs are set to 0 by default.Shapes TODOsEvents (NodeModified)Roadmap for Shape EngineA shape "engine" allows the user to specify custom composite shapes for nodes and compartments.
Composite shapes are constructed out of primitives such as circles, (rounded) rectangles, polygons,
etc.RKViewer provides a default list of (composite) shapes, but the user may also create their own
shapes out of primitives. A (composite) shape is formed out of one or many primitives, each
scaled, rotated, and translated by certain amounts. User-created shapes will be
associated with each model in the exported.jsonfiles.A shape-creation plugin may be created in the future to facilitate the process of designing
complex shapes.Here is the roadmap for the shape engine:Create preliminary list of primitives and a default list of shapes. Allow model loader/saver to
reference that list.Modify renderer to be able to render these default shapes.Modify inspector to allow the user to change the properties of the primitives in the shape, such
as colors, border thickness, etc.Modify model loader/saver to allow users to create custom shape lists manually.Write shape-creation plugin?