aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-07-02 20:48:33 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-07-02 20:48:33 +0530
commit4be08f7bdd77991e9e453c1cda863c3f20c338d5 (patch)
tree083e8e91622221185a28fd50754abc2f86b1df43 /scripts
initial commit
Diffstat (limited to 'scripts')
-rw-r--r--scripts/convert-smile.sh38
-rw-r--r--scripts/dock-and-score.sh51
-rw-r--r--scripts/get-best.py43
-rwxr-xr-xscripts/main.sh152
-rw-r--r--scripts/makeReport.py315
-rw-r--r--scripts/quick-ligand-protein.py99
-rw-r--r--scripts/report.sh67
-rw-r--r--scripts/test.sh63
8 files changed, 828 insertions, 0 deletions
diff --git a/scripts/convert-smile.sh b/scripts/convert-smile.sh
new file mode 100644
index 0000000..a86f675
--- /dev/null
+++ b/scripts/convert-smile.sh
@@ -0,0 +1,38 @@
+if [ -z "$1" ]
+ then
+ echo "CSV path not provided! 😠"
+ exit
+fi
+input="$1"
+
+echo "Reading ligands from $input"
+
+total=$(wc -l $input | awk '{print $1}')
+file=1
+while IFS= read -r line
+do
+ mails=$(echo $line | tr "," "\n")
+ i=0
+ code=""
+ echo "Structure $file of $total"
+ for a in $mails; do
+ i=$((i+1))
+ if ((i == 1))
+ then
+ code=$(echo "$a")
+ fi
+ if ((i == 2))
+ then
+ echo "==========================================="
+ echo "Generating Structure for $a"
+ fi
+ if ((i == 3))
+ then
+ echo "obabel -:"$a" --gen3d -opdbqt -O$code.pdbqt"
+ obabel -:"$a" --gen3d -opdbqt -O$code.pdbqt
+ echo "==========================================="
+ fi
+ mv $code.pdbqt ligands/
+ done
+ file=$((file+1))
+done < "$input"
diff --git a/scripts/dock-and-score.sh b/scripts/dock-and-score.sh
new file mode 100644
index 0000000..c71baef
--- /dev/null
+++ b/scripts/dock-and-score.sh
@@ -0,0 +1,51 @@
+if [ -z "$1" ]
+ then
+ echo "CSV path not provided! 😠"
+ exit
+fi
+input="$1"
+echo "Reading ligands from $input"
+
+targets=()
+
+for file in ./configs/*
+do
+ targets+=($file)
+done
+
+total=$(wc -l $input | awk '{print $1}')
+file=1
+while IFS= read -r line
+do
+ mails=$(echo $line | tr "," "\n")
+ i=0
+ code=""
+ echo "Structure $file of $total"
+ for a in $mails; do
+ i=$((i+1))
+ if ((i == 1))
+ then
+ echo $a
+ for target in ${targets[@]}; do
+ echo "Docking $(basename $target .txt) and $a"
+ vina --config $target --ligand ligands/$a.pdbqt
+ sentence=$(awk '{if(NR==2) print $0}' ./ligands/$(echo $a)_out.pdbqt)
+ mkdir -p ./Reports/$(basename $target .txt)/$(echo $a)/
+ mkdir ./$(basename $target .txt)/
+ cp ligands/$(echo $a)_out.pdbqt ./$(basename $target .txt)/
+ mv ligands/$(echo $a)_out.pdbqt ./Reports/$(basename $target .txt)/$(echo $a)/$(echo $a).pdbqt
+ f=1
+ for word in $sentence; do
+ if ((f == 4))
+ then
+ echo "$(echo $a),$word" >> $(basename $target .txt).csv
+ fi
+ f=$((f+1))
+ done
+ done
+ fi
+ done
+ file=$((file+1))
+done < "$input"
+
+
diff --git a/scripts/get-best.py b/scripts/get-best.py
new file mode 100644
index 0000000..748251e
--- /dev/null
+++ b/scripts/get-best.py
@@ -0,0 +1,43 @@
+import argparse
+import pymol2
+import re
+
+#################
+# Configuration #
+#################
+
+version = "1.0"
+desc_text = "PyMol Quick Visualtion " + version
+
+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")
+
+args = parser.parse_args()
+
+def li(s):
+ #log.info(s)
+ None
+
+
+if args.protein == None:
+ print("Error: Please specify protein file")
+ exit(1)
+if args.ligand == None:
+ print("Error: Please specify ligand file")
+ exit(1)
+
+
+protein = args.protein
+ligand = args.ligand
+
+session = pymol2.PyMOL()
+session.start()
+cmd = session.cmd
+cmd.load(protein,'pro')
+cmd.load(ligand,'lig')
+cmd.split_states('lig')
+
+#fname = re.sub(r'^.*?/', '', protein.replace(".pdbqt","")) + "-" + re.sub(r'^.*?/', '', ligand.replace(".pdbqt","")) + ".pdb"
+
+cmd.save("best.pdb","pro lig_0001")
diff --git a/scripts/main.sh b/scripts/main.sh
new file mode 100755
index 0000000..612f626
--- /dev/null
+++ b/scripts/main.sh
@@ -0,0 +1,152 @@
+#!/bin/bash
+echo "$(pwd)"
+currentVersion="0.9"
+protein="false"
+ligand="false"
+docking="false"
+visualisations="false"
+interactions="false"
+proteinPath=""
+ligandPath=""
+pdfPath=""
+smile=""
+name=""
+config=""
+
+usage()
+{
+ cat <<EOF
+Curie-CLI
+Description: OwO.
+Usage: curie [flags] or curie [-a] [arg] [-s] [arg]
+ -d Perform Docking using AutoDock Vina
+ -p Visualisations using PyMOL
+ -i Protein-Ligand Interactions using PLIP
+ -s SMILES Code for Ligand
+ -n Name for ligand if using the -s option
+ -r Specify Receptor file path (PDBQT Format Only!)
+ -l Specify Ligand file path (PDBQT Format Only!)
+ -c Specify AutoDock Vina Configuration File (TXT Format Only!)
+ -h Show the help
+ -v Get the tool version
+Examples:
+ ./main.sh -v
+ ./main.sh -v
+EOF
+}
+
+
+while getopts "r:l:s:n:c:vhdip" opt; do
+ case "$opt" in
+ \?) echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ h) usage
+ exit 0
+ ;;
+ v) echo "Version $currentVersion"
+ exit 0
+ ;;
+ u)
+ getConfiguredClient || exit 1
+ checkInternet || exit 1
+ update
+ exit 0
+ ;;
+ d)
+ docking="true"
+ ;;
+ i)
+ interactions="true"
+ ;;
+ p)
+ visualisations="true"
+ ;;
+ s)
+ smile="$OPTARG"
+ ;;
+ n)
+ name="$OPTARG"
+ ;;
+ r)
+ proteinPath="$OPTARG"
+ ;;
+ l)
+ ligandPath="$OPTARG"
+ ;;
+ c)
+ config="$OPTARG"
+ ;;
+ a)
+ artist="true"
+ if [[ "$(echo "$@" | grep -Eo "\-s")" == "-s" ]];then song="true";fi # wont go through both options if arg spaced and not quoted this solves that issue (dont need this but once had bug on system where it was necessary)
+ if [[ "$(echo "$@" | grep -Eo "\-f")" == "-f" ]];then filePath=$(echo "$@" | grep -Eo "\-f [ a-z A-Z / 0-9 . \ ]*[ -]?" | sed s/-f//g | sed s/-//g | sed s/^" "//g);fi
+ ;;
+ #s)
+ # song="true"
+ # if [[ "$(echo "$@" | grep -Eo "\-a")" == "-a" ]];then artist="true";fi # wont go through both options if arg spaced and not quoted this solves that issue (dont need this but once had bug on system where it was necessary)
+ # if [[ "$(echo "$@" | grep -Eo "\-f")" == "-f" ]];then filePath=$(echo "$@" | grep -Eo "\-f [ a-z A-Z / 0-9 . \ ]*[ -]?" | sed s/-f//g | sed s/-//g | sed s/^" "//g);fi
+ # ;;
+ :) echo "Option -$OPTARG requires an argument." >&2
+ exit 1
+ ;;
+ esac
+done
+
+if [[ $# == "0" ]]; then
+ usage ## if calling the tool with no flags and args chances are you want to return usage
+ exit 0
+elif [[ $# == "1" ]]; then
+ if [[ $1 == "update" ]]; then
+ getConfiguredClient || exit 1
+ checkInternet || exit 1
+ update || exit 1
+ exit 0
+ elif [[ $1 == "help" ]]; then
+ usage
+ exit 0
+ fi
+fi
+
+if [[ $docking == "true" ]]; then
+ if [[ $proteinPath != "" ]]; then
+ if [[ $smile != "" ]] || [[ $ligandPath != "" ]]; then
+ if [[ $config == "" ]]; then
+ echo "Configuration File Not Specified!"
+ exit 1
+ else
+ dockingCheck="true"
+ fi
+ else
+ echo "WTF Only Protein!"
+ exit 1
+ fi
+ fi
+fi
+
+if [[ $smile != "" ]]; then
+ if [[ $name == "" ]]; then
+ name="ligand"
+ obabel -:"$smile" --gen3d -opdbqt -O$name.pdbqt
+ ligandPath="$name.pdbqt"
+ fi
+fi
+
+if [[ $dockingCheck == "true" ]]; then
+ echo ""
+ vina --receptor $proteinPath --ligand $ligandPath --config $config
+fi
+
+if [[ $visualisations == "true" ]]; then
+ file=$(echo "$ligandPath" | cut -f 1 -d '.')
+ python3 /src/scripts/quick-ligand-protein.py -p $proteinPath -l "$(echo $file)_out.pdbqt"
+fi
+
+if [[ $interactions == "true" ]]; then
+ python3 /src/scripts/get-best.py -p $proteinPath -l "$(echo $file)_out.pdbqt"
+ python3 /src/plip/plipcmd.py -f best.pdb -qpxy
+ python3 /src/scripts/makeReport.py --input . > report.md
+ pandoc -V geometry:margin=1in report.md --pdf-engine=xelatex -o $name.pdf
+fi
+
+echo "$proteinPath and $ligandPath and $docking and $interactions and $visualisations" \ No newline at end of file
diff --git a/scripts/makeReport.py b/scripts/makeReport.py
new file mode 100644
index 0000000..dcf3576
--- /dev/null
+++ b/scripts/makeReport.py
@@ -0,0 +1,315 @@
+import argparse
+
+parser = argparse.ArgumentParser(description="Make Report Helper Script")
+parser.add_argument("-i","--input",help="Path to report folder")
+
+args = parser.parse_args()
+
+if args.input == None:
+ print("Error: Please specify path")
+ exit(1)
+
+path = args.input
+#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')
+
+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:
+ image = x
+import os
+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
+
+indexForUNL = 0
+
+for x in doc.report.bindingsite:
+ if x.identifiers.longname.cdata == 'UNL':
+ break
+ else:
+ indexForUNL += 1
+
+
+name = doc.report.pdbid.cdata
+print(("# " + (name.replace("_"," ")).replace("PROTEIN","")), end="\n\n")
+
+print("## Visualisation", end="\n\n")
+print(f'![]({image})', end="\n\n")
+
+print("## Interactions", end="\n\n")
+
+fallback = 0
+try:
+ 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
+
+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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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")
+ else:
+ print("**Metal Complexes Found**", end="\n\n")
+ mc = 1
+
+if fallback == 1:
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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 == '':
+ 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")
+ else:
+ print("**Metal Complexes Found**", end="\n\n")
+ mc = 1
+
+if fallback == 0:
+ if hi == 1:
+ print("## Hydrophobic Interactions",end="\n\n")
+ tableBody = []
+ tableHeaders = ['No.','Res.','AA','Dist','Ligand Atom','Proton Atom']
+ i = 1
+ for x in doc.report.bindingsite[indexForUNL].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 hb == 1:
+ 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[indexForUNL].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")
+
+ if sb == 1:
+ print("## Salt Bridges",end="\n\n")
+ tableBody = []
+ 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:
+ l = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist.cdata)
+ l.append(x.protispos.cdata)
+ l.append(x.lig_group.cdata)
+ atoms = []
+ for y in x.lig_idx_list.idx:
+ atoms.append(y.cdata)
+ l.append(atoms)
+ i += 1
+ tableBody.append(l)
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+
+ if pc==1:
+ print("## Pi Cation Interactions",end="\n\n")
+ tableBody = []
+ tableHeaders = ['Index','Residue','AA','Distance','Prot charged?','Atoms']
+ i = 1
+ for x in doc.report.bindingsite[indexForUNL].interactions.pi_cation_interactions.pi_cation_interaction:
+ l = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist.cdata)
+ l.append(x.offset.cdata)
+ l.append(x.protcharged.cdata)
+ atoms = []
+ for y in x.lig_idx_list.idx:
+ atoms.append(y.cdata)
+ l.append(atoms)
+ i += 1
+ tableBody.append(l)
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+elif fallback == 1:
+ if hi == 1:
+ print("## Hydrophobic Interactions",end="\n\n")
+ tableBody = []
+ tableHeaders = ['No.','Res.','AA','Dist','Ligand Atom','Proton Atom']
+ i = 1
+ for x in doc.report.bindingsite.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 hb == 1:
+ 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.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")
+
+ if sb == 1:
+ print("## Salt Bridges",end="\n\n")
+ tableBody = []
+ 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 = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist.cdata)
+ l.append(x.protispos.cdata)
+ l.append(x.lig_group.cdata)
+ atoms = []
+ for y in x.lig_idx_list.idx:
+ atoms.append(y.cdata)
+ l.append(atoms)
+ i += 1
+ tableBody.append(l)
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+
+ if pc==1:
+ print("## Pi Cation Interactions",end="\n\n")
+ tableBody = []
+ tableHeaders = ['Index','Residue','AA','Distance','Prot charged?','Atoms']
+ i = 1
+ for x in doc.report.bindingsite.interactions.pi_cation_interactions.pi_cation_interaction:
+ l = []
+ l.append(i)
+ l.append(x.resnr.cdata)
+ l.append(x.restype.cdata)
+ l.append(x.dist.cdata)
+ l.append(x.offset.cdata)
+ l.append(x.protcharged.cdata)
+ atoms = []
+ for y in x.lig_idx_list.idx:
+ atoms.append(y.cdata)
+ l.append(atoms)
+ i += 1
+ tableBody.append(l)
+ print(tabulate(tableBody, headers=tableHeaders), end="\n\n")
+
+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")
diff --git a/scripts/quick-ligand-protein.py b/scripts/quick-ligand-protein.py
new file mode 100644
index 0000000..f2409ef
--- /dev/null
+++ b/scripts/quick-ligand-protein.py
@@ -0,0 +1,99 @@
+import argparse
+#import logzero
+#import logging
+#from logzero import logger as log
+import pymol2
+import time
+
+import os
+print(os.getcwd())
+
+#################
+# Configuration #
+#################
+
+startTime = time.time()
+version = "1.0"
+desc_text = "PyMol Quick Visualtion " + version
+ligandColor = "red"
+#logzero.loglevel(logging.INFO)
+height = 1000
+width = 800
+dpi = 300
+ray = 0
+
+
+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")
+
+args = parser.parse_args()
+
+if args.protein == None:
+ print("Error: Please specify protein file")
+ exit(1)
+if args.ligand == None:
+ print("Error: Please specify ligand file")
+ exit(1)
+if args.color == None:
+ print("No color was speciifed, using default settings.")
+
+protein = args.protein
+print("Protein: ", protein)
+ligand = args.ligand
+
+def loadMol(filename, name):
+ print("Loading " + filename + " as " + name)
+ cmd.load(filename,name)
+def changeColor(name, colorName):
+ print("Changed " + name + "'s color to " + colorName)
+ cmd.color(colorName,name)
+def orientEtZoom():
+ cmd.orient()
+ cmd.zoom()
+def showSurface(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("Generating " + filename + ".png")
+ cmd.png(filename,height,width,dpi=dpi,ray=ray)
+def flipHorizontal():
+ cmd.rotate("y",180)
+def zoomTo(name):
+ cmd.zoom(name)
+def generatePictures():
+ generatePNG('output-front')
+ #flipHorizontal()
+ #generatePNG('output-back')
+ #zoomTo(m2)
+ #generatePNG('closeup-back')
+ #orientEtZoom()
+ #flipHorizontal()
+ #zoomTo(m2)
+ #generatePNG('closeup-front')
+
+
+print("Initialising PyMol")
+session = pymol2.PyMOL()
+print("Starting PyMol Session")
+session.start()
+cmd = session.cmd
+
+loadMol(protein,m1)
+loadMol(ligand,m2)
+changeColor(m1,"grey60")
+changeColor(m2,ligandColor)
+orientEtZoom()
+showSurface(m1)
+surfaceTransparency(0.6)
+
+generatePictures()
+
+endTime = time.time()
+print("Finished Execution in " + str(round((endTime - startTime),2)) + " seconds.") \ No newline at end of file
diff --git a/scripts/report.sh b/scripts/report.sh
new file mode 100644
index 0000000..98437a3
--- /dev/null
+++ b/scripts/report.sh
@@ -0,0 +1,67 @@
+pwd=$(pwd)
+
+if [ -z "$1" ]
+ then
+ echo "CSV path not provided! 😠"
+ exit
+fi
+input="$1"
+
+ligands=()
+
+while IFS= read -r line
+do
+ mails=$(echo $line | tr "," "\n")
+ i=0
+ code=""
+ for a in $mails; do
+ i=$((i+1))
+ if ((i == 1))
+ then
+ code=$(echo "$a")
+ fi
+ if ((i == 2))
+ then
+ #ligands+=("./ligands/$a.pdbqt")
+ ligands+=("$a")
+ fi
+ done
+done < "$input"
+
+
+proteins=()
+#for file in ./configs/*
+#do
+# proteins+=("$(basename $file .txt)")
+#done
+
+proteins+=("6VXX")
+
+#ligands=()
+#for file in ./ligands/*
+#do
+# ligands+=("$(basename $file .pdbqt)")
+#done
+
+for protein in ${proteins[@]}; do
+ for ligand in ${ligands[@]}; do
+ ###cd $pwd/Reports/$protein/$ligand/
+ ###docker run --rm -v ${PWD}:/results -w /results -u $(id -u ${USER}):$(id -g ${USER}) pharmai/plip:latest -f $ligand.pdb -qpxy
+ echo "Saving Protein-Ligand Complex $ligand"
+ python3.7 ./scripts/get-best.py -p ./targets/$protein.pdbqt -l ./Reports/$protein/$ligand/$ligand.pdbqt
+ fname=$(echo ${protein}_${ligand}.pdb)
+ mv best.pdb ./Reports/$protein/$ligand/$fname
+ cd $pwd/Reports/$protein/$ligand/
+ echo "Processing in PLIP"
+ docker run --rm -v ${PWD}:/results -w /results -u $(id -u ${USER}):$(id -g ${USER}) pharmai/plip:latest -f $fname -qpxy
+ cd $pwd
+ echo "Generating Images"
+ #python3.7 ./scripts/quick-ligand-protein.py -p ./targets/$protein.pdbqt -l ./Reports/$protein/$ligand/$ligand.pdbqt
+ #mv closeup-front.png closeup-back.png output-back.png output-front.png ./Reports/$protein/$ligand/
+ echo "Generating PDF Report"
+ python3.7 ./scripts/makeReport.py --input ./Reports/$protein/$ligand/ > ./Reports/$protein/$ligand/report.md
+ cd $pwd/Reports/$protein/$ligand/
+ pandoc -V geometry:margin=1in report.md --pdf-engine=xelatex -o $ligand.pdf
+ cd $pwd
+ done
+done \ No newline at end of file
diff --git a/scripts/test.sh b/scripts/test.sh
new file mode 100644
index 0000000..3d5bf8f
--- /dev/null
+++ b/scripts/test.sh
@@ -0,0 +1,63 @@
+#declare -a ligands=()
+#for file in ./ligands/*
+#do
+# echo $file
+# ligands+=("$(basename $file .pdbqt)")
+#done
+#
+#for i in "${ligands[@]}"; do echo "$i"; done
+
+if [ -z "$1" ]
+ then
+ echo "CSV path not provided! 😠"
+ exit
+fi
+input="$1"
+
+ligands=()
+
+while IFS= read -r line
+do
+ mails=$(echo $line | tr "," "\n")
+ i=0
+ code=""
+ for a in $mails; do
+ i=$((i+1))
+ if ((i == 1))
+ then
+ code=$(echo "$a")
+ fi
+ if ((i == 2))
+ then
+ #ligands+=("./ligands/$a.pdbqt")
+ ligands+=("$a")
+ fi
+ done
+done < "$input"
+
+targets=()
+
+for file in ./configs/*
+do
+ targets+=($file)
+done
+
+for a in ${ligands[@]}; do
+ for target in ${targets[@]}; do
+ echo "Docking $(basename $target .txt) and $a"
+ vina --config $target --ligand ligands/$a.pdbqt
+ sentence=$(awk '{if(NR==2) print $0}' ./ligands/$(echo $a)_out.pdbqt)
+ mkdir -p ./Reports/$(basename $target .txt)/$(echo $a)/
+ mkdir ./$(basename $target .txt)/
+ cp ligands/$(echo $a)_out.pdbqt ./$(basename $target .txt)/
+ mv ligands/$(echo $a)_out.pdbqt ./Reports/$(basename $target .txt)/$(echo $a)/$(echo $a).pdbqt
+ f=1
+ for word in $sentence; do
+ if ((f == 4))
+ then
+ echo "$(echo $a),$word" >> $(basename $target .txt).csv
+ fi
+ f=$((f+1))
+ done
+ done
+done \ No newline at end of file