Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -413,6 +413,35 @@ with tab5:
|
|
| 413 |
st.subheader("Decoded String (Ascending 3244→4882)")
|
| 414 |
st.write(decoded_asc)
|
| 415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 416 |
st.markdown("---")
|
| 417 |
|
| 418 |
# ========== 31-BIT DECODING ==========
|
|
|
|
| 413 |
st.subheader("Decoded String (Ascending 3244→4882)")
|
| 414 |
st.write(decoded_asc)
|
| 415 |
|
| 416 |
+
# === Robot Preparation Script from 32-bit Binary ===
|
| 417 |
+
st.subheader("Robot Preparation Script from 32-bit Binary")
|
| 418 |
+
robot_template_32 = pd.read_csv("/home/user/app/Robot.csv", skiprows=3)
|
| 419 |
+
robot_template_32.columns = ['Labware', 'Source', 'Labware_2', 'Destination', 'Volume', 'Tool', 'Name']
|
| 420 |
+
|
| 421 |
+
df_32_robot = df_32.copy()
|
| 422 |
+
df_32_robot.insert(0, 'Sample', range(1, len(df_32_robot)+1))
|
| 423 |
+
df_32_robot['# donors'] = df_32_robot.iloc[:, 1:].sum(axis=1)
|
| 424 |
+
df_32_robot['volume donors (µl)'] = 32 / df_32_robot['# donors']
|
| 425 |
+
|
| 426 |
+
robot_script_32 = []
|
| 427 |
+
source_wells_32 = robot_template_32['Source'].unique().tolist()
|
| 428 |
+
if len(source_wells_32) < df_32.shape[1]:
|
| 429 |
+
source_wells_32 += [f"Fake{i}" for i in range(df_32.shape[1] - len(source_wells_32))]
|
| 430 |
+
source_wells_32 = source_wells_32[:df_32.shape[1]]
|
| 431 |
+
|
| 432 |
+
for i, col in enumerate(df_32.columns):
|
| 433 |
+
for row_idx, sample in df_32_robot.iterrows():
|
| 434 |
+
if sample[col] == 1:
|
| 435 |
+
source = source_wells_32[i]
|
| 436 |
+
dest = f"A{sample['Sample']}"
|
| 437 |
+
vol = round(sample['volume donors (µl)'], 2)
|
| 438 |
+
robot_script_32.append({'Source': source, 'Destination': dest, 'Volume': vol})
|
| 439 |
+
|
| 440 |
+
robot_script_32_df = pd.DataFrame(robot_script_32)
|
| 441 |
+
st.dataframe(robot_script_32_df)
|
| 442 |
+
st.download_button("Download Robot Script (32-bit)", robot_script_32_df.to_csv(index=False), "robot_script_32bit.csv", key="download_robot_32")
|
| 443 |
+
|
| 444 |
+
|
| 445 |
st.markdown("---")
|
| 446 |
|
| 447 |
# ========== 31-BIT DECODING ==========
|