Can relax_amber.ipynb be modified to handle a set of uploaded pdbs?
Expected Behavior
generate a zipped file containing the amber relaxed structure of each uploaded pdb file
Current Behavior
only the first one is relaxed and downloaded
I achieved this by creating an iteration loop of the original ipynb file.
Could you share your modified version? In-case anyone else would like to relax a bunch of proteins.
Assuming the batch pdb file has the format of following, where "task-name_xxxxx" is the jobname, and "xxxxx" is colab assigned code: task-name_xxxxx_unrelaxed_rank_00x_alphafold2_multimer_v3_model_4_seed_00x the modified notebook will relax all and the resulted name will be: task-name_xxxxx_relaxed_rank_00x_alphafold2_multimer_v3_model_4_seed_00x and then download all the results as a zipped file "task-name_xxxxx.relaxed.zip"
from google.colab import files import re import os
pdb_dict = files.upload() jobname=re.sub(r'_unrelaxed.+','',list(pdb_dict.keys())[0])+".relaxed"; os.mkdir(jobname) for ipdb in pdb_dict: opdb=ipdb.replace("unrelaxed","relaxed") relax_me(pdb_in=ipdb, pdb_out=opdb) os.rename(opdb, f'{jobname}/{opdb}') relax_zip = f"{jobname}.zip" os.system(f"zip -r {relax_zip} {jobname}") files.download(f'{relax_zip}')