File size: 2,443 Bytes
68c1f50
 
e79439d
018853b
68c1f50
9b9bc05
 
 
 
 
 
 
 
 
39c302b
9b9bc05
39c302b
9b9bc05
39c302b
9b9bc05
 
 
 
 
62a73e7
 
 
 
 
 
 
 
 
9b9bc05
546cfd5
451285c
 
 
 
 
3ea8656
 
546cfd5
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from stmol import showmol
import py3Dmol
import streamlit as st
import requests

st.markdown("# ESM-2 Protein Folding demo")
st.markdown("You can input a single protein sequence and you get the predicted protein structure")

option = st.selectbox(
    'Select a protein',
    ("Antifreeze protein", "Plastic degradation protein",  "AI Generated protein", "7-bladed propeller fold", "custom"))

if option == "Plastic degradation protein":
    suggestion = "MGSSHHHHHHSSGLVPRGSHMRGPNPTAASLEASAGPFTVRSFTVSRPSGYGAGTVYYPTNAGGTVGAIAIVPGYTARQSSIKWWGPRLASHGFVVITIDTNSTLDQPSSRSSQQMAALRQVASLNGTSSSPIYGKVDTARMGVMGWSMGGGGSLISAANNPSLKAAAPQAPWDSSTNFSSVTVPTLIFACENDSIAPVNSSALPIYDSMSRNAKQFLEINGGSHSCANSGNSNQALIGKKGVAWMKRFMDNDTRYSTFACENPNSTRVSDFRTANCSLEDPAANKARKEAELAAATAEQ"
elif option == "Antifreeze protein":
    suggestion = "QCTGGADCTSCTGACTGCGNCPNAVTCTNSQHCVKANTCTGSTDCNTAQTCTNSKDCFEANTCTDSTNCYKATACTNSSGCPGH"
elif option == "AI Generated protein":
    suggestion = "MSGMKKLYEYTVTTLDEFLEKLKEFILNTSKDKIYKLTITNPKLIKDIGKAIAKAAEIADVDPKEIEEMIKAVEENELTKLVITIEQTDDKYVIKVELENEDGLVHSFEIYFKNKEEMEKFLELLEKLISKLSGS"
elif option == "7-bladed propeller fold":
    suggestion = "VKLAGNSSLCPINGWAVYSKDNSIRIGSKGDVFVIREPFISCSHLECRTFFLTQGALLNDKHSNGTVKDRSPHRTLMSCPVGEAPSPYNSRFESVAWSASACHDGTSWLTIGISGPDNGAVAVLKYNGIITDTIKSWRNNILRTQESECACVNGSCFTVMTDGPSNGQASYKIFKMEKGKVVKSVELDAPNYHYEECSCYPNAGEITCVCRDNWHGSNRPWVSFNQNLEYQIGYICSGVFGDNPRPNDGTGSCGPVSSNGAYGVKGFSFKYGNGVWIGRTKSTNSRSGFEMIWDPNGWTETDSSFSVKQDIVAITDWSGYSGSFVQHPELTGLDCIRPCFWVELIRGRPKESTIWTSGSSISFCGVNSDTVGWSWPDGAELPFTIDK"
else:
    suggestion = ""
    
sequence = st.text_input(label="Protein Sequence", value=suggestion)

headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
}

response = requests.post('https://api.esmatlas.com/foldSequence/v1/pdb/', headers=headers, data=sequence)
name = sequence[:3] + sequence[-3:] 
pdb_string = response.content.decode('utf-8')



xyzview = py3Dmol.view()
xyzview.addModel(pdb_string,'pdb')
xyzview.setStyle({'cartoon':{
        "color": "spectrum",}})
xyzview.zoomTo()
print("Set style")
showmol(xyzview, height = 500,width=800)
print("Displayed")

st.markdown("[ESM](https://esmatlas.com/about) by Meta using the API. You can also use Hugging Face `transformers` as shown [here](https://github.com/huggingface/notebooks/blob/main/examples/protein_folding.ipynb), which is supported since [v4.24](https://github.com/huggingface/transformers/releases/tag/v4.24.0).")