Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -400,7 +400,7 @@ with tab5:
|
|
| 400 |
|
| 401 |
if binary32_file:
|
| 402 |
df_32 = pd.read_csv(binary32_file, header=None)
|
| 403 |
-
df_32.columns = [str(h) for h in mutation_site_headers_actual_3614]
|
| 404 |
else:
|
| 405 |
df_32 = st.data_editor(
|
| 406 |
pd.DataFrame(columns=[str(h) for h in mutation_site_headers_actual_3614]),
|
|
@@ -417,25 +417,27 @@ with tab5:
|
|
| 417 |
decoded_reordered = binary_labels_to_string(reordered_df_32.values.flatten().astype(int).tolist())
|
| 418 |
st.subheader("Decoded String (Reordered 4402→3244, 4882→4455)")
|
| 419 |
st.write(decoded_reordered)
|
|
|
|
| 420 |
|
| 421 |
-
|
| 422 |
st.subheader("Binary Labels (Ascending 3244→4882)")
|
| 423 |
-
st.dataframe(
|
| 424 |
-
st.download_button("Download Ascending CSV",
|
| 425 |
|
| 426 |
-
decoded_asc = binary_labels_to_string(
|
| 427 |
-
st.subheader("Decoded String (Ascending
|
| 428 |
st.write(decoded_asc)
|
|
|
|
| 429 |
|
| 430 |
# === Robot Preparation Script from 32-bit Binary ===
|
| 431 |
st.subheader("Robot Preparation Script from 32-bit Binary")
|
| 432 |
-
robot_template_32 = pd.read_csv("/home/user/app/
|
| 433 |
robot_template_32.columns = ['Labware', 'Source', 'Labware_2', 'Destination', 'Volume', 'Tool', 'Name']
|
| 434 |
|
| 435 |
df_32_robot = df_32.copy()
|
| 436 |
df_32_robot.insert(0, 'Sample', range(1, len(df_32_robot)+1))
|
| 437 |
df_32_robot['# donors'] = df_32_robot.iloc[:, 1:].astype(int).sum(axis=1)
|
| 438 |
-
df_32_robot['volume donors (µl)'] =
|
| 439 |
|
| 440 |
robot_script_32 = []
|
| 441 |
source_wells_32 = robot_template_32['Source'].unique().tolist()
|
|
|
|
| 400 |
|
| 401 |
if binary32_file:
|
| 402 |
df_32 = pd.read_csv(binary32_file, header=None)
|
| 403 |
+
df_32.columns = [str(h) for h in mutation_site_headers_actual_3614]
|
| 404 |
else:
|
| 405 |
df_32 = st.data_editor(
|
| 406 |
pd.DataFrame(columns=[str(h) for h in mutation_site_headers_actual_3614]),
|
|
|
|
| 417 |
decoded_reordered = binary_labels_to_string(reordered_df_32.values.flatten().astype(int).tolist())
|
| 418 |
st.subheader("Decoded String (Reordered 4402→3244, 4882→4455)")
|
| 419 |
st.write(decoded_reordered)
|
| 420 |
+
st.download_button("Download Concatenated Output", decoded_reordered, "decoded_32bit_string_reordered.txt", key="download_txt_tab5_32")
|
| 421 |
|
| 422 |
+
df_32_asc = df_32[[str(h) for h in mutation_site_headers_actual_3614 if str(h) in df_32.columns]]
|
| 423 |
st.subheader("Binary Labels (Ascending 3244→4882)")
|
| 424 |
+
st.dataframe(df_32_asc.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
| 425 |
+
st.download_button("Download Ascending CSV", df_32_asc.to_csv(index=False), "decoded_binary_32_ascending.csv", key="download_csv_tab5_32_ascend")
|
| 426 |
|
| 427 |
+
decoded_asc = binary_labels_to_string(df_32_asc.values.flatten().astype(int).tolist())
|
| 428 |
+
st.subheader("Decoded String (Flattened 32-bit Ascending)")
|
| 429 |
st.write(decoded_asc)
|
| 430 |
+
st.download_button("Download Concatenated Output", decoded_asc, "decoded_32bit_string_ascending.txt", key="download_txt_tab5_32_asc")
|
| 431 |
|
| 432 |
# === Robot Preparation Script from 32-bit Binary ===
|
| 433 |
st.subheader("Robot Preparation Script from 32-bit Binary")
|
| 434 |
+
robot_template_32 = pd.read_csv("/home/user/app/Robot2.csv", skiprows=3)
|
| 435 |
robot_template_32.columns = ['Labware', 'Source', 'Labware_2', 'Destination', 'Volume', 'Tool', 'Name']
|
| 436 |
|
| 437 |
df_32_robot = df_32.copy()
|
| 438 |
df_32_robot.insert(0, 'Sample', range(1, len(df_32_robot)+1))
|
| 439 |
df_32_robot['# donors'] = df_32_robot.iloc[:, 1:].astype(int).sum(axis=1)
|
| 440 |
+
df_32_robot['volume donors (µl)'] = 64 / df_32_robot['# donors']
|
| 441 |
|
| 442 |
robot_script_32 = []
|
| 443 |
source_wells_32 = robot_template_32['Source'].unique().tolist()
|