File size: 1,480 Bytes
89be9f9
4e66e6b
89be9f9
 
f606ed7
 
 
 
 
cf3bd3a
 
 
77e4f1f
592b51c
 
2bc5b93
592b51c
cf3bd3a
78951dd
a1b3810
610b0ca
a1b3810
78951dd
 
77e4f1f
d41b7db
 
 
350befe
 
 
 
 
78951dd
 
89be9f9
78951dd
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
import streamlit as st
from tiger import tiger_exhibit, TARGET_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(
    label='Enter a target transcript:',
    # value='ATGCAGGACGCGGAGAACGTGGCGGTGCCCGAGGCGGCCGAGGAGCGCGC',
    placeholder='Upper or lower case')

# input is too short
if len(st.session_state['userInput']) < TARGET_LEN:
    transcript_len = len(st.session_state['userInput'])
    st.write('Transcript length ({:d}) must be at least {:d} bases.'.format(transcript_len, TARGET_LEN))

# valid input
elif all([True if nt.upper() in NUCLEOTIDE_TOKENS.keys() else False for nt in st.session_state['userInput']]):
    on_target, off_target = tiger_exhibit(st.session_state['userInput'])
    st.write('On-target predictions: ', on_target)
    st.download_button(label='Download', data=convert_df(on_target), file_name='on_target.csv', mime='text/csv')
    if len(off_target) > 0:
        st.write('Off-target predictions: ', off_target)
        st.download_button(label='Download', data=convert_df(off_target), file_name='off_target.csv', mime='text/csv')
    else:
        st.write('We did not find any off-target effects!')

# invalid input
else:
    st.write('Nucleotides other than ACGT detected!')