tiger / app.py
Andrew Stirn
cleanup
cb8c873
raw
history blame
1.09 kB
import streamlit as st
from run import tiger_predict, GUIDE_LEN, NUCLEOTIDE_TOKENS
@st.cache
def convert_df(df):
# IMPORTANT: Cache the conversion to prevent computation on every rerun
return df.to_csv().encode('utf-8')
# title and instructions
st.title('TIGER Cas13 Efficacy Prediction')
st.session_state['userInput'] = ''
st.session_state['userInput'] = st.text_input('Enter target transcript (or substring):')
if len(st.session_state['userInput']) < GUIDE_LEN:
st.write('Transcript length must be >= 23 bases. It is {:d} chars'.format(len(st.session_state['userInput'])))
st.write("")
elif all([True if nt.upper() in NUCLEOTIDE_TOKENS.keys() else False for nt in st.session_state['userInput']]):
st.write('This is your sequence', st.session_state['userInput'])
predictions = tiger_predict(st.session_state['userInput'])
st.write('Model predictions: ', predictions)
csv = convert_df(predictions)
st.download_button(label='Download CSV file', data=csv, file_name='tiger_predictions.csv', mime='text/csv')
else:
st.write('only ACTG is allowed')