Composite Example Script

From CCP4 wiki
Jump to navigation Jump to search

(define *reference-data-dir* (string-append (getenv "HOME")
                                            "/"
                                            "data/rnase"))

;; alternatively, we can do it in this directory
(define *reference-data-dir* ".")

(define pdb-1 (append-dir-file *reference-data-dir* "tutorial-modern.pdb"))
(define mtz-1 (append-dir-file *reference-data-dir* 
                               "rnasa-1.8-all_refmac1.mtz"))

(define loop-count-limit 5) ; how many loops shall we do?

(set-graphics-window-size 700 600)
(set-graphics-window-position 10 22)

(add-status-bar-text "Reading PDB file") 
(set-colour-map-rotation-on-read-pdb-c-only-flag 1)
(sleep 1)

(let loop ((loop-count 0))

  (if (< loop-count loop-count-limit)

      (let ((pdb-mol (read-pdb pdb-1)))
        (sleep 1)

        (rotate-y-scene 900 0.03)

        ;; void spin_zoom_trans(int axis, int nstep, float stepsize, 
        ;; float zoom_by, float x_rel, float y_rel, float z_rel);
        (add-status-bar-text "Zooming in...") 
        (spin-zoom-trans 2 500 0.2 0.4 18 -2 -3)

        (rotate-y-scene 2400 0.03)

; add electron density

        (add-status-bar-text "Making and Displaying Map...") 
        (set-density-size 12.00)
        (let ((map-mol (make-and-draw-map mtz-1
                                          "/RNASE3GMP/COMPLEX/FWT" 
                                          "/RNASE3GMP/COMPLEX/PHWT" "" 0 0)))

          (rotate-y-scene 300 0.06)
          (set-clipping-back  1)
          (set-clipping-front 1)
          (rotate-y-scene 300 0.06)
          (set-clipping-back  2)
          (set-clipping-front 2)
          (rotate-y-scene 300 0.06)
          (set-clipping-back  3)
          (set-clipping-front 3)
          (rotate-y-scene 300 0.06)
          (set-clipping-back  4)
          (set-clipping-front 4)
          (rotate-y-scene 300 0.06)
          (set-clipping-back  5)
          (set-clipping-front 5)
          (rotate-y-scene 600 0.06)

          ;; -7.1 4.4 -1.64 gets us to 89A CB
          (spin-zoom-trans 2 200 0.4 0.8 -7.1 4.4 -1.64)
          (rotate-z-scene  900 0.20)
          (rotate-y-scene 1500 0.08)

          (auto-fit-best-rotamer 89 "" "" "A" pdb-mol map-mol 0 1.0)
          (rotate-y-scene 1500 0.08)

          ;; now refine
          (set-refinement-immediate-replacement 1)
          (turn-off-backup pdb-mol)
          (refine-zone pdb-mol "A" 89 89 "")
          (accept-regularizement)
          (rotate-y-scene 1500 0.08)

          ;; let's change the contour level down a bit
          (change-contour-level 0)
          (change-contour-level 0)
          (change-contour-level 0)

          ;; lets go to the ligand site:
          ;; (52.27 11.08 8.37) is where we are
          ;; (55.13 10.69 19.82) is where we want to be
          ;;   2.9  -0.4  11.45
          (spin-zoom-trans 2 200 0.4 1.0 2.9 -0.4 11.45)

          ;; updates the map? Yes.
          (set-rotation-centre 55.13 10.69 19.82)

          (rotate-x-scene  500 0.08)
          (rotate-y-scene 1500 0.08)

          (let ((ligand-mol (get-monomer "3GP")))
            (turn-off-backup ligand-mol)
            (delete-residue-hydrogens ligand-mol "A" 1 "" "")
            (set-bond-thickness ligand-mol 5)
            (rotate-y-scene 900 0.1) ; orients the view so the base is side-on
            (set-dragged-refinement-steps-per-frame 1)
            (refine-zone ligand-mol "A" 1 1 "")
            (accept-regularizement)
            (rotate-y-scene  500 0.08)

            ;; mask the ligand site
            (mask-map-by-molecule map-mol ligand-mol 1)
            (let ((ligand-map-mol (+ ligand-mol 1)))
              (toggle-display-map map-mol 0)
              (rotate-y-scene 1000 0.08)
              (toggle-display-map map-mol 0) ; on
              (toggle-display-map ligand-map-mol 0) ; off

              ;; the sulphate site is at (70 19 18.6)
              ;; we are currently at (55.13 10.69 19.82)
              ;;                      -15 8.4 1.2
              (spin-zoom-trans 2 200 0.4 1.0 -15 8.4 1.2)
              (set-rotation-centre 70 19 18.6)
              (rotate-y-scene  500 0.08)
              (place-typed-atom-at-pointer "SO4") ; created molecule 3
              (let ((phosphate-1-mol (+ ligand-mol 1)))
                (set-bond-thickness phosphate-1-mol 5)
                (rotate-y-scene 1500 0.08)
                (refine-zone phosphate-1-mol "" 1 1 "")
                (accept-regularizement)
                (rotate-y-scene 1500 0.08)

                ;; terminal loop centre 59.5 2.2 -5.2
                (spin-zoom-trans 2 200 0.6 1.0 -10 -17 -23)
                ;; update the density
                (apply set-rotation-centre (rotation-centre))
                (rotate-y-scene 2100 0.08)

                ;; fit loop
                (fit-gap pdb-mol "A" 94 96 "QTC")
                (rotate-y-scene 2100 0.08)

                ;; turn off density
                (toggle-display-map map-mol 0)

                ;; zoom out
                (spin-zoom-trans 2 200 0.6 3.0 0 0 0)

                ;; add waters
                (add-status-bar-text "Adding waters") 
                (execute-find-waters-real map-mol pdb-mol 0 1.0) ; gives dialog
                (rotate-y-scene 2100 0.08)

                ;; turn on density
                (toggle-display-map map-mol 0)
                ;;               we are at 59.5 2.2 -5.2
                ;; Zoom in on a water: at (35.45 11.2 12.5)
                (spin-zoom-trans 2 200 0.6 0.3 -24 9 17.3)

                (apply set-rotation-centre (rotation-centre))
                (rotate-y-scene 2100 0.08)

                ;; skeletonization, unit cell?

                ;; zoom out so that we leave in about the same 
                ;; zoom that we started with
                (spin-zoom-trans 2 100 0.6 3 0 0 0)

                (close-molecule pdb-mol)
                (close-molecule map-mol)
                (close-molecule ligand-mol)
                (close-molecule phosphate-1-mol)

                (loop (+ loop-count 1))

                )))))))