aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/action.yml35
-rw-r--r--Dockerfile4
-rw-r--r--scripts/makeReport.py269
-rw-r--r--scripts/quick-ligand-protein.py71
4 files changed, 276 insertions, 103 deletions
diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 3ec75c1..b3b7284 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -9,13 +9,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Deploy Step
- uses: docker/build-push-action@v1
- with:
- username: ${{ secrets.DOCKER_HUB_USER }}
- password: ${{ secrets.DOCKER_HUB_TOKEN }}
- #repository: navanchauhan/curie-cli
- #tag_with_ref: true
- tags: latest
- #image: navanchauhan/curie-cli
- registry: docker.io
+ - name: Prepare
+ id: prepare
+ run: |
+ DOCKER_IMAGE=navanchauhan/curie-cli
+ DOCKER_PLATFORMS=linux/amd64,linux/arm64
+ VERSION=latest
+ TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
+
+ echo ::set-output name=docker_image::${DOCKER_IMAGE}
+ echo ::set-output name=version::${VERSION}
+ echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
+ --build-arg VERSION=${VERSION} \
+ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
+ --build-arg VCS_REF=${GITHUB_SHA::8} \
+ ${TAGS} --file ./Dockerfile ./
+ - name: Prepare Buildx
+ uses: crazy-max/ghaction-docker-buildx@v3
+ - name: Docker Login
+ env:
+ DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USER }}
+ DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_TOKEN }}
+ run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
+ - name: Docker Buildx (push)
+ run: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
+
diff --git a/Dockerfile b/Dockerfile
index 78890d7..32fbc30 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,7 +23,7 @@ RUN apt-get update && apt-get install -y \
# copy PLIP source code
WORKDIR /src
-ADD plip/ plip/
+COPY plip/ plip/
RUN chmod +x plip/plipcmd.py
ENV PYTHONPATH $PYTHONPATH:/src
@@ -35,7 +35,7 @@ RUN ./run_all_tests.sh
# scripts
WORKDIR /src
-ADD scripts/ scripts/
+COPY scripts/ scripts/
RUN chmod +x /src/scripts/main.sh
RUN python3 -m pip install untangle tabulate
diff --git a/scripts/makeReport.py b/scripts/makeReport.py
index 79d9c70..2a32d29 100644
--- a/scripts/makeReport.py
+++ b/scripts/makeReport.py
@@ -1,8 +1,8 @@
#!/usr/bin/python3
-import argparse
+import argparse
parser = argparse.ArgumentParser(description="Make Report Helper Script")
-parser.add_argument("-i","--input",help="Path to report folder")
+parser.add_argument("-i", "--input", help="Path to report folder")
args = parser.parse_args()
@@ -11,147 +11,232 @@ if args.input == None:
exit(1)
path = args.input
-#path = '/Users/navanchauhan/Desktop/nCOV-19/scripts/pymol/test/'
+# path = '/Users/navanchauhan/Desktop/nCOV-19/scripts/pymol/test/'
import untangle
from tabulate import tabulate
-#import sys
-#report = path + "report.md"
-#sys.stdout = open(report, 'w')
+# import sys
+# report = path + "report.md"
+# sys.stdout = open(report, 'w')
from os import listdir
from os.path import isfile, join
+
onlyfiles = [f for f in listdir(path) if isfile(join(path, f))]
image = ""
for x in onlyfiles:
- if '.png' in x and 'UNL' in x:
+ if ".png" in x and "UNL" in x:
image = x
import os
-fname = os.path.join(path,'report.xml')
+
+fname = os.path.join(path, "report.xml")
doc = untangle.parse(fname)
-hi, hb, wb, sb, ps, pc, hab, mc = 0,0,0,0,0,0,0,0
+hi, hb, wb, sb, ps, pc, hab, mc = 0, 0, 0, 0, 0, 0, 0, 0
indexForUNL = 0
for x in doc.report.bindingsite:
- if x.identifiers.longname.cdata == 'UNL':
+ if x.identifiers.longname.cdata == "UNL":
break
else:
indexForUNL += 1
name = doc.report.pdbid.cdata
-#print(("# " + (name.replace("_"," ")).replace("PROTEIN","")), end="\n\n")
+# print(("# " + (name.replace("_"," ")).replace("PROTEIN","")), end="\n\n")
+fallback = 0
-print("## Visualisation", end="\n\n")
-print(f'![]({image})', end="\n\n")
+print("## Visualisation", end="\n\n")
+print(f"![]({image})", end="\n\n")
-print("## Interactions", end="\n\n")
+natural_ligands = []
+showNaturalLigands = True
+
+try:
+ for x in range(len(doc.report.bindingsite)):
+ if doc.report.bindingsite[x]["has_interactions"] == "True" and x != indexForUNL:
+ natural_ligands.append(x)
+except:
+ fallback == 1
+
+if natural_ligands == []:
+ showNaturalLigands == False
+
+for ligand in natural_ligands:
+ print("### Natural Ligand " + str(x), end="\n\n")
+ if doc.report.bindingsite[ligand].interactions.hydrophobic_interactions.cdata == "":
+ print("No Hydrophobic Interactions Found", end="\n\n")
+ else:
+ print("#### Hydrophobic Interactions", end="\n\n")
+ tableBody = []
+ tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"]
+ i = 1
+ for x in doc.report.bindingsite[
+ ligand
+ ].interactions.hydrophobic_interactions.hydrophobic_interaction:
+ l = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist.cdata)
+ l.append(x.ligcarbonidx.cdata)
+ l.append(x.protcarbonidx.cdata)
+ i += 1
+ tableBody.append(l)
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+ if doc.report.bindingsite[ligand].interactions.hydrogen_bonds.cdata == "":
+ print("No Hydrogen Bonds Found", end="\n\n")
+ else:
+ print("## Hydrogen Bonds", end="\n\n")
+ tableBody = []
+ tableHeaders = [
+ "No.",
+ "Res.",
+ "AA",
+ "Dist H-A",
+ "Dist D-A",
+ "Don Angle",
+ "Protisdon?",
+ "Sidechain?",
+ "D. Atom",
+ "A. Atom",
+ ]
+ i = 1
+ for x in doc.report.bindingsite[
+ ligand
+ ].interactions.hydrogen_bonds.hydrogen_bond:
+ l = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist_h_a.cdata)
+ l.append(x.dist_d_a.cdata)
+ l.append(x.don_angle.cdata)
+ l.append(x.protisdon.cdata)
+ l.append(x.sidechain.cdata)
+ l.append((x.donoridx.cdata + "[" + x.donortype.cdata + "]"))
+ l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
+ i += 1
+ tableBody.append(l)
+ # print(i, x.resnr.cdata, x.restype.cdata, x.dist_h_a.cdata, x.dist_d_a.cdata, x.don_angle.cdata, x.protisdon.cdata, x.sidechain.cdata, (x.donoridx.cdata + "[" + x.donortype.cdata + "]"), (x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+
+print("## Ligand Interactions", end="\n\n")
-fallback = 0
try:
- if doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata == '':
+ if (
+ doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata
+ == ""
+ ):
print("No Hydrophobic Interactions Found", end="\n\n")
else:
print("**Hydrophobic Interactions Found**", end="\n\n")
hi = 1
except AttributeError:
- fallback=1
+ fallback = 1
-if fallback==0:
- if doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata == '':
+if fallback == 0:
+ if (
+ doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.cdata
+ == ""
+ ):
print("No Hydrophobic Interactions Found", end="\n\n")
else:
print("**Hydrophobic Interactions Found**", end="\n\n")
hi = 1
- if doc.report.bindingsite[indexForUNL].interactions.hydrogen_bonds.cdata == '':
+ if doc.report.bindingsite[indexForUNL].interactions.hydrogen_bonds.cdata == "":
print("No Hydrogen Bonds Found", end="\n\n")
else:
print("**Hydrogen Bonds Found**", end="\n\n")
hb = 1
- if doc.report.bindingsite[indexForUNL].interactions.water_bridges.cdata == '':
+ if doc.report.bindingsite[indexForUNL].interactions.water_bridges.cdata == "":
print("No Water Bridges Found", end="\n\n")
else:
print("**Water Bridges Found**", end="\n\n")
wb = 1
- if doc.report.bindingsite[indexForUNL].interactions.salt_bridges.cdata == '':
+ if doc.report.bindingsite[indexForUNL].interactions.salt_bridges.cdata == "":
print("No Salt Bridges Found", end="\n\n")
else:
print("**Salt Bridges Found**", end="\n\n")
sb = 1
- if doc.report.bindingsite[indexForUNL].interactions.pi_stacks.cdata == '':
+ if doc.report.bindingsite[indexForUNL].interactions.pi_stacks.cdata == "":
print("No Pi Stacks Found", end="\n\n")
else:
print("**Pi Stacks Found**", end="\n\n")
ps = 1
- if doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.cdata == '':
+ if (
+ doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.cdata
+ == ""
+ ):
print("No Pi Cation Interactions Found", end="\n\n")
else:
print("**Pi Cation Interactions Found**", end="\n\n")
pc = 1
- if doc.report.bindingsite[indexForUNL].interactions.halogen_bonds.cdata == '':
+ if doc.report.bindingsite[indexForUNL].interactions.halogen_bonds.cdata == "":
print("No Halogen Bonds Found", end="\n\n")
else:
print("** Halogen Bonds Found**", end="\n\n")
hab = 1
- if doc.report.bindingsite[indexForUNL].interactions.metal_complexes.cdata == '':
- print("No Metal Complexes Found", end="\n\n")
+ if doc.report.bindingsite[indexForUNL].interactions.metal_complexes.cdata == "":
+ print("No Metal Complexes Found", end="\n\n")
else:
print("**Metal Complexes Found**", end="\n\n")
mc = 1
if fallback == 1:
- if doc.report.bindingsite.interactions.hydrophobic_interactions.cdata == '':
+ if doc.report.bindingsite.interactions.hydrophobic_interactions.cdata == "":
print("No Hydrophobic Interactions Found", end="\n\n")
else:
print("**Hydrophobic Interactions Found**", end="\n\n")
hi = 1
- if doc.report.bindingsite.interactions.hydrogen_bonds.cdata == '':
+ if doc.report.bindingsite.interactions.hydrogen_bonds.cdata == "":
print("No Hydrogen Bonds Found", end="\n\n")
else:
print("**Hydrogen Bonds Found**", end="\n\n")
hb = 1
- if doc.report.bindingsite.interactions.water_bridges.cdata == '':
+ if doc.report.bindingsite.interactions.water_bridges.cdata == "":
print("No Water Bridges Found", end="\n\n")
else:
print("**Water Bridges Found**", end="\n\n")
wb = 1
- if doc.report.bindingsite.interactions.salt_bridges.cdata == '':
+ if doc.report.bindingsite.interactions.salt_bridges.cdata == "":
print("No Salt Bridges Found", end="\n\n")
else:
print("**Salt Bridges Found**", end="\n\n")
sb = 1
- if doc.report.bindingsite.interactions.pi_stacks.cdata == '':
+ if doc.report.bindingsite.interactions.pi_stacks.cdata == "":
print("No Pi Stacks Found", end="\n\n")
else:
print("**Pi Stacks Found**", end="\n\n")
ps = 1
- if doc.report.bindingsite.interactions.pi_cation_interactions.cdata == '':
+ if doc.report.bindingsite.interactions.pi_cation_interactions.cdata == "":
print("No Pi Cation Interactions Found", end="\n\n")
else:
print("**Pi Cation Interactions Found**", end="\n\n")
pc = 1
- if doc.report.bindingsite.interactions.halogen_bonds.cdata == '':
+ if doc.report.bindingsite.interactions.halogen_bonds.cdata == "":
print("No Halogen Bonds Found", end="\n\n")
else:
print("** Halogen Bonds Found**", end="\n\n")
hab = 1
- if doc.report.bindingsite.interactions.metal_complexes.cdata == '':
- print("No Metal Complexes Found", end="\n\n")
+ if doc.report.bindingsite.interactions.metal_complexes.cdata == "":
+ print("No Metal Complexes Found", end="\n\n")
else:
print("**Metal Complexes Found**", end="\n\n")
mc = 1
if fallback == 0:
if hi == 1:
- print("## Hydrophobic Interactions",end="\n\n")
+ print("## Hydrophobic Interactions", end="\n\n")
tableBody = []
- tableHeaders = ['No.','Res.','AA','Dist','Ligand Atom','Proton Atom']
+ tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"]
i = 1
- for x in doc.report.bindingsite[indexForUNL].interactions.hydrophobic_interactions.hydrophobic_interaction:
+ for x in doc.report.bindingsite[
+ indexForUNL
+ ].interactions.hydrophobic_interactions.hydrophobic_interaction:
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -164,11 +249,24 @@ if fallback == 0:
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
if hb == 1:
- print("## Hydrogen Bonds",end="\n\n")
+ print("## Hydrogen Bonds", end="\n\n")
tableBody = []
- tableHeaders = ['No.','Res.','AA','Dist H-A','Dist D-A','Don Angle','Protisdon?','Sidechain?','D. Atom','A. Atom']
+ tableHeaders = [
+ "No.",
+ "Res.",
+ "AA",
+ "Dist H-A",
+ "Dist D-A",
+ "Don Angle",
+ "Protisdon?",
+ "Sidechain?",
+ "D. Atom",
+ "A. Atom",
+ ]
i = 1
- for x in doc.report.bindingsite[indexForUNL].interactions.hydrogen_bonds.hydrogen_bond:
+ for x in doc.report.bindingsite[
+ indexForUNL
+ ].interactions.hydrogen_bonds.hydrogen_bond:
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -182,15 +280,25 @@ if fallback == 0:
l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
i += 1
tableBody.append(l)
- #print(i, x.resnr.cdata, x.restype.cdata, x.dist_h_a.cdata, x.dist_d_a.cdata, x.don_angle.cdata, x.protisdon.cdata, x.sidechain.cdata, (x.donoridx.cdata + "[" + x.donortype.cdata + "]"), (x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
+ # print(i, x.resnr.cdata, x.restype.cdata, x.dist_h_a.cdata, x.dist_d_a.cdata, x.don_angle.cdata, x.protisdon.cdata, x.sidechain.cdata, (x.donoridx.cdata + "[" + x.donortype.cdata + "]"), (x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
if sb == 1:
- print("## Salt Bridges",end="\n\n")
+ print("## Salt Bridges", end="\n\n")
tableBody = []
- tableHeaders = ['Index','Residue','AA','Distance','Protein positive?','Ligand Group','Ligand Atoms']
+ tableHeaders = [
+ "Index",
+ "Residue",
+ "AA",
+ "Distance",
+ "Protein positive?",
+ "Ligand Group",
+ "Ligand Atoms",
+ ]
i = 1
- for x in doc.report.bindingsite[indexForUNL].interactions.salt_bridges.salt_bridge:
+ for x in doc.report.bindingsite[
+ indexForUNL
+ ].interactions.salt_bridges.salt_bridge:
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -206,12 +314,14 @@ if fallback == 0:
tableBody.append(l)
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
- if pc==1:
- print("## Pi Cation Interactions",end="\n\n")
+ if pc == 1:
+ print("## Pi Cation Interactions", end="\n\n")
tableBody = []
- tableHeaders = ['Index','Residue','AA','Distance','Prot charged?','Atoms']
+ tableHeaders = ["Index", "Residue", "AA", "Distance", "Prot charged?", "Atoms"]
i = 1
- for x in doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.pi_cation_interaction:
+ for x in doc.report.bindingsite[
+ indexForUNL
+ ].interactions.pi_cation_interactions.pi_cation_interaction:
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -228,11 +338,15 @@ if fallback == 0:
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
elif fallback == 1:
if hi == 1:
- print("## Hydrophobic Interactions",end="\n\n")
+ print("## Hydrophobic Interactions", end="\n\n")
tableBody = []
- tableHeaders = ['No.','Res.','AA','Dist','Ligand Atom','Proton Atom']
+ tableHeaders = ["No.", "Res.", "AA", "Dist", "Ligand Atom", "Proton Atom"]
i = 1
- for x in doc.report.bindingsite.interactions.hydrophobic_interactions.hydrophobic_interaction:
+ for (
+ x
+ ) in (
+ doc.report.bindingsite.interactions.hydrophobic_interactions.hydrophobic_interaction
+ ):
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -245,9 +359,20 @@ elif fallback == 1:
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
if hb == 1:
- print("## Hydrogen Bonds",end="\n\n")
+ print("## Hydrogen Bonds", end="\n\n")
tableBody = []
- tableHeaders = ['No.','Res.','AA','Dist H-A','Dist D-A','Don Angle','Protisdon?','Sidechain?','D. Atom','A. Atom']
+ tableHeaders = [
+ "No.",
+ "Res.",
+ "AA",
+ "Dist H-A",
+ "Dist D-A",
+ "Don Angle",
+ "Protisdon?",
+ "Sidechain?",
+ "D. Atom",
+ "A. Atom",
+ ]
i = 1
for x in doc.report.bindingsite.interactions.hydrogen_bonds.hydrogen_bond:
l = []
@@ -263,13 +388,21 @@ elif fallback == 1:
l.append((x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
i += 1
tableBody.append(l)
- #print(i, x.resnr.cdata, x.restype.cdata, x.dist_h_a.cdata, x.dist_d_a.cdata, x.don_angle.cdata, x.protisdon.cdata, x.sidechain.cdata, (x.donoridx.cdata + "[" + x.donortype.cdata + "]"), (x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
+ # print(i, x.resnr.cdata, x.restype.cdata, x.dist_h_a.cdata, x.dist_d_a.cdata, x.don_angle.cdata, x.protisdon.cdata, x.sidechain.cdata, (x.donoridx.cdata + "[" + x.donortype.cdata + "]"), (x.acceptoridx.cdata + "[" + x.acceptortype.cdata + "]"))
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
if sb == 1:
- print("## Salt Bridges",end="\n\n")
+ print("## Salt Bridges", end="\n\n")
tableBody = []
- tableHeaders = ['Index','Residue','AA','Distance','Protein positive?','Ligand Group','Ligand Atoms']
+ tableHeaders = [
+ "Index",
+ "Residue",
+ "AA",
+ "Distance",
+ "Protein positive?",
+ "Ligand Group",
+ "Ligand Atoms",
+ ]
i = 1
for x in doc.report.bindingsite.interactions.salt_bridges.salt_bridge:
l = []
@@ -287,12 +420,16 @@ elif fallback == 1:
tableBody.append(l)
print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
- if pc==1:
- print("## Pi Cation Interactions",end="\n\n")
+ if pc == 1:
+ print("## Pi Cation Interactions", end="\n\n")
tableBody = []
- tableHeaders = ['Index','Residue','AA','Distance','Prot charged?','Atoms']
+ tableHeaders = ["Index", "Residue", "AA", "Distance", "Prot charged?", "Atoms"]
i = 1
- for x in doc.report.bindingsite.interactions.pi_cation_interactions.pi_cation_interaction:
+ for (
+ x
+ ) in (
+ doc.report.bindingsite.interactions.pi_cation_interactions.pi_cation_interaction
+ ):
l = []
l.append(i)
l.append(x.resnr.cdata)
@@ -310,7 +447,7 @@ elif fallback == 1:
print("## Figures", end="\n\n")
-print(f'![](output-back.png)', end="\n\n")
-print(f'![](output-front.png)', end="\n\n")
-print(f'![](closeup-back.png)', end="\n\n")
-print(f'![](closeup-front.png)', end="\n\n")
+print(f"![](output-back.png)", end="\n\n")
+print(f"![](output-front.png)", end="\n\n")
+print(f"![](closeup-back.png)", end="\n\n")
+print(f"![](closeup-front.png)", end="\n\n")
diff --git a/scripts/quick-ligand-protein.py b/scripts/quick-ligand-protein.py
index faff403..5873270 100644
--- a/scripts/quick-ligand-protein.py
+++ b/scripts/quick-ligand-protein.py
@@ -1,12 +1,14 @@
#!/usr/bin/python3
import argparse
-#import logzero
-#import logging
-#from logzero import logger as log
+
+# import logzero
+# import logging
+# from logzero import logger as log
import pymol2
import time
import os
+
print(os.getcwd())
#################
@@ -17,7 +19,7 @@ startTime = time.time()
version = "1.0"
desc_text = "PyMol Quick Visualtion " + version
ligandColor = "red"
-#logzero.loglevel(logging.INFO)
+# logzero.loglevel(logging.INFO)
height = 1000
width = 800
dpi = 300
@@ -28,9 +30,9 @@ m1 = "target"
m2 = "ligand"
parser = argparse.ArgumentParser(description=desc_text)
-parser.add_argument("-p","--protein",help="Path to protein file")
-parser.add_argument("-l","--ligand",help="Path to ligand_out file")
-parser.add_argument("-c","--color",help="Color for ligand in visualisation")
+parser.add_argument("-p", "--protein", help="Path to protein file")
+parser.add_argument("-l", "--ligand", help="Path to ligand_out file")
+parser.add_argument("-c", "--color", help="Color for ligand in visualisation")
args = parser.parse_args()
@@ -47,38 +49,55 @@ protein = args.protein
print("Protein: ", protein)
ligand = args.ligand
+
def loadMol(filename, name):
print("Loading " + filename + " as " + name)
- cmd.load(filename,name)
+ cmd.load(filename, name)
+
+
def changeColor(name, colorName):
print("Changed " + name + "'s color to " + colorName)
- cmd.color(colorName,name)
+ cmd.color(colorName, name)
+
+
def orientEtZoom():
cmd.orient()
cmd.zoom()
+
+
def showSurface(name):
- cmd.show("surface",name)
+ cmd.show("surface", name)
+
+
def surfaceTransparency(amount):
- print("Changed surface transparency to " + str(amount*100) + "%")
- cmd.set("transparency",amount)
-def generatePNG(filename,height=height,width=width,dpi=dpi,ray=ray):
+ print("Changed surface transparency to " + str(amount * 100) + "%")
+ cmd.set("transparency", amount)
+
+
+def generatePNG(filename, height=height, width=width, dpi=dpi, ray=ray):
print("Generating " + filename + ".png")
- cmd.png(filename,height,width,dpi=dpi,ray=ray)
+ cmd.png(filename, height, width, dpi=dpi, ray=ray)
+
+
def flipHorizontal():
- cmd.rotate("y",180)
+ cmd.rotate("y", 180)
+
+
def zoomTo(name):
cmd.zoom(name)
+
+
def generatePictures():
- generatePNG('output-front')
+ generatePNG("output-front")
flipHorizontal()
- generatePNG('output-back')
+ generatePNG("output-back")
zoomTo(m2)
- generatePNG('closeup-back')
+ generatePNG("closeup-back")
orientEtZoom()
flipHorizontal()
zoomTo(m2)
- generatePNG('closeup-front')
-
+ generatePNG("closeup-front")
+
print("Initialising PyMol")
session = pymol2.PyMOL()
@@ -86,10 +105,12 @@ print("Starting PyMol Session")
session.start()
cmd = session.cmd
-loadMol(protein,m1)
-loadMol(ligand,m2)
-changeColor(m1,"grey60")
-changeColor(m2,ligandColor)
+loadMol(protein, m1)
+cmd.remove("resn hoh") # remove water
+cmd.color("blue", "hetatm") # color heteroatoms
+loadMol(ligand, m2)
+changeColor(m1, "grey60")
+changeColor(m2, ligandColor)
orientEtZoom()
showSurface(m1)
surfaceTransparency(0.6)
@@ -97,4 +118,4 @@ surfaceTransparency(0.6)
generatePictures()
endTime = time.time()
-print("Finished Execution in " + str(round((endTime - startTime),2)) + " seconds.")
+print("Finished Execution in " + str(round((endTime - startTime), 2)) + " seconds.")