aksell commited on
Commit
04b479d
1 Parent(s): 519eadd

Add demo app

Browse files
Files changed (3) hide show
  1. README.md +2 -1
  2. demo.py +66 -0
  3. requirements.txt +123 -0
README.md CHANGED
@@ -5,7 +5,8 @@ colorFrom: yellow
5
  colorTo: blue
6
  sdk: streamlit
7
  sdk_version: 1.19.0
8
- app_file: app.py
 
9
  pinned: false
10
  license: mit
11
  ---
 
5
  colorTo: blue
6
  sdk: streamlit
7
  sdk_version: 1.19.0
8
+ python_version: 3.10.5
9
+ app_file: demo.py
10
  pinned: false
11
  license: mit
12
  ---
demo.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(layout="wide")
4
+ st.header("Demo: Proteins in a grid")
5
+
6
+ sequences = """MINDLLDISRIISGKMTLDRAEVNLTAIARQVVEEQRQAAEAKSIQLLCSTPDTNHYVFGDFDRLKQTLWNLLSNAVKFTPSGGTVELELGY
7
+ MQGDSSISSSNRMFTLCKPLTVANETSTLSTTRNSKSNKRVSKQRVNLAESPERNAPSPASIKTNETEEFSTIKTTNNEVLGYEPNYVSYDF
8
+ MSTHVSLENTLASLQATFFSLEARHTALETQLLSTRTELAATKQELVRVQAEISRADAQAQDLKAQILTLKEKADQAEVEAAAATQRAEESQ
9
+ MVLLSTGPLPILFLGPSLAELNQKYQVVSDTLLRFTNTVTFNTLKFLGSDS
10
+ MNNDEQPFIMSTSGYAGNTTSSMNSTSDFNTNNKSNTWSNRFSNFIAYFSGVGWFIGAISVIFFIIYVIVFLSRKTKPSGQKQYSRTERNNR
11
+ MEAVYSFTITETGTGTVEVTPLDRTISGADIVYPPDTACVPLTVQPVINANGTWTLGSGCTGHFSVDTTGHVNCLTGGFGAAGVHTVIYTVE
12
+ MGLTTSGGARGFCSLAVLQELVPRPELLFVIDRAFHSGKHAVDMQVVDQEGLGDGVATLLYAHQGLYTCLLQAEARLLGREWAAVPALEPNF
13
+ MGLTTSGGARGFCSLAVLQELVPRPELLFVIDRAFHSGKHAVDMQVVDQEGLGDGVATLLYAHQGLYTCLLQAEARLLGREWAAVPALEPNF
14
+ MGAAGYTGSLILAALKQNPDIAVYALNRNDEKLKDVCGQYSNLKGQVCDLSNESQVEALLSGPRKTVVNLVGPYSFYGSRVLNACIEANCHY""".split(
15
+ "\n"
16
+ )
17
+
18
+ import time
19
+
20
+ import requests
21
+
22
+
23
+ @st.cache_data
24
+ def get_pdb(sequence):
25
+ retries = 0
26
+ pdb_str = None
27
+ url = "https://api.esmatlas.com/foldSequence/v1/pdb/"
28
+ while retries < 3 and pdb_str is None:
29
+ response = requests.post(url, data=sequence)
30
+ pdb_str = response.text
31
+ if pdb_str == "INTERNAL SERVER ERROR":
32
+ retries += 1
33
+ time.sleep(0.1)
34
+ pdb_str = None
35
+ return pdb_str
36
+
37
+
38
+ pdb_strings = []
39
+
40
+ for seq in sequences:
41
+ pdb = get_pdb(seq)
42
+ if pdb:
43
+ pdb_strings.append(pdb)
44
+
45
+ grid_size = 3
46
+
47
+ import py3Dmol
48
+
49
+ dim = st.number_input("Viewer dim (pk)", value=1300)
50
+ color = st.sidebar.selectbox("Color", ["spectrum", "black", "white"])
51
+ st.markdown("""
52
+ # See protein, cool result
53
+ Herer are my things
54
+ """)
55
+
56
+ view = py3Dmol.view(width=dim, height=dim, viewergrid=(grid_size, grid_size))
57
+
58
+ for i, pdb in enumerate(pdb_strings):
59
+ view.addModel(pdb, "pdb", viewer=(i // grid_size, i % grid_size))
60
+
61
+ view.zoomTo()
62
+ view.setStyle({"cartoon": {"color": color}})
63
+
64
+ import stmol
65
+
66
+ stmol.showmol(view, width=dim, height=dim)
requirements.txt ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ altair==4.2.2; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
2
+ anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.8"
3
+ appnope==0.1.3; platform_system == "Darwin" and python_version >= "3.9" and sys_platform == "darwin"
4
+ argon2-cffi-bindings==21.2.0; python_version >= "3.7"
5
+ argon2-cffi==21.3.0; python_version >= "3.8"
6
+ arrow==1.2.3; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
7
+ asttokens==2.2.1; python_version >= "3.9"
8
+ attrs==23.1.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
9
+ backcall==0.2.0; python_version >= "3.9"
10
+ beautifulsoup4==4.12.2; python_full_version >= "3.6.0" and python_version >= "3.7"
11
+ bleach==6.0.0; python_version >= "3.7"
12
+ blinker==1.6.2; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
13
+ cachetools==5.3.0; python_version >= "3.7" and python_version < "4.0" and (python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.6")
14
+ certifi==2023.5.7; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
15
+ cffi==1.15.1; implementation_name == "pypy" and python_version >= "3.8"
16
+ charset-normalizer==3.1.0; python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.7.0" or python_full_version > "3.9.7" and python_version >= "3.7"
17
+ click==8.1.3; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
18
+ colorama==0.4.6; python_version >= "3.9" and python_full_version < "3.0.0" and platform_system == "Windows" and sys_platform == "win32" or python_version >= "3.9" and python_full_version < "3.9.7" and platform_system == "Windows" and python_full_version >= "3.7.0" and sys_platform == "win32" or python_full_version > "3.9.7" and python_version >= "3.9" and platform_system == "Windows" and sys_platform == "win32"
19
+ comm==0.1.3; python_version >= "3.8"
20
+ debugpy==1.6.7; python_version >= "3.8"
21
+ decorator==5.1.1; python_version >= "3.9" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.9"
22
+ defusedxml==0.7.1; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
23
+ deprecation==2.1.0; python_version >= "3.7"
24
+ entrypoints==0.4; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
25
+ executing==1.2.0; python_version >= "3.9"
26
+ fastjsonschema==2.17.1; python_version >= "3.7"
27
+ fqdn==1.5.1; python_version >= "3.7" and python_version < "4" and python_full_version < "3.9.7" or python_version >= "3.7" and python_version < "4" and python_full_version > "3.9.7"
28
+ gitdb==4.0.10; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
29
+ gitpython==3.1.31; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
30
+ idna==3.4; python_version >= "3.8" and python_full_version < "3.9.7" and python_full_version >= "3.6.2" or python_full_version > "3.9.7" and python_version >= "3.8"
31
+ importlib-metadata==6.6.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
32
+ ipykernel==6.23.1; python_version >= "3.8"
33
+ ipyspeck==0.6.1; python_version >= "3.6"
34
+ ipython-genutils==0.2.0; python_version >= "3.7"
35
+ ipython==8.13.2; python_version >= "3.9"
36
+ ipywidgets==7.6.3; python_version >= "3.6"
37
+ isoduration==20.11.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
38
+ jedi==0.18.2; python_version >= "3.9"
39
+ jinja2==3.1.2; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
40
+ jsonpointer==2.3; python_version >= "3.7" and python_full_version < "3.0.0" or python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.4.0" or python_full_version > "3.9.7" and python_version >= "3.7"
41
+ jsonschema==4.17.3; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
42
+ jupyter-client==8.2.0; python_full_version >= "3.8.0" and python_version >= "3.8"
43
+ jupyter-core==5.3.0; python_full_version >= "3.8.0" and python_version >= "3.8"
44
+ jupyter-events==0.6.3; python_version >= "3.8"
45
+ jupyter-packaging==0.12.3; python_version >= "3.7"
46
+ jupyter-server-terminals==0.4.4; python_version >= "3.8"
47
+ jupyter-server==2.5.0; python_version >= "3.8"
48
+ jupyterlab-pygments==0.2.2; python_version >= "3.7"
49
+ jupyterlab-widgets==3.0.7; python_version >= "3.7"
50
+ markdown-it-py==2.2.0; python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.7.0" or python_full_version > "3.9.7" and python_version >= "3.7"
51
+ markupsafe==2.1.2; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
52
+ matplotlib-inline==0.1.6; python_version >= "3.9"
53
+ mdurl==0.1.2; python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.7.0" or python_full_version > "3.9.7" and python_version >= "3.7"
54
+ mistune==2.0.5; python_version >= "3.7"
55
+ nbclassic==1.0.0; python_version >= "3.7"
56
+ nbclient==0.8.0; python_full_version >= "3.8.0" and python_version >= "3.7"
57
+ nbconvert==7.4.0; python_version >= "3.8"
58
+ nbformat==5.8.0; python_full_version >= "3.8.0" and python_version >= "3.8"
59
+ nest-asyncio==1.5.6; python_version >= "3.8"
60
+ notebook-shim==0.2.3; python_version >= "3.7"
61
+ notebook==6.5.4; python_version >= "3.7"
62
+ numpy==1.24.3; python_version >= "3.11" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.11"
63
+ packaging==23.1; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
64
+ pandas==2.0.1; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
65
+ pandocfilters==1.5.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.7"
66
+ parso==0.8.3; python_version >= "3.9"
67
+ pexpect==4.8.0; sys_platform != "win32" and python_version >= "3.9"
68
+ pickleshare==0.7.5; python_version >= "3.9"
69
+ pillow==9.5.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
70
+ platformdirs==3.5.1; python_version >= "3.8"
71
+ prometheus-client==0.16.0; python_version >= "3.8"
72
+ prompt-toolkit==3.0.38; python_full_version >= "3.7.0" and python_version >= "3.9"
73
+ protobuf==3.20.3; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
74
+ psutil==5.9.5; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.8"
75
+ ptyprocess==0.7.0; sys_platform != "win32" and python_version >= "3.9" and os_name != "nt"
76
+ pure-eval==0.2.2; python_version >= "3.9"
77
+ py3dmol==2.0.3
78
+ pyarrow==12.0.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
79
+ pycparser==2.21; python_version >= "3.8" and python_full_version < "3.0.0" and implementation_name == "pypy" or implementation_name == "pypy" and python_version >= "3.8" and python_full_version >= "3.4.0"
80
+ pydeck==0.8.1b0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
81
+ pygments==2.15.1; python_version >= "3.9" and python_full_version < "3.9.7" and python_full_version >= "3.7.0" or python_full_version > "3.9.7" and python_version >= "3.9"
82
+ pympler==1.0.1; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.6"
83
+ pyrsistent==0.19.3; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
84
+ python-dateutil==2.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_version >= "3.8" and python_full_version < "3.9.7" and python_full_version >= "3.3.0" or python_full_version > "3.9.7" and python_version >= "3.8"
85
+ python-json-logger==2.0.7; python_version >= "3.8"
86
+ pytz==2023.3; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
87
+ pywin32==306; sys_platform == "win32" and platform_python_implementation != "PyPy" and python_version >= "3.8"
88
+ pywinpty==2.0.10; os_name == "nt" and python_version >= "3.8"
89
+ pyyaml==6.0; python_version >= "3.8"
90
+ pyzmq==25.0.2; python_version >= "3.8"
91
+ requests==2.31.0; python_version >= "3.7"
92
+ rfc3339-validator==0.1.4; python_version >= "3.8" and python_full_version < "3.0.0" or python_version >= "3.8" and python_full_version < "3.9.7" and python_full_version >= "3.5.0" or python_full_version > "3.9.7" and python_version >= "3.8"
93
+ rfc3986-validator==0.1.1; python_version >= "3.8" and python_full_version < "3.0.0" or python_version >= "3.8" and python_full_version < "3.9.7" and python_full_version >= "3.5.0" or python_full_version > "3.9.7" and python_version >= "3.8"
94
+ rich==13.3.5; python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.7.0" or python_full_version > "3.9.7" and python_version >= "3.6"
95
+ send2trash==1.8.2; python_version >= "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.8"
96
+ six==1.16.0; python_version >= "3.9" and python_full_version < "3.0.0" or python_version >= "3.9" and python_full_version < "3.9.7" and python_full_version >= "3.5.0" or python_full_version > "3.9.7" and python_version >= "3.9"
97
+ smmap==5.0.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
98
+ sniffio==1.3.0; python_full_version >= "3.6.2" and python_version >= "3.8"
99
+ soupsieve==2.4.1; python_full_version >= "3.6.0" and python_version >= "3.7"
100
+ stack-data==0.6.2; python_version >= "3.9"
101
+ stmol==0.0.9; python_version >= "3.6"
102
+ streamlit==1.22.0; (python_version >= "3.7" and python_full_version < "3.9.7") or (python_full_version > "3.9.7")
103
+ tenacity==8.2.2; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.6"
104
+ terminado==0.17.1; python_version >= "3.8"
105
+ tinycss2==1.2.1; python_version >= "3.7"
106
+ toml==0.10.2; python_version >= "3.7" and python_full_version < "3.0.0" or python_version >= "3.7" and python_full_version < "3.9.7" and python_full_version >= "3.3.0" or python_full_version > "3.9.7" and python_version >= "3.6"
107
+ tomlkit==0.11.8; python_version >= "3.7"
108
+ toolz==0.12.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
109
+ tornado==6.3.2; python_version >= "3.8" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.8"
110
+ traitlets==5.9.0; python_full_version >= "3.8.0" and python_version >= "3.9"
111
+ typing-extensions==4.6.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
112
+ tzdata==2023.3; python_version >= "3.8" and python_full_version < "3.9.7" and platform_system == "Windows" or python_full_version > "3.9.7" and python_version >= "3.8" and platform_system == "Windows"
113
+ tzlocal==5.0.1; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
114
+ uri-template==1.2.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
115
+ urllib3==2.0.2; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
116
+ validators==0.20.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.6"
117
+ watchdog==3.0.0; python_version >= "3.7" and python_full_version < "3.9.7" and platform_system != "Darwin" or python_full_version > "3.9.7" and platform_system != "Darwin" and python_version >= "3.7"
118
+ wcwidth==0.2.6; python_full_version >= "3.7.0" and python_version >= "3.9"
119
+ webcolors==1.13; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"
120
+ webencodings==0.5.1; python_version >= "3.7"
121
+ websocket-client==1.5.2; python_version >= "3.8"
122
+ widgetsnbextension==3.5.2; python_version >= "3.6"
123
+ zipp==3.15.0; python_version >= "3.7" and python_full_version < "3.9.7" or python_full_version > "3.9.7" and python_version >= "3.7"