Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Andrew Stirn
commited on
Commit
•
1574649
1
Parent(s):
0178c63
progress
Browse files
app.py
CHANGED
@@ -40,16 +40,14 @@ def entry_method_change_callback():
|
|
40 |
def process_input():
|
41 |
|
42 |
# initialize transcript DataFrame
|
43 |
-
st.session_state.transcripts = pd.DataFrame()
|
44 |
|
45 |
# manual entry
|
46 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
else:
|
52 |
-
st.session_state.transcripts = pd.DataFrame({tiger.ID_COL: ['ManualEntry'], tiger.SEQ_COL: [sequence]})
|
53 |
|
54 |
# fasta file upload
|
55 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
@@ -64,15 +62,23 @@ def process_input():
|
|
64 |
else:
|
65 |
st.session_state.transcripts = df
|
66 |
|
67 |
-
# convert
|
68 |
st.session_state.transcripts[tiger.SEQ_COL] = st.session_state.transcripts[tiger.SEQ_COL].apply(lambda s: s.upper())
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# if src_seq and all([True if nt.upper() in NUCLEOTIDE_TOKENS.keys() else False for nt in src_seq]):
|
72 |
# elif src_seq is not None:
|
73 |
# st.write('Invalid input!')
|
74 |
print(st.session_state.transcripts)
|
75 |
|
|
|
|
|
|
|
76 |
|
77 |
if __name__ == '__main__':
|
78 |
|
|
|
40 |
def process_input():
|
41 |
|
42 |
# initialize transcript DataFrame
|
43 |
+
st.session_state.transcripts = pd.DataFrame(columns=[tiger.ID_COL, tiger.SEQ_COL])
|
44 |
|
45 |
# manual entry
|
46 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
47 |
+
st.session_state.transcripts = pd.DataFrame({
|
48 |
+
tiger.ID_COL: ['ManualEntry'],
|
49 |
+
tiger.SEQ_COL: [st.session_state.manual_entry]
|
50 |
+
})
|
|
|
|
|
51 |
|
52 |
# fasta file upload
|
53 |
elif st.session_state.entry_method == ENTRY_METHODS['fasta']:
|
|
|
62 |
else:
|
63 |
st.session_state.transcripts = df
|
64 |
|
65 |
+
# convert to upper case as used by tokenizer
|
66 |
st.session_state.transcripts[tiger.SEQ_COL] = st.session_state.transcripts[tiger.SEQ_COL].apply(lambda s: s.upper())
|
67 |
|
68 |
+
# make sure all transcripts satisfy length requirements
|
69 |
+
too_short = st.session_state.transcripts[tiger.SEQ_COL].apply(lambda s: len(s)) < tiger.TARGET_LEN
|
70 |
+
if any(too_short):
|
71 |
+
with TRANSCRIPT_ENTRY:
|
72 |
+
st.write('Transcript(s) must be at least {:d} bases.'.format(tiger.TARGET_LEN))
|
73 |
|
74 |
# if src_seq and all([True if nt.upper() in NUCLEOTIDE_TOKENS.keys() else False for nt in src_seq]):
|
75 |
# elif src_seq is not None:
|
76 |
# st.write('Invalid input!')
|
77 |
print(st.session_state.transcripts)
|
78 |
|
79 |
+
# everything looks good to run the model
|
80 |
+
st.session_state.run = True
|
81 |
+
|
82 |
|
83 |
if __name__ == '__main__':
|
84 |
|