Chop-side-chains-gui.scm

From CCP4 wiki

;; Delete (back to the CB stub) the side change in the range
;; resno-start to resno-end
;; This overrides the standard function 
(define delete-sidechain-range
   (lambda (imol chain-id resno-start resno-end)
     
    (map (lambda (resno)
	   (delete-residue-sidechain imol chain-id resno "" 0))
         (number-list resno-start resno-end))))


;; Now back to the GUI code:
;; 
(let ((menu (coot-menubar-menu "Extensions")))
  
  (add-simple-coot-menu-menuitem
   menu "Trim back sidechains..."
   (lambda ()
     
     (generic-chooser-and-entry
      "Choose a molecule to have its sidechains chopped"
      "Chain ID: " "" 
      (lambda (imol chain-id) 
	(generic-double-entry "Starting Resno"
			      "End Resno"
			      "" "" #f #f "  Chop  Sidechains  "
			      (lambda (text-1 text-2 dummy)
				(let ((resno-1 (string->number text-1))
				      (resno-2 (string->number text-2)))
				  (if (and (number? resno-1)
					   (number? resno-2))
				      (delete-sidechain-range imol chain-id resno-1 resno-2))))))))))