Spaces:
Runtime error
Runtime error
Update app.py
Browse files23 unmodified lines242526272829250 unmodified lines2802812822832842852862872882892902912922932942952962971 unmodified line2993003013023033043057 unmodified lines31331431531631731823 unmodified linesget_base_coords_from_residue)# Page configurationst.set_page_config(page_title="RNA Motif Multi-Structure Comparison",250 unmodified lines# Sidebarst.sidebar.header("โ๏ธ Configuration")# Step 1: File uploadst.sidebar.subheader("1๏ธโฃ Upload Structures")uploaded_files = st.sidebar.file_uploader("Upload RNA Motif PDB files",type=['pdb', 'PDB'],accept_multiple_files=True,key="structures",help="Upload all RNA motif structures to compare")if not uploaded_files:st.info("๐ Please upload RNA motif PDB files to begin analysis")with st.expander("โน๏ธ About this tool"):st.markdown("""### Multi-Structure RNA Motif Comparison1 unmodified lineThis tool compares multiple RNA motif structures simultaneously using window-based alignment.**Workflow:**1. Upload all PDB structures2. Structures ranked by length (shortest first)3. Select residues for each structure via dropdown4. Choose reference structure (default: shortest)7 unmodified lines- Interactive 3D visualization with all structures- Color-coded structures- RMSD-based alignment quality""")return23 unmodified lines24252627282930313233343536250 unmodified lines2872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513521 unmodified line3543553563573583593607 unmodified lines36836937037137237337437537637737837923 unmodified linesget_base_coords_from_residue)# Import example data loaderfrom example_data_loader import (get_example_pdbs,load_example_as_uploaded_file,get_example_info)# Page configurationst.set_page_config(page_title="RNA Motif Multi-Structure Comparison",250 unmodified lines# Sidebarst.sidebar.header("โ๏ธ Configuration")# Step 1: File upload or Example datast.sidebar.subheader("1๏ธโฃ Load Structures")# Add tabs for Upload vs Examplesdata_source = st.sidebar.radio("Data Source",["Upload Files", "Use Examples"],key="data_source",help="Choose to upload your own files or use example data")uploaded_files = []if data_source == "Upload Files":uploaded_files_raw = st.sidebar.file_uploader("Upload RNA Motif PDB files",type=['pdb', 'PDB'],accept_multiple_files=True,key="structures",help="Upload all RNA motif structures to compare")if uploaded_files_raw:uploaded_files = list(uploaded_files_raw)else: # Use Examples# Check if data folder existsdata_folder = "data"examples = get_example_pdbs(data_folder)if not examples:st.sidebar.warning(f"โ ๏ธ No example files found in '{data_folder}/' folder")st.sidebar.info("๐ก Create a 'data/' folder and add .pdb files to use examples")else:st.sidebar.success(f"๐ Found {len(examples)} example files")# Show example info in expanderwith st.sidebar.expander("๐ View Example Files"):example_info = get_example_info(data_folder)for name, info in sorted(example_info.items()):if 'error' not in info:st.caption(f"**{name}**")st.caption(f" โ {info['atoms']} atoms")# Multiselect for examplesselected_names = st.sidebar.multiselect("Select example PDB files",options=sorted(examples.keys()),default=sorted(examples.keys())[:3] if len(examples) >= 3 else sorted(examples.keys()),help="Choose one or more example structures")if selected_names:# Convert example files to uploaded file formatfor name in selected_names:uploaded_files.append(load_example_as_uploaded_file(examples[name]))st.sidebar.success(f"โ Loaded {len(uploaded_files)} example file(s)")if not uploaded_files:st.info("๐ Please upload RNA motif PDB files or select examples to begin analysis")with st.expander("โน๏ธ About this tool"):st.markdown("""### Multi-Structure RNA Motif Comparison1 unmodified lineThis tool compares multiple RNA motif structures simultaneously using window-based alignment.**Workflow:**1. Upload PDB structures or use examples2. Structures ranked by length (shortest first)3. Select residues for each structure via dropdown4. Choose reference structure (default: shortest)7 unmodified lines- Interactive 3D visualization with all structures- Color-coded structures- RMSD-based alignment quality- Example data for testing**Using Examples:**- Create a folder named `data/` in your app directory- Add .pdb files to the data folder- Select "Use Examples" to load them""")return
app.py+71-10