Andrew Stirn commited on
Commit
77e4f1f
·
1 Parent(s): 33f693d
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -1,13 +1,13 @@
1
  import streamlit as st
2
- import run as trun
3
  import pandas as pd
 
4
 
5
 
6
  def run_with_input(reset=False):
7
  if reset:
8
  st.write("")
9
  return 0
10
- returned_x = trun.run(st.session_state["userInput"])
11
  csv_x = returned_x.to_csv()
12
  st.write("model prediction: ", returned_x)
13
  return csv_x
@@ -15,17 +15,17 @@ def run_with_input(reset=False):
15
 
16
  # title and instructions
17
  st.title('TIGER Cas13 Efficacy Prediction')
18
- st.session_state['userInput'] = ""
19
- st.session_state["userInput"] = st.text_input('Enter target transcript (or substring):')
20
 
21
 
22
  csv_data = pd.DataFrame.from_dict({'Target Site': [''], 'LFC': [0.0]}).to_csv()
23
- if len(st.session_state['userInput']) < trun.GUIDE_LEN:
24
  st.write('Transcript length must be >= 23 bases. It is {:d} chars'.format(len(st.session_state['userInput'])))
25
  run_with_input(reset=True)
26
- elif all([True if item in "ACGTacgt" else False for item in st.session_state['userInput']]):
27
  st.write('This is your sequence', st.session_state["userInput"])
28
  csv_data = run_with_input()
29
  else:
30
- st.write("only ACTG is allowed")
31
- st.download_button(label="Download as CVS File", data=csv_data)
 
1
  import streamlit as st
 
2
  import pandas as pd
3
+ from run import run, GUIDE_LEN, NUCLEOTIDE_TOKENS
4
 
5
 
6
  def run_with_input(reset=False):
7
  if reset:
8
  st.write("")
9
  return 0
10
+ returned_x = run(st.session_state["userInput"])
11
  csv_x = returned_x.to_csv()
12
  st.write("model prediction: ", returned_x)
13
  return csv_x
 
15
 
16
  # title and instructions
17
  st.title('TIGER Cas13 Efficacy Prediction')
18
+ st.session_state['userInput'] = ''
19
+ st.session_state['userInput'] = st.text_input('Enter target transcript (or substring):')
20
 
21
 
22
  csv_data = pd.DataFrame.from_dict({'Target Site': [''], 'LFC': [0.0]}).to_csv()
23
+ if len(st.session_state['userInput']) < GUIDE_LEN:
24
  st.write('Transcript length must be >= 23 bases. It is {:d} chars'.format(len(st.session_state['userInput'])))
25
  run_with_input(reset=True)
26
+ elif all([True if nt.upper() in NUCLEOTIDE_TOKENS.keys() else False for nt in st.session_state['userInput']]):
27
  st.write('This is your sequence', st.session_state["userInput"])
28
  csv_data = run_with_input()
29
  else:
30
+ st.write('only ACTG is allowed')
31
+ st.download_button(label='Download as CVS File', data=csv_data)