Spaces:
Runtime error
Runtime error
Update app.py
Browse files946 unmodified lines947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978946 unmodified lines)# Get the selected comparisonselected_comparison = filtered_df.loc[selected_viz_idx]# Import visualization functionfrom visualization_multi import create_pairwise_visualization# Create visualizationtry:viz_html = create_pairwise_visualization(ref_path=selected_comparison['Ref_Path'],query_path=selected_comparison['Query_Path'],ref_window=selected_comparison['Ref_Window'],query_window=selected_comparison['Query_Window'],rotation_matrix=selected_comparison['Rotation_Matrix'],ref_com=selected_comparison['Ref_COM'],query_com=selected_comparison['Query_COM'],rmsd=selected_comparison['RMSD'],ref_name=selected_comparison['Reference'],query_name=selected_comparison['Query'])st.components.v1.html(viz_html, width=1400, height=750, scrolling=False)except Exception as e:st.error(f"Error creating visualization: {str(e)}")import tracebackst.code(traceback.format_exc())else:st.warning("No comparisons below RMSD threshold to visualize")946 unmodified lines9479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000946 unmodified lines)# Get the selected comparisonselected_row = filtered_df.loc[selected_viz_idx]# Import visualization functionfrom visualization import create_structure_visualization# Display RMSD infost.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']})")# Create visualization - wider displaycol1, col2, col3 = st.columns([0.5, 4, 0.5])with col2:try:viz_html = create_structure_visualization(selected_row['Ref_Path'],selected_row['Query_Path'],selected_row['Ref_Window'],selected_row['Query_Window'],selected_row['Rotation_Matrix'],selected_row['Ref_COM'],selected_row['Query_COM'],selected_row['RMSD'])st.components.v1.html(viz_html, width=1400, height=750, scrolling=False)except Exception as e:st.error(f"Error creating visualization: {str(e)}")import tracebackst.code(traceback.format_exc())# Show transformation detailswith st.expander("🔧 Transformation Details"):col1, col2 = st.columns(2)with col1:st.markdown("**Rotation Matrix (U):**")st.dataframe(pd.DataFrame(selected_row['Rotation_Matrix']).round(4),use_container_width=True)with col2:st.markdown("**Translation Vectors:**")st.write(f"Reference COM: [{selected_row['Ref_COM'][0]:.3f}, {selected_row['Ref_COM'][1]:.3f}, {selected_row['Ref_COM'][2]:.3f}]")st.write(f"Query COM: [{selected_row['Query_COM'][0]:.3f}, {selected_row['Query_COM'][1]:.3f}, {selected_row['Query_COM'][2]:.3f}]")else:st.warning("No comparisons below RMSD threshold to visualize")
app.py+43-21