Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -475,5 +475,33 @@ with tab5:
|
|
| 475 |
decoded_flat_asc = binary_labels_to_string(df_31_asc.values.flatten().astype(int).tolist())
|
| 476 |
st.subheader("Decoded String (Flattened 31-bit Ascending)")
|
| 477 |
st.write(decoded_flat_asc)
|
| 478 |
-
st.download_button("Download Concatenated Output", decoded_flat_asc, "decoded_31bit_string_ascending.txt", key="download_csv_tab5_31_asc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
|
|
|
|
| 475 |
decoded_flat_asc = binary_labels_to_string(df_31_asc.values.flatten().astype(int).tolist())
|
| 476 |
st.subheader("Decoded String (Flattened 31-bit Ascending)")
|
| 477 |
st.write(decoded_flat_asc)
|
| 478 |
+
st.download_button("Download Concatenated Output", decoded_flat_asc, "decoded_31bit_string_ascending.txt", key="download_csv_tab5_31_asc
|
| 479 |
+
|
| 480 |
+
# === Robot Preparation Script from 31-bit Binary ===
|
| 481 |
+
st.subheader("Robot Preparation Script from 31-bit Binary")
|
| 482 |
+
robot_template_31 = pd.read_csv("/home/user/app/Robot.csv", skiprows=3)
|
| 483 |
+
robot_template_31.columns = ['Labware', 'Source', 'Labware_2', 'Destination', 'Volume', 'Tool', 'Name']
|
| 484 |
+
|
| 485 |
+
df_31_robot = df_31.copy()
|
| 486 |
+
df_31_robot.insert(0, 'Sample', range(1, len(df_31_robot)+1))
|
| 487 |
+
df_31_robot['# donors'] = df_31_robot.iloc[:, 1:].sum(axis=1)
|
| 488 |
+
df_31_robot['volume donors (µl)'] = 32 / df_31_robot['# donors']
|
| 489 |
+
|
| 490 |
+
robot_script_31 = []
|
| 491 |
+
source_wells_31 = robot_template_31['Source'].unique().tolist()
|
| 492 |
+
if len(source_wells_31) < df_31.shape[1]:
|
| 493 |
+
source_wells_31 += [f"Fake{i}" for i in range(df_31.shape[1] - len(source_wells_31))]
|
| 494 |
+
source_wells_31 = source_wells_31[:df_31.shape[1]]
|
| 495 |
+
|
| 496 |
+
for i, col in enumerate(df_31.columns):
|
| 497 |
+
for row_idx, sample in df_31_robot.iterrows():
|
| 498 |
+
if sample[col] == 1:
|
| 499 |
+
source = source_wells_31[i]
|
| 500 |
+
dest = f"A{sample['Sample']}"
|
| 501 |
+
vol = round(sample['volume donors (µl)'], 2)
|
| 502 |
+
robot_script_31.append({'Source': source, 'Destination': dest, 'Volume': vol})
|
| 503 |
+
|
| 504 |
+
robot_script_31_df = pd.DataFrame(robot_script_31)
|
| 505 |
+
st.dataframe(robot_script_31_df)
|
| 506 |
+
st.download_button("Download Robot Script (31-bit)", robot_script_31_df.to_csv(index=False), "robot_script_31bit.csv", key="download_robot_31")
|
| 507 |
|