Spaces:
Runtime error
Runtime error
Simon Duerr commited on
Commit ·
3279dbd
1
Parent(s): 8b47127
cpu requirements
Browse filesFiles changed (2)
- app.py+189-86
- requirements.txt+3-3
68 unmodified lines6970717273747576777898 unmodified lines17717817918018118218335 unmodified lines2192202212222232242252 unmodified lines22822923023123223323423523623770 unmodified lines3083093103113123133149 unmodified lines3243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923934 unmodified lines39839940040140240340466 unmodified lines47147247347447547647747810 unmodified lines489490491492493494495242 unmodified lines73873974074174274374424 unmodified lines7697707717727737747753 unmodified lines7797807817827837847857867877887897907917927937947955 unmodified lines80180280380480580680780880981081181281381422 unmodified lines83783883984084184284314 unmodified lines8588598608618628638645 unmodified lines87087187287387487587687787887988088188288388488588688788888989089189289389489538 unmodified lines93493593693793893994092 unmodified lines10331034103510361037103810391040104110421043104410451046104710488 unmodified lines105710581059106010611062106388 unmodified lines11521153115411551156115711582 unmodified lines116111621163116411651166116730 unmodified lines119811991200120112021203120415 unmodified lines122012211222122312241225122612277 unmodified lines123512361237123812391240124112426 unmodified lines124912501251125212531254125512561257125812591260126112621263126412651266126728 unmodified lines129612971298129913001301130213033 unmodified lines130713081309131013111312131313141315131620 unmodified lines133713381339134013411342134368 unmodified linesbuf.delete()print("Is cuda available",torch.cuda.is_available())stream = os.popen('nvcc --version')output = stream.read()print(output)def setup_af(seq, model_name="model_5_ptm"):98 unmodified linesio.set_structure(sample_structure)io.save(f"outputs/out_{index}_aligned.pdb")# Doing this to get around biopython CEALIGN bug#subprocess.call("pymol -c -Q -r cealign.pml", shell=True)return aligner.rms, "outputs/reference.pdb", f"outputs/out_{index}_aligned.pdb"35 unmodified lines}positions = []for r in range(recycles + 1):outs = RUNNER(x, OPT)outs = jax.tree_map(lambda x: np.asarray(x), outs)2 unmodified linesplddts.append(outs["plddt"][:LEN])paes.append(outs["pae"])if os.path.exists("/home/duerr/phd/08_Code/ProteinMPNN"):save_pdb(outs, f"/home/duerr/phd/08_Code/ProteinMPNN/outputs/out_{i}.pdb", LEN)else:save_pdb(outs, f"/home/user/app/outputs/out_{i}.pdb", LEN)return plddts,paes, LENif os.path.exists("/home/duerr/phd/08_Code/ProteinMPNN"):70 unmodified linesreturn Noneelse:mol = Molecule(pdb_code)mol.write('original.pdb')# clean messy files and only include protein itselfmol.filter("protein")# renumber using moleculekit 0...len(protein)9 unmodified linesmol.write("cleaned.pdb")return "cleaned.pdb", dfdef assign_sasa(mol):from moleculekit.projections.metricsasa import MetricSasametr = MetricSasa(mode="residue", filtersel="protein")sasaR = metr.project(mol)[0]is_prot = mol.atomselect("protein")resids=pd.DataFrame.from_dict({"resid":mol.resid, "is_prot":is_prot})new_masses=[]i_without_non_prot = 0for i, g in resids.groupby((resids['resid'].shift() != resids['resid']).cumsum()):if g["is_prot"].unique()[0]==True:g["sasa"]=sasaR[i_without_non_prot]i_without_non_prot+=1else:g["sasa"]=0new_masses.extend(list(g.sasa))return np.array(new_masses)def process_atomsel(atomsel):"""everything lowercase and replace some keywords not relevant for protein design"""atomsel=re.sub('sasa', 'mass',atomsel, flags=re.I)atomsel=re.sub('plddt', 'beta',atomsel, flags=re.I)return atomseldef make_fixed_positions_dict(atomsel, residue_index_df):# we use the uploaded file for the selectionmol = Molecule('original.pdb')# use index for selection as resids will change# set sasa to 0 for all non protein atoms (all non protein atoms are deleted later)mol.masses = assign_sasa(mol)print(mol.masses.shape)print(assign_sasa(mol).shape)atomsel = process_atomsel(atomsel)selected_residues = mol.get("index",atomsel)# clean upmol.filter("protein")mol.renumberResidues()# based on selected index now get residsselected_residues = [str(i) for i in selected_residues]if len(selected_residues)==0:return None, []selected_residues_str = " ".join(selected_residues)selected_residues=set(mol.get('resid', sel=f"index {selected_residues_str}"))# use the proteinMPNN index nomenclature to assemble fixed_positions_dictfixed_positions_df = residue_index_df[residue_index_df['new_resid'].isin(selected_residues)]chains = set(mol.get('chain', sel="all"))fixed_position_dict = {'cleaned':{}}#store the selected residues in a list for the visualization later with cleaned.pdbselected_residues = list(fixed_positions_df['new_resid'])for c in chains:fixed_position_dict['cleaned'][c]=[]for i, row in fixed_positions_df.iterrows():fixed_position_dict['cleaned'][row['chain']].append(row['proteinMPNN_index'])return fixed_position_dict, selected_residuesdef update(inp,file,4 unmodified linessampling_temp,model_name,backbone_noise,atomsel):from protein_mpnn_utils import (loss_nll,66 unmodified linesif atomsel == "":fixed_positions_dict, selected_residues = None, []else:fixed_positions_dict, selected_residues=make_fixed_positions_dict(atomsel, mol_index)pssm_dict = Noneomit_AA_dict = Nonebias_AA_dict = None10 unmodified linestied_positions_dict = make_tied_positions_for_homomers(pdb_dict_list)else:tied_positions_dict = Nonechain_id_dict = {}chain_id_dict[pdb_dict_list[0]["name"]] = (designed_chain_list, fixed_chain_list)with torch.no_grad():242 unmodified lines)seq_list.append(seq + chain_s)message += f"{line}\n"if fixed_positions_dict!=None:message += f"\nfixed positions:* {fixed_positions_dict['cleaned']} \n\n*uses CHAIN:[1..len(chain)] residue numbering"# somehow sequences still contain X, remove againfor i, x in enumerate(seq_list):24 unmodified lines)fig_tadjusted.update_xaxes(side="top")seq_dict = {"seq_list":seq_list, "recovery":seq_recovery, "seq_score":seq_score}return (message,fig,3 unmodified linespdb_path,gr.Dropdown.update(choices=seq_list),selected_residues,seq_dict)def update_AF(seq_dict, pdb, num_recycles,selectedResidues):# # run alphafold using ray# plddts, pae, num_res = run_alphafold(# startsequence, num_recycles# )allSeqs = seq_dict['seq_list']lenSeqs = len(allSeqs)if len(allSeqs[0]) > 700:return (5 unmodified linesplt.figure(),plt.figure(),)plddts, paes, num_res = ray.get(run_alphafold.remote(allSeqs, num_recycles))sequences = {}for i in range(lenSeqs):rms, input_pdb, aligned_pdb = align_structures(pdb, f"outputs/out_{i}.pdb", num_res,i)sequences[i]={"Seq":i,"RMSD":f"{rms:.2f}","Score":seq_dict['seq_score'][i],"Recovery":seq_dict["recovery"][i],"Mean pLDDT":f"{np.mean(plddts[i]):.4f}"}results=pd.DataFrame.from_dict(sequences, orient="index")print(results)plots = []for index, plddts_val in enumerate(plddts):22 unmodified lineslegend=dict(yanchor="bottom", y=0.01, xanchor="left", x=0.99),)pae_plots = []for i,pae in enumerate(paes):plt.figure()plt.title(f"Predicted Aligned Error sequence {i}")Ln = pae.shape[0]14 unmodified lines# plotAF_pae.write_html("test.html")# plotAF_pae.update_layout(title="Predicted Aligned Error", template="simple_white")return molecule(input_pdb, aligned_pdb, lenSeqs, num_res, selectedResidues, allSeqs, sequences), plotAF_plddt, pae_plots, resultsdef read_mol(molpath):5 unmodified linesreturn moldef molecule(input_pdb, aligned_pdb, lenSeqs, num_res, selectedResidues, allSeqs, sequences):mol = read_mol("outputs/reference.pdb")options =""pred_mol = "["seqdata = "{"selected = "selected"for i in range(lenSeqs):seqdata+=str(i)+': { "score": '+sequences[i]["Score"]+', "rmsd": '+sequences[i]["RMSD"]+', "recovery": '+sequences[i]["Recovery"]+', "plddt": '+sequences[i]["Mean pLDDT"]+', "seq":"'+allSeqs[i]+'"}'options+=f'<option {selected} value="{i}">sequence {i} </option>' #RMSD {sequences[i]["RMSD"]}, score {sequences[i]["Score"]}, recovery {sequences[i]["Recovery"]} pLDDT {sequences[i]["Mean pLDDT"]}p=f"outputs/out_{i}_aligned.pdb"pred_mol+=f"`{read_mol(p)}`"selected = ""if i!=lenSeqs-1:pred_mol+=","seqdata+=","pred_mol+="]"seqdata+="}"x = ("""<!DOCTYPE html>38 unmodified linesa sequence</label><select id="seq"class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">"""+options+"""</select></div><div class="font-mono bg-gray-100 py-3 px-2 font-sm rounded">92 unmodified lineslet element = null;let config = null;let currentIndex = 0;let seqs = """+seqdata+"""let data = """+ pred_mol+ """let pdb = `"""+ mol+ """`var selectedResidues = """+f"{selectedResidues}"+"""//AlphaFold code from https://gist.github.com/piroyon/30d1c1099ad488a7952c3b21a5bebc96let colorAlpha = function (atom) {if (atom.b < 50) {8 unmodified lines};let colors = {}for (let i=0; i<"""+str(num_res)+""";i++){if (selectedResidues.includes(i)){colors[i]="hotpink"}else{88 unmodified linesdef set_examples(example):label, inp, designed_chain, fixed_chain, homomer, num_seqs, sampling_temp, atomsel = examplereturn [label,inp,2 unmodified lineshomomer,gr.Slider.update(value=num_seqs),gr.Radio.update(value=sampling_temp),atomsel]30 unmodified linesvalue=0.1,label="Sampling temperature",)gr.Markdown(""" Sampling temperature for amino acids, `T=0.0` means taking argmax, `T>>1.0` means sample randomly. Suggested values `0.1, 0.15, 0.2, 0.25, 0.3`. Higher values will lead to more diversity.""")with gr.Row():15 unmodified linesgr.Markdown("for correct symmetric tying lenghts of homomer chains should be the same")gr.Markdown('## Fixed positions')gr.Markdown("""You can fix important positions in the protein. Resid should be specified with the same numbering as in the input pdb file. The fixed residues will be highlighted in the output.The [VMD selection](http://www.ks.uiuc.edu/Research/vmd/vmd-1.9.2/ug/node89.html) synthax is used. You can also select based on ligands or chains in the input structure to specify interfaces to be fixed.- <code>within 5 of resid 94</code> All residues that have >1 atom closer than 5 Å to any atom of residue 947 unmodified lines- <code>pLDDT >70 </code> Redesign all residues with low pLDDTNote that <code>sasa</code> and <code>pLDDT</code> selectors modify default VMD behavior. SASA is calculated using moleculekit and written to the mass attribute. Selections based on mass do not work.pLDDT is an alias for beta, it only works correctly with structures that contain the appropriate values in the beta column of the PDB file. """)atomsel = gr.Textbox(placeholder="Specify atom selection ", label="Fixed positions")btn = gr.Button("Run")label = gr.Textbox(label="Label", visible=False)6 unmodified lineshomomer,num_seqs,sampling_temp,atomsel],samples=[["Homomer design", "1O91", "A,B,C", "", True, 2, 0.1,""],["Monomer design", "6MRR", "A", "", False, 2, 0.1,""],["Redesign of Homomer to Heteromer", "3HTN", "A,B", "C", False, 2, 0.1, ""],["Redesign of MID1 scaffold keeping binding site fixed", "3V1C", "A,B", "", False, 2, 0.1, "within 5 of resname ZN"],["Redesign of DNA binding protein", "3JRD", "A,B", "", False, 2, 0.1, "within 8 of nucleic"],["Surface Redesign of miniprotein", "7JZM", "A,B", "", False, 2, 0.1, "chain B or (chain A and sasa < 20)"],],)gr.Markdown("# Output")with gr.Tabs():28 unmodified lineswith gr.Row():with gr.Row():chosen_seq = gr.Dropdown(choices=[], label="Select a sequence for validation",visible=False)num_recycles = gr.Dropdown(choices=[0, 1, 3, 5], value=3, label="num Recycles"3 unmodified linesmol = gr.HTML()with gr.Column():gr.Markdown("## Metrics")results = gr.Dataframe(nteractive=False, row_count=(0, 'dynamic'), headers=["Seq","RMSD","Score","Recovery","Mean pLDDT"])plotAF_plddt = gr.Plot(label="pLDDT")# remove maxh80 class from cssplotAF_pae = gr.Gallery(label="PAE plots") #gr.Plot(label="PAE")tempFile = gr.Variable()selectedResidues = gr.Variable()seq_dict = gr.Variable()20 unmodified linestempFile,chosen_seq,selectedResidues,seq_dict],)btnAF.click(68 unmodified lines6970717273747576777898 unmodified lines17717817918018118218335 unmodified lines2192202212222232242252 unmodified lines22822923023123223323423523623723823970 unmodified lines3103113123133143153169 unmodified lines3263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973984 unmodified lines40340440540640740840966 unmodified lines47647747847948048148248348448510 unmodified lines496497498499500501502242 unmodified lines74574674774874975075124 unmodified lines7767777787797807817823 unmodified lines7867877887897907917927937947957967977987998008018025 unmodified lines80880981081181281381481581681781881982082182282382482582682782882922 unmodified lines85285385485585685785814 unmodified lines8738748758768778788798808818828838848858868878888898908918925 unmodified lines89889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593638 unmodified lines97597697797897998098198298392 unmodified lines1076107710781079108010811082108310841085108610871088108910901091109210938 unmodified lines11021103110411051106110711081109111088 unmodified lines11991200120112021203120412051206120712081209121012111212121312142 unmodified lines121712181219122012211222122330 unmodified lines1254125512561257125812591260126115 unmodified lines1277127812791280128112821283128412857 unmodified lines129312941295129612971298129913001301130213036 unmodified lines13101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135428 unmodified lines1383138413851386138713881389139013913 unmodified lines139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141920 unmodified lines144014411442144314441445144668 unmodified linesbuf.delete()print("Is cuda available", torch.cuda.is_available())# stream = os.popen("nvcc --version")# output = stream.read()# print(output)def setup_af(seq, model_name="model_5_ptm"):98 unmodified linesio.set_structure(sample_structure)io.save(f"outputs/out_{index}_aligned.pdb")# Doing this to get around biopython CEALIGN bug# subprocess.call("pymol -c -Q -r cealign.pml", shell=True)return aligner.rms, "outputs/reference.pdb", f"outputs/out_{index}_aligned.pdb"35 unmodified lines}positions = []for r in range(recycles + 1):outs = RUNNER(x, OPT)outs = jax.tree_map(lambda x: np.asarray(x), outs)2 unmodified linesplddts.append(outs["plddt"][:LEN])paes.append(outs["pae"])if os.path.exists("/home/duerr/phd/08_Code/ProteinMPNN"):save_pdb(outs, f"/home/duerr/phd/08_Code/ProteinMPNN/outputs/out_{i}.pdb", LEN)else:save_pdb(outs, f"/home/user/app/outputs/out_{i}.pdb", LEN)return plddts, paes, LENif os.path.exists("/home/duerr/phd/08_Code/ProteinMPNN"):70 unmodified linesreturn Noneelse:mol = Molecule(pdb_code)mol.write("original.pdb")# clean messy files and only include protein itselfmol.filter("protein")# renumber using moleculekit 0...len(protein)9 unmodified linesmol.write("cleaned.pdb")return "cleaned.pdb", dfdef assign_sasa(mol):from moleculekit.projections.metricsasa import MetricSasametr = MetricSasa(mode="residue", filtersel="protein")sasaR = metr.project(mol)[0]is_prot = mol.atomselect("protein")resids = pd.DataFrame.from_dict({"resid": mol.resid, "is_prot": is_prot})new_masses = []i_without_non_prot = 0for i, g in resids.groupby((resids["resid"].shift() != resids["resid"]).cumsum()):if g["is_prot"].unique()[0] == True:g["sasa"] = sasaR[i_without_non_prot]i_without_non_prot += 1else:g["sasa"] = 0new_masses.extend(list(g.sasa))return np.array(new_masses)def process_atomsel(atomsel):"""everything lowercase and replace some keywords not relevant for protein design"""atomsel = re.sub("sasa", "mass", atomsel, flags=re.I)atomsel = re.sub("plddt", "beta", atomsel, flags=re.I)return atomseldef make_fixed_positions_dict(atomsel, residue_index_df):# we use the uploaded file for the selectionmol = Molecule("original.pdb")# use index for selection as resids will change# set sasa to 0 for all non protein atoms (all non protein atoms are deleted later)mol.masses = assign_sasa(mol)print(mol.masses.shape)print(assign_sasa(mol).shape)atomsel = process_atomsel(atomsel)selected_residues = mol.get("index", atomsel)# clean upmol.filter("protein")mol.renumberResidues()# based on selected index now get residsselected_residues = [str(i) for i in selected_residues]if len(selected_residues) == 0:return None, []selected_residues_str = " ".join(selected_residues)selected_residues = set(mol.get("resid", sel=f"index {selected_residues_str}"))# use the proteinMPNN index nomenclature to assemble fixed_positions_dictfixed_positions_df = residue_index_df[residue_index_df["new_resid"].isin(selected_residues)]chains = set(mol.get("chain", sel="all"))fixed_position_dict = {"cleaned": {}}# store the selected residues in a list for the visualization later with cleaned.pdbselected_residues = list(fixed_positions_df["new_resid"])for c in chains:fixed_position_dict["cleaned"][c] = []for i, row in fixed_positions_df.iterrows():fixed_position_dict["cleaned"][row["chain"]].append(row["proteinMPNN_index"])return fixed_position_dict, selected_residuesdef update(inp,file,4 unmodified linessampling_temp,model_name,backbone_noise,atomsel,):from protein_mpnn_utils import (loss_nll,66 unmodified linesif atomsel == "":fixed_positions_dict, selected_residues = None, []else:fixed_positions_dict, selected_residues = make_fixed_positions_dict(atomsel, mol_index)pssm_dict = Noneomit_AA_dict = Nonebias_AA_dict = None10 unmodified linestied_positions_dict = make_tied_positions_for_homomers(pdb_dict_list)else:tied_positions_dict = Nonechain_id_dict = {}chain_id_dict[pdb_dict_list[0]["name"]] = (designed_chain_list, fixed_chain_list)with torch.no_grad():242 unmodified lines)seq_list.append(seq + chain_s)message += f"{line}\n"if fixed_positions_dict != None:message += f"\nfixed positions:* {fixed_positions_dict['cleaned']} \n\n*uses CHAIN:[1..len(chain)] residue numbering"# somehow sequences still contain X, remove againfor i, x in enumerate(seq_list):24 unmodified lines)fig_tadjusted.update_xaxes(side="top")seq_dict = {"seq_list": seq_list, "recovery": seq_recovery, "seq_score": seq_score}return (message,fig,3 unmodified linespdb_path,gr.Dropdown.update(choices=seq_list),selected_residues,seq_dict,)def update_AF(seq_dict, pdb, num_recycles, selectedResidues):# # run alphafold using ray# plddts, pae, num_res = run_alphafold(# startsequence, num_recycles# )allSeqs = seq_dict["seq_list"]lenSeqs = len(allSeqs)if len(allSeqs[0]) > 700:return (5 unmodified linesplt.figure(),plt.figure(),)plddts, paes, num_res = ray.get(run_alphafold.remote(allSeqs, num_recycles))sequences = {}for i in range(lenSeqs):rms, input_pdb, aligned_pdb = align_structures(pdb, f"outputs/out_{i}.pdb", num_res, i)sequences[i] = {"Seq": i,"RMSD": f"{rms:.2f}","Score": seq_dict["seq_score"][i],"Recovery": seq_dict["recovery"][i],"Mean pLDDT": f"{np.mean(plddts[i]):.4f}",}results = pd.DataFrame.from_dict(sequences, orient="index")print(results)plots = []for index, plddts_val in enumerate(plddts):22 unmodified lineslegend=dict(yanchor="bottom", y=0.01, xanchor="left", x=0.99),)pae_plots = []for i, pae in enumerate(paes):plt.figure()plt.title(f"Predicted Aligned Error sequence {i}")Ln = pae.shape[0]14 unmodified lines# plotAF_pae.write_html("test.html")# plotAF_pae.update_layout(title="Predicted Aligned Error", template="simple_white")return (molecule(input_pdb,aligned_pdb,lenSeqs,num_res,selectedResidues,allSeqs,sequences,),plotAF_plddt,pae_plots,results,)def read_mol(molpath):5 unmodified linesreturn moldef molecule(input_pdb, aligned_pdb, lenSeqs, num_res, selectedResidues, allSeqs, sequences):mol = read_mol("outputs/reference.pdb")options = ""pred_mol = "["seqdata = "{"selected = "selected"for i in range(lenSeqs):seqdata += (str(i)+ ': { "score": '+ sequences[i]["Score"]+ ', "rmsd": '+ sequences[i]["RMSD"]+ ', "recovery": '+ sequences[i]["Recovery"]+ ', "plddt": '+ sequences[i]["Mean pLDDT"]+ ', "seq":"'+ allSeqs[i]+ '"}')options += f'<option {selected} value="{i}">sequence {i} </option>' # RMSD {sequences[i]["RMSD"]}, score {sequences[i]["Score"]}, recovery {sequences[i]["Recovery"]} pLDDT {sequences[i]["Mean pLDDT"]}p = f"outputs/out_{i}_aligned.pdb"pred_mol += f"`{read_mol(p)}`"selected = ""if i != lenSeqs - 1:pred_mol += ","seqdata += ","pred_mol += "]"seqdata += "}"x = ("""<!DOCTYPE html>38 unmodified linesa sequence</label><select id="seq"class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">"""+ options+ """</select></div><div class="font-mono bg-gray-100 py-3 px-2 font-sm rounded">92 unmodified lineslet element = null;let config = null;let currentIndex = 0;let seqs = """+ seqdata+ """let data = """+ pred_mol+ """let pdb = `"""+ mol+ """`var selectedResidues = """+ f"{selectedResidues}"+ """//AlphaFold code from https://gist.github.com/piroyon/30d1c1099ad488a7952c3b21a5bebc96let colorAlpha = function (atom) {if (atom.b < 50) {8 unmodified lines};let colors = {}for (let i=0; i<"""+ str(num_res)+ """;i++){if (selectedResidues.includes(i)){colors[i]="hotpink"}else{88 unmodified linesdef set_examples(example):(label,inp,designed_chain,fixed_chain,homomer,num_seqs,sampling_temp,atomsel,) = examplereturn [label,inp,2 unmodified lineshomomer,gr.Slider.update(value=num_seqs),gr.Radio.update(value=sampling_temp),atomsel,]30 unmodified linesvalue=0.1,label="Sampling temperature",)gr.Markdown(""" Sampling temperature for amino acids, `T=0.0` means taking argmax, `T>>1.0` means sample randomly. Suggested values `0.1, 0.15, 0.2, 0.25, 0.3`. Higher values will lead to more diversity.""")with gr.Row():15 unmodified linesgr.Markdown("for correct symmetric tying lenghts of homomer chains should be the same")gr.Markdown("## Fixed positions")gr.Markdown("""You can fix important positions in the protein. Resid should be specified with the same numbering as in the input pdb file. The fixed residues will be highlighted in the output.The [VMD selection](http://www.ks.uiuc.edu/Research/vmd/vmd-1.9.2/ug/node89.html) synthax is used. You can also select based on ligands or chains in the input structure to specify interfaces to be fixed.- <code>within 5 of resid 94</code> All residues that have >1 atom closer than 5 Å to any atom of residue 947 unmodified lines- <code>pLDDT >70 </code> Redesign all residues with low pLDDTNote that <code>sasa</code> and <code>pLDDT</code> selectors modify default VMD behavior. SASA is calculated using moleculekit and written to the mass attribute. Selections based on mass do not work.pLDDT is an alias for beta, it only works correctly with structures that contain the appropriate values in the beta column of the PDB file. """)atomsel = gr.Textbox(placeholder="Specify atom selection ", label="Fixed positions")btn = gr.Button("Run")label = gr.Textbox(label="Label", visible=False)6 unmodified lineshomomer,num_seqs,sampling_temp,atomsel,],samples=[["Homomer design", "1O91", "A,B,C", "", True, 2, 0.1, ""],["Monomer design", "6MRR", "A", "", False, 2, 0.1, ""],["Redesign of Homomer to Heteromer", "3HTN", "A,B", "C", False, 2, 0.1, ""],["Redesign of MID1 scaffold keeping binding site fixed","3V1C","A,B","",False,2,0.1,"within 5 of resname ZN",],["Redesign of DNA binding protein","3JRD","A,B","",False,2,0.1,"within 8 of nucleic",],["Surface Redesign of miniprotein","7JZM","A,B","",False,2,0.1,"chain B or (chain A and sasa < 20)",],],)gr.Markdown("# Output")with gr.Tabs():28 unmodified lineswith gr.Row():with gr.Row():chosen_seq = gr.Dropdown(choices=[],label="Select a sequence for validation",visible=False,)num_recycles = gr.Dropdown(choices=[0, 1, 3, 5], value=3, label="num Recycles"3 unmodified linesmol = gr.HTML()with gr.Column():gr.Markdown("## Metrics")p = {0: {"Seq": "NA","RMSD": "NA","Score": "NA","Recovery": "NA","Mean pLDDT": "NA",}}placeholder = pd.DataFrame.from_dict(p, orient="index")results = gr.Dataframe(placeholder,interactive=False,row_count=(1, "dynamic"),headers=["Seq", "RMSD", "Score", "Recovery", "Mean pLDDT"],)plotAF_plddt = gr.Plot(label="pLDDT")# remove maxh80 class from cssplotAF_pae = gr.Gallery(label="PAE plots") # gr.Plot(label="PAE")tempFile = gr.Variable()selectedResidues = gr.Variable()seq_dict = gr.Variable()20 unmodified linestempFile,chosen_seq,selectedResidues,seq_dict,],)btnAF.click(
5 unmodified lines6789101112134 unmodified lines181920212223245 unmodified linesdm-tree==0.1.6docker==5.0.0immutabledict==2.0.0https://storage.googleapis.com/jax-releases/jax/jax-0.3.7.tar.gzhttps://storage.googleapis.com/jax-releases/cuda11/jaxlib-0.3.7+cuda11.cudnn805-cp38-none-manylinux2014_x86_64.whlml-collections==0.1.0numpypandas==1.3.44 unmodified linesGPUtilraytqdmgradio==3.0.11protobuf<4mdtraj-f https://storage.googleapis.com/jax-releases/jax_releases.html5 unmodified lines6789101112134 unmodified lines181920212223245 unmodified linesdm-tree==0.1.6docker==5.0.0immutabledict==2.0.0jax==0.3.7jaxlib==0.3.7ml-collections==0.1.0numpypandas==1.3.44 unmodified linesGPUtilraytqdmgradio==3.1.4protobuf<4mdtraj-f https://storage.googleapis.com/jax-releases/jax_releases.html
app.py+189-86
requirements.txt+3-3