PotionBio commited on
Commit
661c0a5
·
verified ·
1 Parent(s): 415b6c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -16,7 +16,7 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
16
 
17
  st.set_page_config(layout='wide')
18
  st.sidebar.title('🔮 GenPro2.5')
19
- st.sidebar.write('GenPro2 is an end-to-end protein sequence generator, structure predictor, and analysis that uses [ESMFold](https://esmatlas.com/explore?at=1%2C1%2C21.999999344348925) and the ESM-2 language model | [Potion.Bio](https://www.potion.bio)beta v2.51')
20
 
21
  def generate_sequence_from_words(words, length):
22
  seed = ' '.join(words).encode('utf-8')
@@ -128,7 +128,7 @@ def update(sequence, word1, word2, word3, sequence_length):
128
  st.write("Please try again later or contact support if the issue persists.")
129
 
130
  def share_on_twitter(word1, word2, word3, length, plddt):
131
- tweet_text = f"I just generated a unique protein using #GenPro2 by @WandsAI using the seed words #{word1}, #{word2}, #{word3} + sequence length of {length}. My Protein has a {plddt}% plDDT score! #PostYourProtein"
132
  tweet_url = f"https://twitter.com/intent/tweet?text={urllib.parse.quote(tweet_text)}"
133
  return tweet_url
134
 
@@ -154,14 +154,12 @@ Protein Length Guide:
154
  - 50-100 amino acids: Small proteins/peptides
155
  - 100-300 amino acids: Average protein domains
156
  - 300-500 amino acids: Larger single-domain proteins
157
-
158
  """)
159
 
160
  st.markdown("""
161
  1. Start by entering any three seed words of your choice and select a sequence length in the sidebar.
162
  2. Click 'Generate and Predict' to generate a unique protein sequence based on your inputs.
163
  3. GenPro2 then predicts the 3D structure of your protein and provides a confidence score.
164
-
165
  More about GenPro2 and Proteins:
166
  Your unique protein could be the key to unlocking new therapeutic possibilities or understanding disease mechanisms. Who knows? Your next generated sequence might just lead to a breakthrough. Start your journey into computational protein exploration! [Learn more](https://www.youtube.com/watch?v=KpedmJdrTpY)
167
  """)
@@ -181,7 +179,7 @@ if st.sidebar.button('Generate and Predict'):
181
  # Display structure information if available
182
  if st.session_state.structure_info:
183
  info = st.session_state.structure_info
184
- st.subheader(f'I just discovered a new protein using seed words: {info["word1"]}, {info["word2"]}, and {info["word3"]} generated by @PotionBio')
185
  render_mol(info['pdb_string'])
186
 
187
  st.subheader('plDDT Confidence Score')
@@ -192,21 +190,20 @@ if st.session_state.structure_info:
192
  st.subheader("Share your unique protein on X(Twitter)")
193
 
194
  st.markdown("""
195
- <div style='background-color: #000000; padding: 10px; border-radius: 5px; font-size: 0.8em;'>
196
  <ol>
197
  <li>Take a screenshot of the protein structure above.</li>
198
- <li>Click the 'Share Results' link below to open a pre-filled post with your proteins seed-words.</li>
199
- <li>Upload your protein and post!</li>
200
  </ol>
201
  </div>
202
  """, unsafe_allow_html=True)
203
 
204
- tweet_url = share_on_twitter(info["word1"], info["word2"], info["word3"])
205
  st.markdown(f"[Share Results]({tweet_url})")
206
 
207
  st.markdown("""
208
  ## What to do next:
209
-
210
  """)
211
 
212
  col1, col2 = st.columns(2)
@@ -228,9 +225,7 @@ if st.session_state.structure_info:
228
  1. Click the 'analyze protein' button to search the [BLAST](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&PAGE_TYPE=BlastSearch&LINK_LOC=blasthome) protein database and see if your protein matches any known sequences. The sequence identity will show how close your sequence matches. *Note this can take several minutes
229
  2. Download your protein data and visit the [Protein Data Bank (PDB)](https://www.rcsb.org/) to match your protein structure against known protein structures.
230
  3. If you think you've discovered a unique and useful protein share it with the world on social media!
231
-
232
 
233
  **Remember, this folding is based on randomly generated sequences. Interpret the results with caution.
234
  Enjoy exploring the world of protein sequences!
235
- """)
236
-
 
