DRP
No description available
Install / Use
/learn @darkreactions/DRPREADME
Dark Reaction Project README
General Information
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/. Always make sure to check the latest version of the README on the master branch.
This repository contains the software for the https://www.djangoproject.com/-based source code for the Dark Reactions Project Software. If you are looking to contribute to the chemistry aspects of the project, please visit the main project site at http://darkreactions.haverford.edu. If you are looking to contribute to the source code of the project and are not a member of haverford college, please fork this repository and issue a pull request with any changes or fixes you may have made. A list of known bugs can be found at [http://bugs.darkreactions.haverford.edu] (our instance of Mantis Bug Tracker). Please note that you will to sign up for an account, and that the authentication credentials for the bug reporting page and the main project page are separate.
Setting up your own instance of the DRP
The following setup methods are suitable for use with Ubuntu 16.04.
On a Virtual Machine
This software supports development using https://www.vagrantup.com, and has a Vagrantfile included in the root directory.
Vagrant can be installed on Linux machines using
sudo apt-get install vagrant virtualbox
Then setting up a virtual machine should be as simple as issuing the command vagrant up from anywhere in the repository.
Manual Instructions - For A Physical Machine
The following instructions are written to work with Ubuntu 14 and 16 and have (mostly) been tested. These instructions assume familiarity with Linux and a Command Line, and that you are using nginx as your webserver.
Step 1: Install Dependencies
- The DRP
- Mysql
- Nginx
- Uwsgi — Note: other wsgi solutions are available and may be compatible with DRP.
- Chemspider
Download or clone the DRP from our git repo
git clone https://github.com/darkreactions/DRP
Install necessary dependencies. Note that dependencies will go off most screens, so be careful when copy/pasting.
sudo apt-get install python3 python3-dev python3-pip mailutils mysql-server libmysqlclient-dev nginx uwsgi uwsgi-plugin-python3 python-rdkit git weka graphviz memcached python-memcache python3-scipy python3-pillow cmake libboost-all-dev python3-cffi graphviz-dev pkg-config pwgen dnsmasq
sudo python3 -m pip install numpy pygraphviz mysqlclient
sudo -H python3 -m pip install chemspipy requests pep8 pep257 xxhash sqlparse
Install Django. Please note that the current version of DRP is designed to work with Django 1.8
sudo python3 -m pip install django==1.8
Step 2: Setting up MySQL and Chemspider
Login to your account:
mysql -u root -p
The user is initialized as root and the password is blank in Ubuntu. This may vary depending on your setup.
Once you login to mysql, and create two databases:
CREATE DATABASE DRP CHARACTER SET utf8 COLLATE utf8_bin;
You should see: Query OK, 1 row affected (0.00 sec)
CREATE DATABASE DRP_test CHARACTER SET utf8 COLLATE utf8_bin;
You should see: Query OK, 1 row affected (0.00 sec)
Exit out of MySQL my typing “exit.”
You will also need a chemspider token. Follow the directions on the website for webservices:
“Some operations require a security token; to obtain a token please complete the registration process –when you are registered the Security Token is listed on the Profilepage. For web services which require a “Service Subscriber” role, then email us above to discuss upgrading your user account.”
Visit http://www.chemspider.com/AboutServices.aspx
Step 3: Setting up the settings.py file
In the DRP repository, copy the settings_example.py to settings.py.
cp settings_example.py settings.py
In the settings.py file, you will need to edit:
SERVER_NAME (full name of PC)
CHEMSPIDER\_TOKEN
MAIN\_SERVER
MAIN\_SERVER\_USER
MAIN\_SERVER\_PASS
EMAIL\_HOST
EMAIL\_HOST\_USER
EMAIL\_HOST\_PASS
EMAIL\_IMAP\_HOST
ADMINS
These have placeholders that indicate their use.
You will also need to set the standard database settings as per the [https://docs.djangoproject.com/en/1.8/](django documentation).
Note that ALLOWED_HOSTS should be empty.
To pass the unit tests, at least one ADMIN_EMAILS should be provided
Step 4: Nginx and Uwsgi
Copy DRP_nginx from the DRP folder to the /etc/nginx/sites-available folder.
cp DRP/DRP_nginx /etc/nginx/sites-available
Create a symlink between /etc/nginx/sites-available/DRP_nginx and /etc/nginx/sites-enabled/DRP_nginx
ln -s sites-available/DRP_nginx sites-enabled/DRP_nginx
Copy DRP_uwsgi.ini file to the /etc/uwsgi/apps-available folder.
cp DRP/DRP_uwsgi.ini /etc/uwsgi/apps-available
Create a symlink between apps-available/DRP_uwsgi.ini to apps-enabled/DRP_uwsgi.ini
ln -s /etc/uwsgi/apps-available/DRP_uwsgi.ini /etc/uwsgi/apps-enabled/DRP_uwsgi.ini
Note that for symlinks, you may need to create the directory before linking it.
Now, edit each fine. Replace the placeholders with the relevant values. Ex: log path.
Note that the “location” paths in the nginx DRP_nginx file will need to be changed if you are not working on the server.
Now restart both Uwsgi and Nginx:
sudo service uwsgi restart
sudo service nginx restart
Step 5: RDKIT Descriptors
Option 1 (Recommended):
We have a repo setup for a python3 specific build of rdkit which should not clash with other packages in the ubuntu repositories, however, we make no guarantees to that effect, and installation is at your own risk.
In the file /etc/apt/sources.list add the line:
deb [trusted=yes] https://darkreactions.haverford.edu/software ./
If you need to change the permissions on the /etc/apt/sources.list using chmod to edit the file, be sure to change it back and execute
sudo apt-get update
sudo apt-get install python3-rdkit
Option 2 (Manual):
Run
sudo apt-get install bison cmake flux build-essential sqlite3 libsqlite3-dev libboost-all-dev
sudo pip3 install cairocffi
Then, in a directory that is not your main installation directory for DRP.
git clone https://github.com/darkreactions/rdkit.git
Change into the rdkit repository directory and then
export RDBASE=$(pwd)
export LD_LIBRARY_PATH="$(pwd)/lib"
export PYTHONPATH="$(pwd)/lib"
mkdir build
cd build
cmake -DRDK_BUILD_INCHI_SUPPORT=ON -D PYTHON_LIBRARY=/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/libpython3.4.so -D PYTHON_INCLUDE_DIR=/usr/include/python3.4/ -D PYTHON_EXECUTABLE=/usr/bin/python3.4 -DBOOST_ROOT=/usr/lib/x86_64-linux-gnu/ ..
make install
ctest
If any of this generates an error, unless you are very familiar with compiling new code for linux operating systems, seek the assistance of Philip Adler via the rdkit repository provided in this document.
Otherwise:
unset LD_LIBRARY_PATH unset RDBASE unset PYTHONPATH
cd ../rdkit
`sudo ln -s "$(pwd)" /usr/lib/python3.4/rdkit
cd ../lib
sudo cp -i *.so.2 /usr/lib
python3.4 -c "import rdkit.Chem"
If that runs without error messages, congratulations, you have compiled and installed rdkit for use with DRP.
Step 6: Installing Chemaxon (optional)
Follow the documentation to install and validate your license for * Chemaxon.
In order to install the license files (.cxl), you must open one of the ChemAxon programs (e.g. MarvinView, MarvinSketch) and navigate to the help > licenses tab. From there you can install the license files.
The deb package can be installed as follows:
sudo apt install ./packagename.deb (or /path/to/package/name.deb)
Chemaxon can then be found at:
/opt/chemaxon
When setting the Chemaxon directory in settings.py, make sure to point to the bin file, ie:
CHEMAXON_DIR = {version:/path/to/marvinsuite/bin/}
Step 7: Remaining loose ends
Make sure you run the command:
./manage.py migrate
If you are experiencing errors with management commands, make sure you are in the right directory and try putting Python3 or whichever Python is relevant before the command. Additionally, try restarting nginx and uwsgi.
General Information
Logging in When first registering through the website on a server, the user is default inactive. You must run:
./manage.py createsuperuser
Enter your new username and password.
Login to the website with /admin at the end of the URL
Go into the users and change the new user to active and whatever permissions you deem necessary.
Release Versions:
DRP is distributed in release versions. To use a specific version of the code, use the following template command: git checkout <version number> Git guidelines
Git Hooks
DRP comes distributed with a number of useful git hooks in the drp_hooks directory in this repo. These warn you if the expected structure of the settings.py file changes, or if you need to run database migrations for the DRP Django application. They also remove orphaned .pyc files, which have been known to confuse the test suite historically. These should be added to your local git repository as per the git documentation.
Server settings
In the DRP repository there is a file DRP_uwsgi.ini and another DRP_nginx. Both should be modified to suit your local server after having been placed in the relevant locations:
