hemantn commited on
Commit
bf5aaae
·
1 Parent(s): 27491d1

Fix: Require chain selection for structure preparation (no default to all chains)

Browse files
amberprep/js/script.js CHANGED
@@ -2835,6 +2835,13 @@ echo "Analysis completed! Results saved in analysis/ directory"
2835
  return;
2836
  }
2837
 
 
 
 
 
 
 
 
2838
  // Get preparation options
2839
  const options = {
2840
  remove_water: document.getElementById('remove-water').checked,
@@ -2844,7 +2851,7 @@ echo "Analysis completed! Results saved in analysis/ directory"
2844
  add_ace: document.getElementById('add-ace').checked,
2845
  preserve_ligands: document.getElementById('preserve-ligands').checked,
2846
  separate_ligands: document.getElementById('separate-ligands').checked,
2847
- selected_chains: this.getSelectedChains(),
2848
  selected_ligands: this.getSelectedLigands()
2849
  };
2850
 
 
2835
  return;
2836
  }
2837
 
2838
+ // Get selected chains first and validate
2839
+ const selectedChains = this.getSelectedChains();
2840
+ if (!selectedChains || selectedChains.length === 0) {
2841
+ alert('Please select at least one chain for structure preparation.');
2842
+ return;
2843
+ }
2844
+
2845
  // Get preparation options
2846
  const options = {
2847
  remove_water: document.getElementById('remove-water').checked,
 
2851
  add_ace: document.getElementById('add-ace').checked,
2852
  preserve_ligands: document.getElementById('preserve-ligands').checked,
2853
  separate_ligands: document.getElementById('separate-ligands').checked,
2854
+ selected_chains: selectedChains,
2855
  selected_ligands: this.getSelectedLigands()
2856
  };
2857
 
amberprep/structure_preparation.py CHANGED
@@ -735,8 +735,8 @@ def prepare_structure(pdb_content, options, output_dir="output"):
735
  if not extract_selected_chains(pdb_content, user_chain_file, selected_chains):
736
  raise Exception("Failed to extract selected chains")
737
  else:
738
- print("Step 0.5a: No chains selected, using original structure")
739
- shutil.copy2(input_file, user_chain_file)
740
 
741
  if selected_ligands:
742
  ligand_names = []
 
735
  if not extract_selected_chains(pdb_content, user_chain_file, selected_chains):
736
  raise Exception("Failed to extract selected chains")
737
  else:
738
+ # No chains selected - raise an error instead of using all chains
739
+ raise Exception("No chains selected. Please select at least one chain for structure preparation.")
740
 
741
  if selected_ligands:
742
  ligand_names = []