From 6e45140c59253fb2f286bfd73f763c18e7ef104b Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Mon, 6 Jul 2020 13:03:43 +0530 Subject: added docking score feeature to main.sh and report generation --- scripts/get_dock_score.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ scripts/main.sh | 3 ++- scripts/makeReport.py | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 scripts/get_dock_score.py (limited to 'scripts') diff --git a/scripts/get_dock_score.py b/scripts/get_dock_score.py new file mode 100644 index 0000000..a47312b --- /dev/null +++ b/scripts/get_dock_score.py @@ -0,0 +1,46 @@ +#!/usr/bin/python3 + +import argparse + +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() + +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 + +from os.path import basename + +print("# " + str(basename(protein)).replace(".pdbqt","") + "-" + str(basename(ligand)).replace("_out.pdbqt",""), end="\n\n") + +from tabulate import tabulate + +file = open(ligand, "r") +lines = file.readlines() +results = [] +i = 1 +for line in lines: + ta = [] + if line.find('REMARK VINA') == 0 and line.split()[3] != "": + l = line.split() + ta.append(i) + ta.append(l[3]) + ta.append(l[4]) + ta.append(l[5]) + i += 1 + if ta != []: + results.append(ta) + +print("## Docking Scores",end="\n\n") +print(tabulate(results,headers=["No.","Affinity","rmsd l.b","rmsd u.b"])) +print("",end="\n\n") diff --git a/scripts/main.sh b/scripts/main.sh index 90d128b..68397fb 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -145,7 +145,8 @@ 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 + python3 /src/scripts/get_dock_score.py -l "$(echo $file)_out.pdbqt" -p $proteinPath > report.md + python3 /src/scripts/makeReport.py --input . >> report.md pandoc -V geometry:margin=1in report.md --pdf-engine=xelatex -o $name.pdf fi diff --git a/scripts/makeReport.py b/scripts/makeReport.py index b905cf0..79d9c70 100644 --- a/scripts/makeReport.py +++ b/scripts/makeReport.py @@ -44,7 +44,7 @@ for x in doc.report.bindingsite: name = doc.report.pdbid.cdata -print(("# " + (name.replace("_"," ")).replace("PROTEIN","")), end="\n\n") +#print(("# " + (name.replace("_"," ")).replace("PROTEIN","")), end="\n\n") print("## Visualisation", end="\n\n") print(f'![]({image})', end="\n\n") -- cgit v1.2.3