Skip to content

Commit fdec5b9

Browse files
authored
Add files via upload
1 parent 9cc3d35 commit fdec5b9

4 files changed

Lines changed: 22 additions & 17 deletions

simple_docking/MTH_Docking_Part2_Dock-Vina_2.0.ipynb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,9 @@
180180
"#Let's use oddt to make the pdbqt files that we need...\n",
181181
"print(colored('Making pdbqt files', 'blue', attrs=['bold']))\n",
182182
"for receptor_filename in receptor_filenames:\n",
183-
" receptor_prefix = receptor_filename.split(\".\")[2]\n",
184-
" receptor_name = receptor_prefix.split(\"/\")[2]\n",
185-
" receptor_pdbqt_file = '..' + receptor_prefix + '.pdbqt'\n",
186-
" print(receptor_name)\n",
183+
" receptor_prefix = receptor_filename.removesuffix('.pdb')\n",
184+
" receptor_name = receptor_prefix.split(\"/\")[-1]\n",
185+
" receptor_pdbqt_file = receptor_prefix + '.pdbqt'\n",
187186
" rec = next(oddt.toolkit.readfile('pdb', receptor_filename))\n",
188187
" rec.write('pdbqt', receptor_pdbqt_file, overwrite=True, opt={'r': None, 'c': None, 'h': None})\n",
189188
"print(colored('Finished making pdbqt files', 'blue', attrs=['bold']))"
@@ -204,10 +203,10 @@
204203
"source": [
205204
"def dock_ligands(filename):\n",
206205
" #This line removes the filename suffix (.pdbqt)\n",
207-
" dock_input = filename.split(\".\")[0]\n",
206+
" dock_input = filename.removesuffix('.pdbqt')\n",
208207
" #This line removes the filename prefix \n",
209208
" dock_name = dock_input.split(\"/\")[-1]\n",
210-
" vina_receptor = '..' + PDBFile + '.pdbqt'\n",
209+
" vina_receptor = PDBFile + '.pdbqt'\n",
211210
" vina_config = \"../receptor/conf.txt\"\n",
212211
" vina_ligand = dock_input + '.pdbqt'\n",
213212
" vina_out = dock_name + '_out.pdbqt'\n",
@@ -232,7 +231,7 @@
232231
" top_pose = next(oddt.toolkit.readfile('pdbqt', dock_name + '_out.pdbqt'))\n",
233232
" top_pose_out = top_pose.write('mol2')\n",
234233
" mol = top_pose\n",
235-
" protein = '..' + PDBFile + '.pdb'\n",
234+
" protein = PDBFile + '.pdb'\n",
236235
" rec = next(oddt.toolkit.readfile('pdb', protein))\n",
237236
" rec.protein=True\n",
238237
" mols = list(oddt.toolkit.readfile('mol2', filename))\n",
@@ -294,13 +293,15 @@
294293
{
295294
"cell_type": "code",
296295
"execution_count": null,
297-
"metadata": {},
296+
"metadata": {
297+
"scrolled": true
298+
},
298299
"outputs": [],
299300
"source": [
300301
"#This runs a series of docking calculations on protein conformations found in the receptor folder\n",
301302
"for receptor_filename in receptor_filenames:\n",
302-
" PDBFile = receptor_filename.split(\".\")[2]\n",
303-
" PDBFile_name = PDBFile.split(\"/\")[2]\n",
303+
" PDBFile = receptor_filename.removesuffix('.pdb')\n",
304+
" PDBFile_name = PDBFile.split(\"/\")[-1]\n",
304305
" print(colored('Docking for protein started', 'blue', attrs=['bold']))\n",
305306
" print(PDBFile_name)\n",
306307
" \n",

simple_docking/MTH_Docking_Part3_Analysis_2.0.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@
511511
"source": [
512512
"# Draw Violin Plot\n",
513513
"plt.figure(figsize=(13,10), dpi= 80)\n",
514-
"sns.violinplot(x='Protein_Conf', y='Vina_BE', data=total_dataframes, scale='width', inner='quartile')\n",
514+
"sns.violinplot(x='Protein_Conf', y='Vina_BE', data=total_dataframes, density_norm='width', inner='quartile')\n",
515515
"\n",
516516
"# Decoration\n",
517517
"plt.title('Violin Plot of Vina_BE by Protein Conformation', fontsize=22)\n",

simple_docking/MTH_Docking_Part4_Selecting_Hits_2.0.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"outputs": [],
176176
"source": [
177177
"sort_by_Ligand_Name = total_dataframes.sort_values('Ligand_Name')\n",
178-
"Vina_BE_HBonds_best_overall = sort_by_Ligand_Name[(sort_by_Ligand_Name.Vina_BE < -5.2) & (sort_by_Ligand_Name.HBonds > 0) & (sort_by_Ligand_Name.Vina_LE < -0.4)]\n",
178+
"Vina_BE_HBonds_best_overall = sort_by_Ligand_Name[(sort_by_Ligand_Name.Vina_BE < -4.5) & (sort_by_Ligand_Name.HBonds > 0) & (sort_by_Ligand_Name.Vina_LE < -0.4)]\n",
179179
"Vina_BE_HBonds_best_overall"
180180
]
181181
},
@@ -202,7 +202,9 @@
202202
{
203203
"cell_type": "code",
204204
"execution_count": null,
205-
"metadata": {},
205+
"metadata": {
206+
"scrolled": true
207+
},
206208
"outputs": [],
207209
"source": [
208210
"selection_set = Vina_BE_HBonds_best_overall\n",

simple_docking/MTH_Docking_Part5_Saving_Hits_2.0.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"f.close()\n",
9696
"for path_results_filename in path_results_filenames:\n",
9797
" results_filename=path_results_filename.split('/')[-1]\n",
98-
" results_filename_prefix=results_filename.split('.')[0]\n",
98+
" results_filename_prefix=results_filename.removesuffix('.mol2')\n",
9999
" protein=results_filename_prefix.split('_')[1]\n",
100100
" all_mols = list(oddt.toolkit.readfile('mol2', path_results_filename))\n",
101101
" hits_out_filename=hits_folder + '/' + results_filename_prefix + '_hit_ligands.mol2'\n",
@@ -136,7 +136,9 @@
136136
{
137137
"cell_type": "code",
138138
"execution_count": null,
139-
"metadata": {},
139+
"metadata": {
140+
"scrolled": true
141+
},
140142
"outputs": [],
141143
"source": [
142144
"#Here we write out the files to the MTH_Protein_Hits folder\n",
@@ -151,7 +153,7 @@
151153
" with open(protein_hits_out_filename, 'a') as contents:\n",
152154
" for path_results_filename in path_results_filenames:\n",
153155
" results_filename=path_results_filename.split('/')[-1]\n",
154-
" results_filename_prefix=results_filename.split('.')[0]\n",
156+
" results_filename_prefix=results_filename.removesuffix('.mol2')\n",
155157
" protein_suffix=results_filename_prefix.split('VinaResults_')[1]\n",
156158
" protein=protein_suffix.split('_rescored')[0]\n",
157159
" print(protein)\n",
@@ -199,7 +201,7 @@
199201
"#Write sdf files for use in DataWarrior etc.\n",
200202
"mol2_files = glob('MTH_Hits/VinaResults_*.mol2')\n",
201203
"for mol2_file in mol2_files:\n",
202-
" mol2_prefix = mol2_file.split(\".\")[0]\n",
204+
" mol2_prefix = mol2_file.removesuffix('.mol2')\n",
203205
" sdf_out = mol2_prefix + '.sdf'\n",
204206
" mols = list(oddt.toolkit.readfile('mol2', mol2_file))\n",
205207
" with open (sdf_out, 'w') as contents:\n",

0 commit comments

Comments
 (0)