I have a code i have been woking on to get multiple ligand relating to a single receptor and then dock them basically trying virtual screening.
I was at the final step to basically do the virtual screening part but for some reason vina is just not working in for loop. I am working in colab and i tried to run the code outside the loop where it executes perfectely but in for loop it doesn't work.
here is the code:
c_file = '/content/7y89/DOCKING/config_file'
receptor_file = '/content/7y89/7y89_receptor.pdbqt'
for ligand_file in os.listdir(dck_fold):
if ligand_file.endswith(".pdbqt"):
ligand_path = os.path.join(dck_fold, f"'{ligand_file}'")
output_path = os.path.join(EXP_FLD, f"'docking_{ligand_file}'")
tee = os.path.join(dck_fold, f"'{ligand_file}'_output.log")
vina = f'%vina --config {c_file} --receptor {receptor_file} --ligand {ligand_path} --out {output_path} | tee {tee}'
print(vina)
try:
os.chdir('/content/vina')
subprocess.call(vina, shell=True)
print(f'Successfully processed: {ligand_file}')
except Exception as e:
print(f'Error processing: {ligand_file}')
print(f'Error details: {str(e)}')
i used the double and single quotes so that the code does not break when a weird ligand name is there