jiehou commited on
Commit
b060f9c
·
verified ·
1 Parent(s): 97def91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -21
app.py CHANGED
@@ -947,32 +947,54 @@ def main():
947
  )
948
 
949
  # Get the selected comparison
950
- selected_comparison = filtered_df.loc[selected_viz_idx]
951
 
952
  # Import visualization function
953
- from visualization_multi import create_pairwise_visualization
954
 
955
- # Create visualization
956
- try:
957
- viz_html = create_pairwise_visualization(
958
- ref_path=selected_comparison['Ref_Path'],
959
- query_path=selected_comparison['Query_Path'],
960
- ref_window=selected_comparison['Ref_Window'],
961
- query_window=selected_comparison['Query_Window'],
962
- rotation_matrix=selected_comparison['Rotation_Matrix'],
963
- ref_com=selected_comparison['Ref_COM'],
964
- query_com=selected_comparison['Query_COM'],
965
- rmsd=selected_comparison['RMSD'],
966
- ref_name=selected_comparison['Reference'],
967
- query_name=selected_comparison['Query']
968
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
969
 
970
- st.components.v1.html(viz_html, width=1400, height=750, scrolling=False)
 
 
 
 
 
971
 
972
- except Exception as e:
973
- st.error(f"Error creating visualization: {str(e)}")
974
- import traceback
975
- st.code(traceback.format_exc())
 
 
 
976
  else:
977
  st.warning("No comparisons below RMSD threshold to visualize")
978
 
 
947
  )
948
 
949
  # Get the selected comparison
950
+ selected_row = filtered_df.loc[selected_viz_idx]
951
 
952
  # Import visualization function
953
+ from visualization import create_structure_visualization
954
 
955
+ # Display RMSD info
956
+ st.info(f"**RMSD: {selected_row['RMSD']:.3f} Å** ({selected_row['Num_Residues']} residues) | Reference: {selected_row['Reference']}{selected_row['Ref_Residues']} ({selected_row['Ref_Sequence']}) | Query: {selected_row['Query']}{selected_row['Query_Residues']} ({selected_row['Query_Sequence']})")
957
+
958
+ # Create visualization - wider display
959
+ col1, col2, col3 = st.columns([0.5, 4, 0.5])
960
+
961
+ with col2:
962
+ try:
963
+ viz_html = create_structure_visualization(
964
+ selected_row['Ref_Path'],
965
+ selected_row['Query_Path'],
966
+ selected_row['Ref_Window'],
967
+ selected_row['Query_Window'],
968
+ selected_row['Rotation_Matrix'],
969
+ selected_row['Ref_COM'],
970
+ selected_row['Query_COM'],
971
+ selected_row['RMSD']
972
+ )
973
+ st.components.v1.html(viz_html, width=1400, height=750, scrolling=False)
974
+ except Exception as e:
975
+ st.error(f"Error creating visualization: {str(e)}")
976
+ import traceback
977
+ st.code(traceback.format_exc())
978
+
979
+
980
+ # Show transformation details
981
+ with st.expander("🔧 Transformation Details"):
982
+ col1, col2 = st.columns(2)
983
 
984
+ with col1:
985
+ st.markdown("**Rotation Matrix (U):**")
986
+ st.dataframe(
987
+ pd.DataFrame(selected_row['Rotation_Matrix']).round(4),
988
+ use_container_width=True
989
+ )
990
 
991
+ with col2:
992
+ st.markdown("**Translation Vectors:**")
993
+ st.write(f"Reference COM: [{selected_row['Ref_COM'][0]:.3f}, {selected_row['Ref_COM'][1]:.3f}, {selected_row['Ref_COM'][2]:.3f}]")
994
+ st.write(f"Query COM: [{selected_row['Query_COM'][0]:.3f}, {selected_row['Query_COM'][1]:.3f}, {selected_row['Query_COM'][2]:.3f}]")
995
+
996
+
997
+
998
  else:
999
  st.warning("No comparisons below RMSD threshold to visualize")
1000