This is Rest API for conformal prediction based virtual screening. Play framework is being used for developing this API. The service is available at https://ptpaas.service.pharmb.io/
For this material, we assume that Docker and Git are already installed on your local system. If you want to prepare the Docker images yourself, then first perform section 2 and then start from section 1.2. Section 3 contains some extra docker commands which can be useful if you want to test both ready made and custom build docker images.
docker run hello-world
You would need to use sudo in front of all the docker commands if post docker installation was not followed. Details are available here https://docs.docker.com/install/linux/linux-postinstall/
docker pull laeeq/ligandprofiledb:0.0.3
docker pull laeeq/cpvsapi:1QCF-0.0.1
docker run --detach --name test-mariadb -d laeeq/ligandprofiledb:0.0.3
docker ps
docker logs test-mariadb
docker inspect test-mariadb | grep IPAddress
Now we know the IP Address where the database is running, so we would be able to connect it. In our case, it was 172.17.0.2.
docker exec -it test-mariadb bash
mysql -uroot -pmariadb_root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.17.0.%' IDENTIFIED BY 'mariadb_root' WITH GRANT OPTION;
exit
exit
Note: You must use the correct MARIADB_IP you found in the section 1.5, otherwise the cpvsapi docker container won’t be able to connect the MariaDB database.
docker run --detach --name test-cpvs -e MARIADB_IP='172.17.0.2' -e MARIADB_PASSWORD='mariadb_root' -e RECEPTOR_NAME='HCK Tyrosine kinase' -e RECEPTOR_PDBCODE='1QCF' --link test-mariadb:mariadb -p 9000:9000 laeeq/cpvsapi:1QCF-0.0.1
So what have we done here? We executed a new container test-cpvs and using --link
we linked it to the test-mariadb docker container which was already running. -p 9000:9000
is used to publish test-cpvs port to localhost.
Open any web browser and access the 9000 port of the running test-cpvs Docker container we published to the local machine. Try the following in any web browser.
http://localhost:9000
If everything works, you should see a swagger rest ui for cpvs. There are three end points of the CPVS API that can be tested i.e. predictions, pvalues and docking. Click anyone by try it out by giving compound in SMILES format. A sample SMILE is given below:
CC(C)c1ccc(Nc2nccc(n2)c3cnn4ncccc34)cc1
Note: Java 8, Maven and sbt 1.1.6 must be installed on local for section 2 and JAVA_HOME must be set
Clone spark-cheminformatics utilities for tools like signature generation
git clone https://github.com/mcapuccini/spark-cheminformatics.git
Enter the newly cloned directory. There are two projects parsers and sg. Enter both of them and run the following maven command to install each one of them as local dependencies.
mvn clean install -DskipTests
Clone spark-cpvs-vina project
git clone https://github.com/laeeq80/spark-cpvs-vina.git
Enter the project vs inside spark-cpvs-vina and run the command
mvn clean install -DskipTests
We need a Docker container for MariaDB that stores the models created using cpvs project.
Use git clone to clone the repo https://github.com/laeeq80/ligandProfiledb to create MariaDB Docker image including the database with 1QCF model.
git clone https://github.com/laeeq80/ligandProfiledb.git
Use the following command to create the Docker image at CLI from inside the cloned directory. The Dockerfile also includes the database copying step.
Enter the ligandprofiledb directory and run the following command
docker build . -t laeeq/ligandprofiledb:0.0.3
!! Step 6/8 in the Dockerfile can take upto 5 minutes. Grab a coffee.
2.3 Building cpvsapi Docker image for one of the receptor i.e. with PDB ID “1QCF”. The pdbqt for the 1QCF is already available in the cpvsapi repo.
Get out of the ligandprofiledb directory and run the following command.
git clone https://github.com/laeeq80/cpvsAPI.git
The pdbqt for the 1QCF and other resources are already available in the this repo resources folder.
Enter the cpvsAPI and run the following command
sbt dist
The above command will create cpvsapi-1.0.zip file in the cpvsAPI/target/universal/ directory that is needed while building cpvsapi Docker image in step 2.3.4. In addition, openbabel-2.4.1.tar.gz will also be required that the application uses to convert files into different formats. Openbabel can be downloaded online using
wget https://sourceforge.net/projects/openbabel/files/openbabel/2.4.1/openbabel-2.4.1.tar.gz
If wget is not available on your system, you can use a web browser to get it.
git clone https://github.com/laeeq80/cpvsDocker.git
Copy cpvsapi-1.0.zip and openbabel-2.4.1.tar.gz inside the cpvsDocker directory and run the following command from cpvsDocker directory.
docker build . -t laeeq/cpvsapi:1QCF-0.0.1
This will take around 15 to 20 minutes. Grab another coffee. [:D]
Goto Step 1.2 to test the newly created Docker images.
docker image ls
docker rmi imageID
docker ps
docker ps -a
docker stop containerName
docker rm containerName
E.g.
docker stop test-cpvs
The step-by-step guide ends here.
If you want to create a docker container for a new receptor, please consider the following steps.
We deployed the service using the deployment script available at https://github.com/pharmbio/dpaas. The script can be utilized to deploy image for a new receptor. Pick any receptor yaml file as template from the link provided and make a new yaml file for the new receptor Docker image accordingly.
Then if you want to view and use the newly deployed Docker container in the Web service UI, add the PDB ID of the new receptor to the cpvs ui https://github.com/laeeq80/cpvs-ui/blob/master/index.html#L173
Create new Docker image for the cpvs ui https://github.com/laeeq80/dpaasDockerfiles/tree/master/cpvsUIDocker
Deploy the new Docker image for UI as done in https://github.com/pharmbio/dpaas
If you want to further improve CPVSAPI and make any changes, you need to know the CPVSAPI environment variables.
MARIADB_IP //IP of machine where MariaDB is running. We are using MariaDB default port i.e. 3306 MARIADB_PASSWORD //MariaDB root password OBABEL_HOME //OBabel Location on local computer RESOURCES_HOME //Direct to resources file in cpvsapi VINA_CONF //Configuration file used for AutoDock Vina RECEPTOR_NAME //Name of the Receptor RECEPTOR_PDBCODE //Pdb Code of the Receptor
One can also use resources.sh to set up the last four environment variables, which is convenient, using the following command.
source resources.sh receptor_name receptor_pdbCode