QDX-py: Python SDK for the QDX API
This package exposes a simple provider and CLI for the different tools exposed by the QDX GraphQL API.
Usage
As a library
import json
from pathlib import Path
import qdx
from qdx.data import run_convert, QDXV1QCMol, QDXV1QCInput
URL = "url to the qdx api"
TOKEN = "your qdx access token"
# get our client to talk with the API
client = qdx.QDXProvider(url=URL,
access_token=TOKEN)
# path to protein pdb with correct charges and protonation
protein_pdb = Path("./examples/4w9f_prepared_protein.pdb")
# path to ligand sdf with correct charges and protonation
ligand_sdf = Path("./examples/3JU_prepared.sdf")
# convert pdb to qdxf
protein_qdxf = client.obabel_to_complex(file=protein_pdb, format="pdb")
# convert ligand sdf to qdxf
ligand_qdxf = client.obabel_to_complex(file=ligand_sdf, format="sdf")
# We need to treat the ligand as a single fragment
ligand_qdxf["topology"]["fragments"] = [[ x for x, _ in enumerate(ligand_qdxf["topology"]["symbols"])]]
ligand_qdxf["topology"]["fragment_charges"] = [0]
# We also need to drop connectivity information (temporary)
ligand_qdxf["topology"]["connectivity"] = []
# fragment protein
fragged_protein = client.fragment_complex(protein_qdxf, backbone_steps=5)
# combine fragmented protein and ligand into a single complex
complex = client.combine_complexes(fragged_protein, ligand_qdxf)
# create a qdx/hermes input file for complex
qdx_input = qdx.data.run_convert(json.dumps(complex), "qdxcomplex2qdxv1")
# Configure input for lattice calculation
qdx_input.model.fragmentation = True
qdx_input.keywords.frag.lattice_energy_calc = True
# The reference monomer should be the final fragment,
# as that will be the ligand
qdx_input.keywords.frag.reference_monomer = len(
qdx_input.molecule.fragments) - 1
qdx_input.keywords.frag.monomer_cutoff = 20
qdx_input.keywords.frag.dimer_cutoff = 10
qdx_input.model.method = "RIMP2"
# Start hermes calculation -
# remember to set tags that reference your system
proc = client.start_quantum_energy_calculation(
qdx_input, tags=["rimp2", "4w9f", "3ju", "manual_prep", "debug_charges"])
# Fetch results - you will have to run this multiple times until
# the calculation is done
result = client.get_proc(proc)
As a CLI
# All cli calls have these standard arguments, referred to as … in future examples
qdx --url QDX_API_URL --access-token QDX_ACCESS_TOKEN
# Post a hermes job, returning a task id
… --post-quantum-energy < ./path_to_qdxv1_input.json
# Retrieve the hermes job, or its progress
… --get-proc TASK_ID
## Other functions
# Return a qdx complex json object and save it as complex.json
… --pdb-to-complex PATH_TO_PDB_FILE > complex.json
# Prepare a protein for quauntum energy calculation
… --prepare-protein simulation --poll < ./complex.json > prepped_protein_complex.json
# Fragment a qdx complex json object
… --fragment-complex [MIN_STEPS_ALONG_PROTEIN_BACKBONE_BEFORE_CUTTING_AT_C-C_BOND] < prepped_protein_complex.json > fragmented_protein_complex.json
# Prepare a ligand for quauntum energy calculation
… --prepare-ligand simulation --poll < ./path_to_ligand.sdf > prepped_ligand_complex.json
# Combine protein and ligand complexes for simulation
… --combine-complexes ./prepped_protein_complex.json < ./prepped_ligand_complex.sdf > protein_ligand_complex.json
# Convert a qdx complex into a qdx input file
… --convert ./protein_ligand_complex.json --direction qdxcomplex2qdxv1 > qdx_input.json
# Convert a qdx complex into a exess input file
… --convert ./protein_ligand_complex.json --direction qdxcomplex2exess > exess_input.json
# Convert a qdx input file into an exess input file
… --convert qdx_input.json --direction qdxv12exess > exess_input.json
Metadata
Release files for qdx 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qdx-0.10.0.tar.gz | 14.8 kB | Without provenance | Details for qdx-0.10.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qdx-0.10.0-py3-none-any.whl | Python 3 | none | any | Details for qdx-0.10.0-py3-none-any.whl |
Total release size: 29.7 kB
Release files / qdx-0.10.0.tar.gz
| Download URL | qdx-0.10.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
630ee5994e2981b28ebb5f48b1e7bc8181ce8cd2c5bdc5913564b73ca754d886
|
|
BLAKE2b-256 checksum How to use checksums |
4e03c1d5f780f9e0b64983a028bf1d90f6ac0af23445ec31b8132aaca29b011c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.10 Linux/6.2.12-zen1
|
Release files / qdx-0.10.0-py3-none-any.whl
| Download URL | qdx-0.10.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9f772039279aa823613e4e9faea9b243c36621f6c4e53c0eba0c08a441620bc
|
|
BLAKE2b-256 checksum How to use checksums |
9364c4a4308c35adb74b7fc72d5648348427de2e2f132d42dd41a5913bd3ca65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.10 Linux/6.2.12-zen1
|
Security for qdx 0.10.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.