Opal Client
From NBCR Public Wiki
Introduction
We currently have generic opal clients available in Python and Java.
Opal Python Client
The generic Python client GenericServiceClient.py lets you run any opal2 application exposed as an Opal service, and retrieve its status and outputs.
Python Download
If you do not have Python 2.3 or higher installed, then please download it from http://www.python.org and make sure the correct python is in your PATH.
Opal Python client example with PDB2PQR job script
This Python client tarball (http://nbcr.sdsc.edu/pub/wiki/uploads/f/f0/Opal-py-2.2-ex.tar.gz) contains a script that submits a PDB2PQR job, waits for job completion, and then downloads results to the local computer.
Before using running this script, please make sure wget is installed in your computer. If not, then please download it from ftp://aeneas.mit.edu/pub/gnu/wget/
To use this PDB2PQR script, you will first need to untar the tarball, and then go to the runPDB2PQR directory. From the runPDB2PQR directory, simply run ./runPDB2PQR.sh
dyn137-110-111-179:~ wilfred$ cd Downloads/ dyn137-110-111-179:Downloads wilfred$ cd opal-py-2.2-ex dyn137-110-111-179:opal-py-2.2-ex wilfred$ cd runPDB2PQR/ dyn137-110-111-179:runPDB2PQR wilfred$ ls 1hpx.pdb PDB2PQR_results runPDB2PQR.sh runPDB2PQR.sh~ dyn137-110-111-179:runPDB2PQR wilfred$ ./runPDB2PQR.sh This script will run the PDB2PQR service on http://ws.nbcr.net and download results in directory PDB2PQR_results Launching remote Pdb2pqrOpalService job Received Job ID: app1265992214695 Base Output URL: http://ws.nbcr.net/app1265992214695 queryStatus returned: Launching executable queryStatus returned: Launching executable queryStatus returned: Launching executable queryStatus returned: Launching executable queryStatus returned: ACTIVE queryStatus returned: ACTIVE queryStatus returned: ACTIVE queryStatus returned: DONE - check outputs to verify successful execution Retrieving Pdb2pqrOpalService output metadata: Standard Output: http://ws.nbcr.net/app1265992214695/stdout.txt Standard Error: http://ws.nbcr.net/app1265992214695/stderr.txt 1hpx.pdb : http://ws.nbcr.net/app1265992214695/1hpx.pdb output-typemap.html : http://ws.nbcr.net/app1265992214695/output-typemap.html output.pqr : http://ws.nbcr.net/app1265992214695/output.pqr Downloading stdout.txt as /Users/wilfred/Downloads/opal-py-2.2-ex/runPDB2PQR/PDB2PQR_results/stdout.txt Downloading stderr.txt as /Users/wilfred/Downloads/opal-py-2.2-ex/runPDB2PQR/PDB2PQR_results/stderr.txt Downloading 1hpx.pdb as /Users/wilfred/Downloads/opal-py-2.2-ex/runPDB2PQR/PDB2PQR_results/1hpx.pdb Downloading output-typemap.html as /Users/wilfred/Downloads/opal-py-2.2-ex/runPDB2PQR/PDB2PQR_results/output-typemap.html Downloading output.pqr as /Users/wilfred/Downloads/opal-py-2.2-ex/runPDB2PQR/PDB2PQR_results/output.pqr
Opal Python Client Download
Download the opal-py-2.2 release from http://sourceforge.net/projects/opaltoolkit/files/ Note: the generic opal client can be only found in opal-py-2.2.
If you do not have Python 2.3 or higher installed, then please download it from http://www.python.org and make sure the correct python is in your PATH.
Opal Python Client Set Up
Please update your PYTHONPATH before using the client, because python client will only work with the special ZSI inside the Opal python tarball.
First, please go to opal-py-$VERSION/ where all the sources are expanded.
cd opal-py-$VERSION
If you are using a bash shell on Unix, you can execute:
export PYTHONPATH=./prereqs/ZSI-2.1_a2-py2.6.egg:$PYTHONPATH
If you are using a tcsh shell, you can execute:
setenv PYTHONPATH ./prereqs/ZSI-2.1_a2-py2.6.egg:${PYTHONPATH}
Using opal python client with ws.nbcr.net web services
PDB2PQR Example
Suppose you want to run the PDB2PQR (http://www.poissonboltzmann.org/pdb2pqr/) Opal service from http://ws.nbcr.net to convert the input 1hpx.pdb (http://www.nbcr.net/ws_help/PDB2PQR/sample_inputs/1hpx.pdb) to the output 1hpx.pqr, then you can launch a PDB2PQR job with this command.
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r launchJob \
-a "--ff=amber 1hpx.pdb output.pqr" \
-f 1hpx.pdb
If you just want to get the PDB file from RCSB website, you may do the following using PDB2PQR command line syntax:
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r launchJob \
-a "--ff=amber 1hpx output.pqr" \
You can retrieve job status by running the following command:
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r queryStatus \
-j <job_id>
Once the job has finished executing, you can also retrieve output metadata using:
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r getOutputs \
-j <job_id>
Autogrid Example
The following command can be used to launch an Autogrid (http://autodock.scripps.edu/wiki/AutoGrid) Opal job on input receptor 2HTY_A.pdbqt (http://www.nbcr.net/ws_help/Autogrid/sample_inputs/2HTY_A.pdbqt) and input paramter file 2HTY_A.gpf (http://www.nbcr.net/ws_help/Autogrid/sample_inputs/2HTY_A.gpf) to generate output 2HTY_A.glg and some coordinate files.
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/AutogridOpalService \
-r launchJob \
-a "-p 2HTY_A.gpf -l 2HTY_A.glg 2HTY_A.pdbqt" \
-f "2HTY_A.pdbqt,2HTY_A.gpf"
APBS Example
The following command can be used to launch an APBS (http://www.poissonboltzmann.org/apbs/) Opal job on input files 1hpx.in (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.in) and 1hpx.pqr (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.pqr).
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/ApbsOpalService \
-r launchJob \
-a 1hpx.in \
-f "1hpx.pqr,1hpx.in"
Prepare Receptor Example
The following command can be used to launch a Prepare Receptor job that converts 1hpx.pqr (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.pqr) to 1hpx.pdbqt.
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/PrepareReceptorOpalService \
-r launchJob \
-a "-r 1hpx.pqr" \
-f 1hpx.pqr
Prepare GPF Example
The following command can be used to launch a Prepare GPF job that based the GPF based on receptor 2HTY_A.pdbqt (http://www.nbcr.net/ws_help/PrepareGPF/sample_inputs/2HTY_A.pdbqt) and ligand diversity0001.pdbqt (http://www.nbcr.net/ws_help/PrepareGPF/sample_inputs/diversity0001.pdbqt).
python GenericServiceClient.py \
-l http://ws.nbcr.net/opal2/services/PrepareGPFOpalService \
-r launchJob \
-a "-r 2HTY_A.pdbqt -l diversity0001.pdbqt" \
-f "diversity0001.pdbqt,2HTY_A.pdbqt"
Using opal python client if have you opal server set up on localhost
To launch a job using the Opal client, you could use the following command, which displays the resulting job id, along with the preliminary status.
python GenericServiceClient.py \
-l http://localhost:8080/opal2/services/$service_name \
-r launchJob \
-a $commandline_arguments \
-f $input_file_paths
You can retrieve job status by running the following command:
python GenericServiceClient.py \
-l http://localhost:8080/opal2/services/$service_name \
-r queryStatus \
-j <job_id>
Once the job has finished executing, you can also retrieve output metadata using:
python GenericServiceClient.py \
-l http://localhost:8080/opal2/services/$service_name \
-r getOutputs \
-j <job_id>
You may need to change the above URL if you used a different port, or are running the client from another machine. Note that you can get the complete usage information for the client by using the following command:
python GenericServiceClient.py
Opal Perl Client
A preliminary example using a perl client is also available for download at http://sourceforge.net/projects/opaltoolkit/files/, with documentation at http://www.nbcr.net/software/opal/docs/1.9/opal-perl-index.html
Opal Java Client
A generic Java client is implemented by the class located in $OPAL_HOME/src/edu/sdsc/nbcr/opal/GenericServiceClient.java. It lets you run any application exposed as an Opal service, and retrieve its status and outputs.
Opal Java Client Download
Download the newest opal2-core-java release from http://sourceforge.net/projects/opaltoolkit/files/
If you don't have Java installed, then you may download it from http://www.java.com/en/download/
If you don't have ant installed, then you may download it from http://ant.apache.org/
Opal Java Client Set Up
To compile the client, perform the following step from inside the $OPAL_HOME directory.
$ANT_HOME/bin/ant jar
Before running the client, set your classpath using the etc/classpath.bat|(c)sh script depending on the OS/shell you use - e.g. if you use tcsh on Unix, set your classpath by typing the following command:
source etc/classpath.sh
Using opal java client with ws.nbcr.net web services
PDB2PQR Example
Suppose you want to run the PDB2PQR (http://www.poissonboltzmann.org/pdb2pqr/) Opal service from http://ws.nbcr.net to convert the input 1hpx.pdb (http://www.nbcr.net/ws_help/PDB2PQR/sample_inputs/1hpx.pdb) to the output 1hpx.pqr, then you can launch a PDB2PQR job with this command.
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r launchJob \
-a "--ff=amber 1hpx.pdb output.pqr" \
-f 1hpx.pdb
You can retrieve job status by running the following command:
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r queryStatus \
-j <job_id>
Once the job has finished executing, you can also retrieve output metadata using:
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/Pdb2pqrOpalService \
-r getOutputs \
-j <job_id>
Autogrid Example
The following command can be used to launch an Autogrid (http://autodock.scripps.edu/wiki/AutoGrid) Opal job on input receptor 2HTY_A.pdbqt (http://www.nbcr.net/ws_help/Autogrid/sample_inputs/2HTY_A.pdbqt) and input paramter file 2HTY_A.gpf (http://www.nbcr.net/ws_help/Autogrid/sample_inputs/2HTY_A.gpf) to generate output 2HTY_A.glg and some coordinate files.
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/AutogridOpalService \
-r launchJob \
-a"-p 2HTY_A.gpf -l 2HTY_A.glg 2HTY_A.pdbqt" \
-f "2HTY_A.pdbqt,2HTY_A.gpf"
APBS Example
The following command can be used to launch an APBS (http://www.poissonboltzmann.org/apbs/) Opal job on input files 1hpx.in (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.in) and 1hpx.pqr (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.pqr).
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/ApbsOpalService \
-r launchJob \
-a 1hpx.in \
-f "1hpx.pqr,1hpx.in"
Prepare Receptor Example
The following command can be used to launch a Prepare Receptor job that converts 1hpx.pqr (http://www.nbcr.net/ws_help/APBS_SERIAL/sample_inputs/1hpx.pqr) to 1hpx.pdbqt.
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/PrepareReceptorOpalService \
-r launchJob \
-a"-r 1hpx.pqr" \
-f 1hpx.pqr
Prepare GPF Example
The following command can be used to launch a Prepare GPF job that based the GPF based on receptor 2HTY_A.pdbqt (http://www.nbcr.net/ws_help/PrepareGPF/sample_inputs/2HTY_A.pdbqt) and ligand diversity0001.pdbqt (http://www.nbcr.net/ws_help/PrepareGPF/sample_inputs/diversity0001.pdbqt).
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://ws.nbcr.net/opal2/services/PrepareGPFOpalService \
-r launchJob \
-a"-r 2HTY_A.pdbqt -l diversity0001.pdbqt" \
-f "diversity0001.pdbqt,2HTY_A.pdbqt"
Using opal java client if have you opal server set up on localhost
To launch a job using the Opal client, you could use the following command, which displays the resulting job id, along with the preliminary status.
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://localhost:8080/opal2/services/$service_name \
-r launchJob \
-a $commandline_arguments \
-f $input_file_paths
If your arguments contain characters like "-", you will have to put your whole set of arguments within quotes that are escaped (\"..\"). If your arguments don't have special characters like the above, you can simply use regular quotes ("..").
You can retrieve job status by running the following command:
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://localhost:8080/opal2/services/$service_name \
-r queryStatus \
-j <job_id>
Once the job has finished executing, you can also retrieve output metadata using:
java edu.sdsc.nbcr.opal.GenericServiceClient \
-l http://localhost:8080/opal2/services/$service_name \
-r getOutputs \
-j <job_id>
You may need to change the above URL if you used a different port, or are running the client from another machine. Note that you can get the complete usage information for the client by using the following command:
java edu.sdsc.nbcr.opal.GenericServiceClient
Advanced Examples
Using Vision Workflows with Opal Web Services
Please visit CADD Pipeline (http://nbcr.sdsc.edu/pub/wiki/index.php?title=CADD_Pipeline) for an example how to use to a Vision (http://mgltools.scripps.edu/packages/vision) workflow to run virtual screening with several Opal web services.
Related Links
- Opal Toolkit Official Home Page (http://www.nbcr.net/software/opal/)
- Opal Toolkit Sourceforge Page (http://sourceforge.net/projects/opaltoolkit/)
- NBCR Opal Web Server (http://ws.nbcr.net)
- MGL Tools (http://mgltools.scripps.edu/)

