wenjun99 commited on
Commit
e36ad7a
·
verified ·
1 Parent(s): a1a3469

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -5
app.py CHANGED
@@ -1,8 +1,6 @@
1
  import streamlit as st
2
- from PIL import Image, ImageFilter
3
  import numpy as np
4
  import pandas as pd
5
- from streamlit_cropper import st_cropper
6
 
7
  # Mutation site headers removed 3614,
8
  mutation_site_headers_actual = [
@@ -80,8 +78,8 @@ with tab1:
80
  ascii_codes = [reverse_voyager_table.get(c.upper(), 0) for c in user_input]
81
  binary_labels = string_to_binary_labels(user_input)
82
 
83
- st.subheader("Voyager ASCII Codes")
84
- st.write(ascii_codes)
85
 
86
  st.subheader("Binary Labels per Character")
87
  grouped = [binary_labels[i:i+6] for i in range(0, len(binary_labels), 6)]
@@ -107,7 +105,6 @@ with tab1:
107
  idx = df_sorted.columns.get_loc("3562") + 1 # Insert after 3562
108
  df_sorted.insert(idx, "3614", 0)
109
 
110
- st.write(df_sorted.head(1))
111
  st.subheader("Binary Labels (Ascending Order 3244 → 4882)")
112
  st.dataframe(df_sorted)
113
  st.download_button("Download Ascending Order CSV", df_sorted.to_csv(index=False), "text_binary_labels_ascending.csv", key="download_csv_tab1_ascend")
@@ -149,6 +146,29 @@ with tab1:
149
  st.dataframe(robot_script_df)
150
  st.download_button("Download Robot Script CSV", robot_script_df.to_csv(index=False), "robot_script.csv", key="download_csv_tab1_robot")
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  # Tab 2: EF → Binary
154
  with tab2:
 
1
  import streamlit as st
 
2
  import numpy as np
3
  import pandas as pd
 
4
 
5
  # Mutation site headers removed 3614,
6
  mutation_site_headers_actual = [
 
78
  ascii_codes = [reverse_voyager_table.get(c.upper(), 0) for c in user_input]
79
  binary_labels = string_to_binary_labels(user_input)
80
 
81
+ # st.subheader("Voyager ASCII Codes")
82
+ # st.write(ascii_codes)
83
 
84
  st.subheader("Binary Labels per Character")
85
  grouped = [binary_labels[i:i+6] for i in range(0, len(binary_labels), 6)]
 
105
  idx = df_sorted.columns.get_loc("3562") + 1 # Insert after 3562
106
  df_sorted.insert(idx, "3614", 0)
107
 
 
108
  st.subheader("Binary Labels (Ascending Order 3244 → 4882)")
109
  st.dataframe(df_sorted)
110
  st.download_button("Download Ascending Order CSV", df_sorted.to_csv(index=False), "text_binary_labels_ascending.csv", key="download_csv_tab1_ascend")
 
146
  st.dataframe(robot_script_df)
147
  st.download_button("Download Robot Script CSV", robot_script_df.to_csv(index=False), "robot_script.csv", key="download_csv_tab1_robot")
148
 
149
+ # === Robot Preparation Script (Based on Ascending Order 3244 → 4882) ===
150
+ st.subheader("Robot Preparation Script (Based on Ascending Order 3244 → 4882)")
151
+
152
+ df_sorted_ascend = df_sorted.copy()
153
+ df_sorted_ascend.insert(0, 'Sample', range(1, len(df_sorted_ascend)+1))
154
+
155
+ df_sorted_ascend['# donors'] = df_sorted_ascend.iloc[:, 1:].sum(axis=1)
156
+ df_sorted_ascend['volume donors (µl)'] = 32 / df_sorted_ascend['# donors']
157
+
158
+ robot_script_ascend = []
159
+ # Use the same source wells (length should be 32 already)
160
+ for i, col in enumerate(df_sorted_ascend.columns[1:33]): # 32 binary columns
161
+ for row_idx, sample in df_sorted_ascend.iterrows():
162
+ if sample[col] == 1:
163
+ source = source_wells[i]
164
+ dest = f"A{sample['Sample']}"
165
+ vol = round(sample['volume donors (µl)'], 2)
166
+ robot_script_ascend.append({'Source': source, 'Destination': dest, 'Volume': vol})
167
+
168
+ robot_script_ascend_df = pd.DataFrame(robot_script_ascend)
169
+ st.dataframe(robot_script_ascend_df)
170
+ st.download_button("Download Ascending Robot Script CSV", robot_script_ascend_df.to_csv(index=False), "robot_script_ascending.csv", key="download_csv_tab1_robot_ascend")
171
+
172
 
173
  # Tab 2: EF → Binary
174
  with tab2: