Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -392,7 +392,7 @@ with tab4:
|
|
392 |
st.write(decoded_string)
|
393 |
|
394 |
# Tab 5: Binary β String
|
395 |
-
with tab5:
|
396 |
st.header("Decode Binary Labels to String")
|
397 |
|
398 |
# ========== 32-BIT DECODING ==========
|
@@ -410,7 +410,7 @@ with tab5:
|
|
410 |
st.dataframe(reordered_df_32.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
411 |
st.download_button("Download Reordered CSV", reordered_df_32.to_csv(index=False), "decoded_binary_32_reordered.csv", key="download_csv_tab5_32_reordered")
|
412 |
|
413 |
-
|
414 |
st.subheader("Decoded String (Reordered 4402β3244, 4882β4455)")
|
415 |
st.write(decoded_reordered)
|
416 |
|
@@ -440,15 +440,12 @@ with tab5:
|
|
440 |
st.subheader("Binary Labels (Reordered 4402β3244, 4882β4455)")
|
441 |
st.dataframe(reordered_df_31.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
442 |
st.download_button("Download Reordered CSV", reordered_df_31.to_csv(index=False), "decoded_binary_31_reordered.csv", key="download_csv_tab5_31_reordered")
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
st.subheader("Decoded String from 31-bit Groups (Reordered 4402β3244, 4882β4455)")
|
450 |
-
st.write(full_decoded_reordered)
|
451 |
-
st.download_button("Download Concatenated Output", full_decoded_reordered, "decoded_31bit_string_reordered.txt", key="download_csv_tab5_31")
|
452 |
|
453 |
# Ascending: 3244 β 4882
|
454 |
df_31_asc = df_31[[str(h) for h in mutation_site_headers_actual if str(h) in df_31.columns]]
|
@@ -456,12 +453,9 @@ with tab5:
|
|
456 |
st.dataframe(df_31_asc.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
457 |
st.download_button("Download Ascending CSV", df_31_asc.to_csv(index=False), "decoded_binary_31_ascending.csv", key="download_csv_tab5_31_ascend")
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
st.subheader("Decoded String from 31-bit Groups (Ascending 3244β4882)")
|
465 |
-
st.write(full_decoded_asc)
|
466 |
-
st.download_button("Download Concatenated Output", full_decoded_asc, "decoded_31bit_string_ascending.txt", key="download_csv_tab5_31_asc")
|
467 |
|
|
|
392 |
st.write(decoded_string)
|
393 |
|
394 |
# Tab 5: Binary β String
|
395 |
+
with tab5:
|
396 |
st.header("Decode Binary Labels to String")
|
397 |
|
398 |
# ========== 32-BIT DECODING ==========
|
|
|
410 |
st.dataframe(reordered_df_32.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
411 |
st.download_button("Download Reordered CSV", reordered_df_32.to_csv(index=False), "decoded_binary_32_reordered.csv", key="download_csv_tab5_32_reordered")
|
412 |
|
413 |
+
decoded_reordered = binary_labels_to_string(reordered_df_32.values.flatten().astype(int).tolist())
|
414 |
st.subheader("Decoded String (Reordered 4402β3244, 4882β4455)")
|
415 |
st.write(decoded_reordered)
|
416 |
|
|
|
440 |
st.subheader("Binary Labels (Reordered 4402β3244, 4882β4455)")
|
441 |
st.dataframe(reordered_df_31.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
442 |
st.download_button("Download Reordered CSV", reordered_df_31.to_csv(index=False), "decoded_binary_31_reordered.csv", key="download_csv_tab5_31_reordered")
|
443 |
+
|
444 |
+
# Flattened decoding for reordered
|
445 |
+
decoded_flat_reordered = binary_labels_to_string(reordered_df_31.values.flatten().astype(int).tolist())
|
446 |
+
st.subheader("Decoded String (Flattened 31-bit Reordered)")
|
447 |
+
st.write(decoded_flat_reordered)
|
448 |
+
st.download_button("Download Concatenated Output", decoded_flat_reordered, "decoded_31bit_string_reordered.txt", key="download_csv_tab5_31")
|
|
|
|
|
|
|
449 |
|
450 |
# Ascending: 3244 β 4882
|
451 |
df_31_asc = df_31[[str(h) for h in mutation_site_headers_actual if str(h) in df_31.columns]]
|
|
|
453 |
st.dataframe(df_31_asc.style.applymap(lambda v: "background-color: lightgreen" if v == 1 else "background-color: lightcoral"))
|
454 |
st.download_button("Download Ascending CSV", df_31_asc.to_csv(index=False), "decoded_binary_31_ascending.csv", key="download_csv_tab5_31_ascend")
|
455 |
|
456 |
+
# Flattened decoding for ascending
|
457 |
+
decoded_flat_asc = binary_labels_to_string(df_31_asc.values.flatten().astype(int).tolist())
|
458 |
+
st.subheader("Decoded String (Flattened 31-bit Ascending)")
|
459 |
+
st.write(decoded_flat_asc)
|
460 |
+
st.download_button("Download Concatenated Output", decoded_flat_asc, "decoded_31bit_string_ascending.txt", key="download_csv_tab5_31_asc")
|
|
|
|
|
|
|
461 |
|