Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Andrew Stirn
commited on
Commit
·
c2e1605
1
Parent(s):
e43faaa
very close
Browse files
app.py
CHANGED
|
@@ -34,6 +34,9 @@ def run():
|
|
| 34 |
# initialize transcript DataFrame
|
| 35 |
transcripts = pd.DataFrame(columns=[tiger.ID_COL, tiger.SEQ_COL])
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 37 |
# manual entry
|
| 38 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
| 39 |
transcripts = pd.DataFrame({
|
|
@@ -58,27 +61,24 @@ def run():
|
|
| 58 |
# convert to upper case as used by tokenizer
|
| 59 |
transcripts[tiger.SEQ_COL] = transcripts[tiger.SEQ_COL].apply(lambda s: s.upper())
|
| 60 |
|
| 61 |
-
#
|
| 62 |
-
|
| 63 |
-
if not all(valid):
|
| 64 |
with TRANSCRIPT_ENTRY:
|
| 65 |
st.write('Transcript(s) must only contain upper or lower case A, C, G, and Ts')
|
| 66 |
-
return
|
| 67 |
|
| 68 |
-
#
|
| 69 |
-
|
| 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 |
-
return
|
| 74 |
|
| 75 |
-
# run model
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
if __name__ == '__main__':
|
|
|
|
| 34 |
# initialize transcript DataFrame
|
| 35 |
transcripts = pd.DataFrame(columns=[tiger.ID_COL, tiger.SEQ_COL])
|
| 36 |
|
| 37 |
+
# initialize results
|
| 38 |
+
st.session_state.on_target = st.session_state.off_target = None
|
| 39 |
+
|
| 40 |
# manual entry
|
| 41 |
if st.session_state.entry_method == ENTRY_METHODS['manual']:
|
| 42 |
transcripts = pd.DataFrame({
|
|
|
|
| 61 |
# convert to upper case as used by tokenizer
|
| 62 |
transcripts[tiger.SEQ_COL] = transcripts[tiger.SEQ_COL].apply(lambda s: s.upper())
|
| 63 |
|
| 64 |
+
# check that all transcripts only contain nucleotides A, C, G, T, and wildcard N
|
| 65 |
+
if not all(transcripts[tiger.SEQ_COL].apply(lambda s: set(s).issubset(tiger.NUCLEOTIDE_TOKENS.keys()))):
|
|
|
|
| 66 |
with TRANSCRIPT_ENTRY:
|
| 67 |
st.write('Transcript(s) must only contain upper or lower case A, C, G, and Ts')
|
|
|
|
| 68 |
|
| 69 |
+
# check that all transcripts satisfy length requirements
|
| 70 |
+
elif any(transcripts[tiger.SEQ_COL].apply(lambda s: len(s) < tiger.TARGET_LEN)):
|
|
|
|
| 71 |
with TRANSCRIPT_ENTRY:
|
| 72 |
st.write('Transcript(s) must be at least {:d} bases.'.format(tiger.TARGET_LEN))
|
|
|
|
| 73 |
|
| 74 |
+
# run model if we have any transcripts
|
| 75 |
+
elif len(transcripts) > 0:
|
| 76 |
+
st.session_state.on_target, st.session_state.off_target = tiger.tiger_exhibit(
|
| 77 |
+
transcripts=transcripts,
|
| 78 |
+
mode={v: k for k, v in tiger.RUN_MODES.items()}[st.session_state.mode],
|
| 79 |
+
# status=RUNTIME,
|
| 80 |
+
check_off_targets=st.session_state.check_off_targets
|
| 81 |
+
)
|
| 82 |
|
| 83 |
|
| 84 |
if __name__ == '__main__':
|