ColabFold icon indicating copy to clipboard operation
ColabFold copied to clipboard

Can relax_amber.ipynb be modified to handle a set of uploaded pdbs?

Open nmrworker opened this issue 2 years ago • 3 comments

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

nmrworker avatar Jun 16 '23 21:06 nmrworker

I achieved this by creating an iteration loop of the original ipynb file.

nmrworker avatar Jun 16 '23 23:06 nmrworker

Could you share your modified version? In-case anyone else would like to relax a bunch of proteins.

milot-mirdita avatar Jun 22 '23 02:06 milot-mirdita

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}')

nmrworker avatar Jun 22 '23 17:06 nmrworker