{{ app.meta_title }}

local_offer {{ tag }}
Get Started chevron_right
code

playsdk v.0.1 documentation (Python)

A practical introduction to the Python client to consume PlayMolecule Web Services (PMWS)

Obtain your API key here chevron_right

code Index

  • 0. Introduction
  • 1. playskd Installation
  • 1.1 Miniconda installation
  • 1.2 playsdk installation
  • 2. Session object
  • 2.1 session = Session([token])
  • 2.2 session.listApps()
  • 2.3 job = session.startApp([appName])
  • 2.4 session.listJobs()
  • 2.5 session.getJob([jobId])
  • 3. Job object
  • 2.1 job.describe()
  • 2.2 job.argName = [value]
  • 2.3 job.submit()
  • 2.4 job.getStatus()
  • 2.5 job.retrieve()

code 0. Introduction

PlayMolecule client is a library whose intention is to abstract complex and computationally intensive applications so that any user can run applications in the Cloud within few commands.

To do so, we leverage the power of the Python programming language to setup, submit, run and retrieve jobs seamlessly. The library is practical in its approach: select your app of choice, instantiate a job the app, fill in the required arguments, submit the job and finally retrieve the results with very simple commands.

PlayMolecule client lets you focus on the research while PlayMolecule Web Services takes care of the rest.

code 1.  Installation

2.1 Miniconda installation

Install miniconda from the conda repository.

2.2 playsdk installation

Install the PlaySDK package by running:

conda -c acellera install playmolecule

Now you can use playsdk from your favorite python editor, such as the interactive shell ipython.

code 2. Session object

2.1 session = Session([token])

Allows to create a PlayMolecule Web Services (PMWS) session with credentials provided by the API key (token). Remember that you can find your API key in the user page after you logged in.

from playmolecule import Session # we import the module session = Session("094u0fjkfddkd4103kdf4kr0dfdd3341") # we include our API key

From this point on, we assume you have created a session with your valid API key.

2.2 session.listApps()

Lists all available apps and describes them shortly. The field Name is a unique identifier used to launch new jobs.

session.listApps()
Name                           Description
ProteinPrepare       Prepare a protein for MD simulations using PROPKA 3.1 for residue titration and PDB2PQR 2.1 to optimize the hydrogen bond network.
DeepSite             Scan a protein for ligand binding sites using a convolutional neural network-based predictor.
Kdeep                Predict the binding affinity of a set of ligands to their receptor.
BindScope            Perform virtual screening of a library of ligands and score them with a probability of binding to given receptor.

2.3 job = session.startApp([appName])

Allows to instantiate an application with name appName, creating a new Job object.

job = session.startApp("ProteinPrepare")

2.4 session.listJobs()

Displays the status of current existing jobs, including the jobid and the status.

session.listJobs()
ID                                    Status
be4342da-90b5-45d6-8f04-71b4f6d4f3de  Running
cfeab8ff-c448-41bf-8994-d99236110939  Running
da9423f1-e0d0-47ef-969b-0590dc971009  Running 

2.5 session.getJob([jobId])

Instantiates a Job object from an existing known jobId.

job = session.getJob('be4342da-90b5-45d6-8f04-71b4f6d4f3de')

code 3. Job object

3.1 job.describe()

Describes the Job and lists the arguments accepted by a particular application. Default values for each argument are visible in the Value column.

job = session.startApp("ProteinPrepare") job.describe()
Name                           Type       Mandatory  Value      Description
pH                              float      False      7.2        pH at which residues will be titrated (default: 7.2)
chain                           string     False      all        chains to be used in ProteinPrepare (e.g.: -chain A B; default: all)
mutations                       string     False                 residue mutations structured as :# where resname is an aminoacid in standard abbreviation (e.g. ALA) or REMOVE (e.g.: -mutate A:2#GLY)
webOut                          bool       False      False      Generate web-related content (default: False)
details                         bool       False      False      return details of the protonation (default: False)
removeWater                     bool       False      False      ignore water molecules in the optimization (default: False)
includeHeteroatoms              bool       False      False      include heteroatoms in the optimization (default: False)
pdb                             fileORstring True       None       .pdb file of the receptor.         

3.2 job.argName = [value]

Arguments/attributes for an application can be inputted through the job.argName = [value] notation.

job.pH = 6.2

Note how the Value field for the argument changes in respect the previous default value.

job.describe()
Name                           Type       Mandatory  Value      Description
pH                              float      False      6.2        pH at which residues will be titrated (default: 7.2)
chain                           string     False      all        chains to be used in ProteinPrepare (e.g.: -chain A B; default: all)
mutations                       string     False                 residue mutations structured as :# where resname is an aminoacid in standard abbreviation (e.g. ALA) or REMOVE (e.g.: -mutate A:2#GLY)
webOut                          bool       False      False      Generate web-related content (default: False)
details                         bool       False      False      return details of the protonation (default: False)
removeWater                     bool       False      False      ignore water molecules in the optimization (default: False)
includeHeteroatoms              bool       False      False      include heteroatoms in the optimization (default: False)
pdb                             fileORstring True       None       .pdb file of the receptor.

3.3 job.submit()

Submits a Job.

job = session.startApp("ProteinPrepare") job.pdb = "protein.pdb" job.pH = 5.6 job.chain = "A B" job.mutations = "A:341#ALA A:70#GLU" job.submit()
Submiting app: 181e92a1-e19b-4b6d-a8e4-85f608fabe46
Configuration uploaded
Input data uploaded
Execution submited. Execution ID: 609de9c4-b536-4766-9b6b-19a4e64569d6

3.4 job.getStatus()

Retrieves the status of a Job.

job.getStatus()
Status: Running

3.5 job.retrieve()

Retrieves the Job at the folder specified in job.output (by default the current directory).

job.retrieve()
Retrieving data of execution: 609de9c4-b536-4766-9b6b-19a4e64569d6
Data retrieved.

A folder with the id of the job will be created with the contents of the application output.

ls 609de9c4-b536-4766-9b6b-19a4e64569d6/
output.pdb