16
 
17
  st.set_page_config(layout='wide')
18
  st.sidebar.title('🔮 GenPro2.5')
19
+ st.sidebar.write('GenPro2.5 is an end-to-end protein sequence generator, structure predictor, and analysis that uses [ESMFold](https://esmatlas.com/explore?at=1%2C1%2C21.999999344348925) and the ESM-2 language model | beta v2.51')
20
 
21
  def generate_sequence_from_words(words, length):
22
  seed = ' '.join(words).encode('utf-8')
 
128
  st.write("Please try again later or contact support if the issue persists.")
129
 
130
  def share_on_twitter(word1, word2, word3, length, plddt):
131
+ tweet_text = f"I just discoved a new protein using the seed words: #{word1}, #{word2}, #{word3} | generated by @PotionBio"
132
  tweet_url = f"https://twitter.com/intent/tweet?text={urllib.parse.quote(tweet_text)}"
133
  return tweet_url
134
 
 
154
  - 50-100 amino acids: Small proteins/peptides
155
  - 100-300 amino acids: Average protein domains
156
  - 300-500 amino acids: Larger single-domain proteins
 
157
  """)
158
 
159
  st.markdown("""
160
  1. Start by entering any three seed words of your choice and select a sequence length in the sidebar.
161
  2. Click 'Generate and Predict' to generate a unique protein sequence based on your inputs.
162
  3. GenPro2 then predicts the 3D structure of your protein and provides a confidence score.
 
163
  More about GenPro2 and Proteins:
164
  Your unique protein could be the key to unlocking new therapeutic possibilities or understanding disease mechanisms. Who knows? Your next generated sequence might just lead to a breakthrough. Start your journey into computational protein exploration! [Learn more](https://www.youtube.com/watch?v=KpedmJdrTpY)
165
  """)
 
179
  # Display structure information if available
180
  if st.session_state.structure_info:
181
  info = st.session_state.structure_info
182
+ st.subheader(f'Predicted protein structure using seed: {info["word1"]}, {info["word2"]}, and {info["word3"]}')
183
  render_mol(info['pdb_string'])
184
 
185
  st.subheader('plDDT Confidence Score')
 
190
  st.subheader("Share your unique protein on X(Twitter)")
191
 
192
  st.markdown("""
193
+ <div style='background-color: #e6f2ff; padding: 10px; border-radius: 5px; font-size: 0.8em;'>
194
  <ol>
195
  <li>Take a screenshot of the protein structure above.</li>
196
+ <li>Click the 'Share Results' link below to open a pre-filled post with your proteins seed-words and plDDT score.</li>
197
+ <li>Be sure to attach a screenshot of your protein before you post!</li>
198
  </ol>
199
  </div>
200
  """, unsafe_allow_html=True)
201
 
202
+ tweet_url = share_on_twitter(info["word1"], info["word2"], info["word3"], info["sequence_length"], plddt_score)
203
  st.markdown(f"[Share Results]({tweet_url})")
204
 
205
  st.markdown("""
206
  ## What to do next:
 
207
  """)
208
 
209
  col1, col2 = st.columns(2)
 
225
  1. Click the 'analyze protein' button to search the [BLAST](https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastp&PAGE_TYPE=BlastSearch&LINK_LOC=blasthome) protein database and see if your protein matches any known sequences. The sequence identity will show how close your sequence matches. *Note this can take several minutes
226
  2. Download your protein data and visit the [Protein Data Bank (PDB)](https://www.rcsb.org/) to match your protein structure against known protein structures.
227
  3. If you think you've discovered a unique and useful protein share it with the world on social media!
 
228
 
229
  **Remember, this folding is based on randomly generated sequences. Interpret the results with caution.
230
  Enjoy exploring the world of protein sequences!
231
+ """)