Spaces:
Runtime error
Runtime error
Simon Duerr commited on
Commit ·
a82b6a2
1
Parent(s): 5cc9777
fix default options
Browse filesFiles changed (2)
- app.py+17-16
- rosettafold_pymol.py+19-13
239 unmodified lines24024124224324424524624724824925019 unmodified lines2702712722732742752762 unmodified lines2792802812822832842852862872882892902912922932942952962972 unmodified lines300301302303304305306307308309310311312239 unmodified linesorder = int(order)max_extra_msa = max_msa * 8sequence = re.sub("[^A-Z:]", "", sequence.replace("/", ":").upper())sequence = re.sub(":+", ":", sequence)sequence = re.sub("^[:]+", "", sequence)sequence = re.sub("[:]+$", "", sequence)if sym in ["X", "C"]:copies = int(order)elif sym in ["D"]:19 unmodified linesprint(f"jobname: {jobname}")print(f"lengths: {lengths}")os.makedirs(jobname, exist_ok=True)if msa_method == "mmseqs2":get_msa(u_sequences, jobname, mode=pair_mode, max_msa=max_extra_msa)2 unmodified linesu_sequence = "/".join(u_sequences)with open(f"{jobname}/msa.a3m", "w") as a3m:a3m.write(f">{jobname}\n{u_sequence}\n")elif msa_method == "custom_a3m":print("upload custom a3m")# msa_dict = files.upload()lines = msa_dict[list(msa_dict.keys())[0]].decode().splitlines()a3m_lines = []for line in lines:line = line.replace("\x00", "")if len(line) > 0 and not line.startswith("#"):a3m_lines.append(line)with open(f"{jobname}/msa.a3m", "w") as a3m:a3m.write("\n".join(a3m_lines))best_plddt = Nonebest_seed = None2 unmodified linesrandom.seed(seed)np.random.seed(seed)npz = f"{jobname}/rf2_seed{seed}_00.npz"pred.predict(inputs=[f"{jobname}/msa.a3m"],out_prefix=f"{jobname}/rf2_seed{seed}",symm=symm,ffdb=None, # TODO (templates),n_recycles=num_recycles,msa_mask=0.15 if use_mlm else 0.0,msa_concat_mode=msa_concat_mode,nseqs=max_msa,nseqs_full=max_extra_msa,239 unmodified lines24024124224324424524624724824925025119 unmodified lines2712722732742752762772 unmodified lines2802812822832842852862872882892902912922932942952962 unmodified lines299300301302303304305306307308309310311312313239 unmodified linesorder = int(order)max_extra_msa = max_msa * 8print("sequence", sequence)sequence = re.sub("[^A-Z:]", "", sequence.replace("/", ":").upper())sequence = re.sub(":+", ":", sequence)sequence = re.sub("^[:]+", "", sequence)sequence = re.sub("[:]+$", "", sequence)print("sequence", sequence)if sym in ["X", "C"]:copies = int(order)elif sym in ["D"]:19 unmodified linesprint(f"jobname: {jobname}")print(f"lengths: {lengths}")print("final_sequence", u_sequences)os.makedirs(jobname, exist_ok=True)if msa_method == "mmseqs2":get_msa(u_sequences, jobname, mode=pair_mode, max_msa=max_extra_msa)2 unmodified linesu_sequence = "/".join(u_sequences)with open(f"{jobname}/msa.a3m", "w") as a3m:a3m.write(f">{jobname}\n{u_sequence}\n")# elif msa_method == "custom_a3m":# print("upload custom a3m")# # msa_dict = files.upload()# lines = msa_dict[list(msa_dict.keys())[0]].decode().splitlines()# a3m_lines = []# for line in lines:# line = line.replace("\x00", "")# if len(line) > 0 and not line.startswith("#"):# a3m_lines.append(line)# with open(f"{jobname}/msa.a3m", "w") as a3m:# a3m.write("\n".join(a3m_lines))best_plddt = Nonebest_seed = None2 unmodified linesrandom.seed(seed)np.random.seed(seed)npz = f"{jobname}/rf2_seed{seed}_00.npz"mlm = 0.15 if use_mlm else 0print("MLM", mlm, use_mlm)pred.predict(inputs=[f"{jobname}/msa.a3m"],out_prefix=f"{jobname}/rf2_seed{seed}",symm=symm,ffdb=None, # TODO (templates),n_recycles=num_recycles,msa_mask=0.15 if use_mlm else 0,msa_concat_mode=msa_concat_mode,nseqs=max_msa,nseqs_full=max_extra_msa,
12345661 unmodified lines6869707172737475767778798034 unmodified lines1151161171181191201211221231241251261274 unmodified lines1321331341351361371381393 unmodified lines143144145146147148149150151152from pymol import cmdimport requests# from gradio_client import Client61 unmodified linesmsa_concat_mode: str = "diag",msa_method: str = "single_sequence",pair_mode: str = "unpaired_paired",collapse_identical: bool = True,num_recycles: int = 0,use_mlm: bool = True,use_dropout: bool = True,max_msa: int = 16,random_seed: int = 0,num_models: int = 0,):"""AUTHOR34 unmodified linesCollapse identical sequences Default:Truenum_recycles:Number of recycles Default:0 Options: 0, 1, 3, 6, 12, 24use_mlm:Use MLM Default:Trueuse_dropout:Use dropout Default:Truemax_msa:Max MSA Default:164 unmodified linesnum_models:Number of models Default:0"""response = requests.post("https://simonduerr-rosettafold2.hf.space/run/rosettafold2/",json={"data": [sequence, # str in 'sequence' Textbox component3 unmodified lines"diag", # str (Option from: ['diag', 'repeat', 'default']) in 'msa_concat_mode' Dropdown component"single_sequence", # str (Option from: ['mmseqs2', 'single_sequence', 'custom_a3m']) in 'msa_method' Dropdown component"unpaired_paired", # str (Option from: ['unpaired_paired', 'paired', 'unpaired']) in 'pair_mode' Dropdown componentTrue, # bool in 'collapse_identical' Checkbox component0, # int (Option from: ['0', '1', '3', '6', '12', '24']) in 'num_recycles' Dropdown componentTrue, # bool in 'use_mlm' Checkbox componentTrue, # bool in 'use_dropout' Checkbox component16, # int (Option from: ['16', '32', '64', '128', '256', '512']) in 'max_msa' Dropdown component0, # int in 'random_seed' Textbox component1, # int (Option from: ['1', '2', '4', '8', '16', '32']) in 'num_models' Dropdown component123456761 unmodified lines6970717273747576777879808134 unmodified lines1161171181191201211221231241251261271284 unmodified lines1331341351361371381391401411421431441453 unmodified lines149150151152153154155156157158from pymol import cmdimport requestsimport os# from gradio_client import Client61 unmodified linesmsa_concat_mode: str = "diag",msa_method: str = "single_sequence",pair_mode: str = "unpaired_paired",collapse_identical: bool = False,num_recycles: int = 1,use_mlm: bool = False,use_dropout: bool = False,max_msa: int = 16,random_seed: int = 0,num_models: int = 1,):"""AUTHOR34 unmodified linesCollapse identical sequences Default:Truenum_recycles:Number of recycles Default:6 Options: 0, 1, 3, 6, 12, 24use_mlm:Use MLM Default:Falseuse_dropout:Use dropout Default:Falsemax_msa:Max MSA Default:164 unmodified linesnum_models:Number of models Default:0"""if os.path.exists("/home/user/app/"):url = "https://simonduerr-rosettafold2.hf.space"else:url = "http://localhost:7860"response = requests.post(url + "/run/rosettafold2/",json={"data": [sequence, # str in 'sequence' Textbox component3 unmodified lines"diag", # str (Option from: ['diag', 'repeat', 'default']) in 'msa_concat_mode' Dropdown component"single_sequence", # str (Option from: ['mmseqs2', 'single_sequence', 'custom_a3m']) in 'msa_method' Dropdown component"unpaired_paired", # str (Option from: ['unpaired_paired', 'paired', 'unpaired']) in 'pair_mode' Dropdown componentFalse, # bool in 'collapse_identical' Checkbox component6, # int (Option from: ['0', '1', '3', '6', '12', '24']) in 'num_recycles' Dropdown componentFalse, # bool in 'use_mlm' Checkbox componentFalse, # bool in 'use_dropout' Checkbox component16, # int (Option from: ['16', '32', '64', '128', '256', '512']) in 'max_msa' Dropdown component0, # int in 'random_seed' Textbox component1, # int (Option from: ['1', '2', '4', '8', '16', '32']) in 'num_models' Dropdown component
app.py+17-16
rosettafold_pymol.py+19-13