2009/6/5 hari jayaram <hari...@gmail.com>:
> Hi I have a very low resolution map in which I can barely see side chains .
> I want to set to zero occupancy many residues and residue side-chains before
> I do a refinement.
>
> Currently I am using the Residue-Info menu item to set each occupancy to
> zero residue by residue . And in cases where part of the residue is seen ,
> atom-by-atom inside this menu entry.
>
> Is there a mode where I can keep the mouse active and clicking an atom will
> set the occupancy to zero - and I can embark on a clickfest setting atoms to
> zero occupancy.
>


Hi,

seeing that no-one picked this up... here's a couple of suggestions.

1. I don't think there's a mechanism to set occupancies to zero with
continuous clicks. (It would be a useful addition to the delete items
window though.) We can, however, bind such a function to a key. Below
an example of binding it to the key "z" (for zero). So you just hit z
and then click on an atom to be zeroed.

2. My suggestion would be to simply set the occupancy of the whole
sidechain to zero by hitting a key. Below a snippet that does that,
again bound to "z". In this case you hit z and the occupancy of the
active residue's (the one that's closest to the rotation centre)
sidechain will be set to zero.

3. The most common scenario for me seems to be when I want to trim a
sidechain in a way that only atoms sticking out of the density (at a
given sigma level) are deleted or given zero occupancies. The third
example is an attempt to do that with active residues, such that the
connectivity of the sidechain atoms is preserved (as opposed to the
function trim-molecule-by-map). You might need to tweak the sigma
cutoff, see comments below.

4. As for setting occupancies of zones:
http://www.ysbl.york.ac.uk/~emsley/coot/doc/user-manual.html#SEC147

HTH,
JED.



---
;;; Example 1: set occupancy to zero by click.
(define (set-occ-zero-by-click)
  (user-defined-click 1  (lambda (atom-info)
   (let ((imol      (list-ref (car atom-info) 0))
         (chain-id  (list-ref (car atom-info) 1))
         (res-no    (list-ref (car atom-info) 2))
         (ins-code  (list-ref (car atom-info) 3))
         (atom-name (list-ref (car atom-info) 4))
         (alt-conf  (list-ref (car atom-info) 5)))
    (set-atom-attribute
      imol chain-id res-no ins-code atom-name alt-conf "occ" 0.0)
    (if (residue-info-dialog-displayed?)
        (residue-info-dialog imol chain-id res-no ins-code))))))

(add-key-binding "Set clicked atom occupancy to zero" "z"
set-occ-zero-by-click )

---
;;; Example 2: set side chain occ to zero for active residue
;; might do nasty things to non-standard residues.
(define (set-zero-occ-sidechain)
  (let ((atom-info (active-residue)))
    (if atom-info
        (let* ((imol      (list-ref atom-info 0))
               (chain-id  (list-ref atom-info 1))
               (res-no    (list-ref atom-info 2))
               (ins-code  (list-ref atom-info 3))
               (atom-list (residue-info imol chain-id res-no ins-code))
               (mainchain (list " N  " " CB " " CA " " O  " " C  ")))
           (let loop ((a atom-list))
              (if (not (null? a))
                  (if  (not (member (caaar a) mainchain))
                       (begin
                          (set-atom-attribute
                             imol chain-id res-no ins-code (caaar a)
(cadaar a) "occ" 0.0)
                          (loop (cdr a)))
                       (loop (cdr a)))))))))

(add-key-binding "Set sidechain atoms occupancy to zero" "z"
set-zero-occ-sidechain)

---
;;; Example 3: trim sidechain by map for active residue
(define (trim-sidechain sigma-cutoff del-or-zero)
;; del-or-zero: 0 for zero occ, delete otherwise
  (define (sigma-level-at-point imol-map x y z)
    (let ((density (density-at-point imol-map x y z))
          (sigma   (map-sigma imol-map)))
      (/ density sigma)))
  (let ((atom-info (active-residue)))
     (if (not (and atom-info (valid-map-molecule? (imol-refinement-map))))
         (info-dialog "No refinement map and model set")
         (let* ((imol-mol  (list-ref atom-info 0))
                (chain-id  (list-ref atom-info 1))
                (res-no    (list-ref atom-info 2))
                (ins-code  (list-ref atom-info 3))
                (imol-map  (imol-refinement-map))
                (atom-list       (residue-info imol-mol chain-id
res-no ins-code))
                (simple-residues (list "ARG" "ANS" "ASP" "CYS" "GLN"
"GLU" "ILE" "LEU" "LYS" "MET" "SER" "THR" "VAL"))
                (cyclics         (list "HIS" "PHE" "TRP" "TYR"))
                (tlc             (residue-name imol-mol chain-id
res-no ins-code))
                (delete-func     (lambda (n)
                                   (if (eq? del-or-zero 0)
                                       (set-atom-attribute imol-mol
chain-id res-no ins-code (car (cadr n)) (cadr (cadr n)) "occ" 0.0)
                                       (delete-atom imol-mol chain-id
res-no ins-code (car (cadr n)) (cadr (cadr n)))))))
           (cond
           ;; and attempt to keep connectivity: trim tail first
           ((member tlc simple-residues)
             (let ((to-be-deleted '())
                   (atom-chars    (list #\H #\Z #\E #\D #\G)))
               ;; does it look dodgy?
               (let loop ((a atom-list))
                  (if (not (null? a))
                      (let ((atom-char (string-ref (caaar a) 2) )
                            (sigma     (sigma-level-at-point imol-map
                                                             (car   (caddar a))
                                                             (cadr  (caddar a))
                                                             (caddr
(caddar a)))))
                        (if (member atom-char atom-chars)
                            (begin  (if (assoc-ref to-be-deleted atom-char)
                                        (set! to-be-deleted
                                              (assoc-set! to-be-deleted
                                                          atom-char
                                                         (cons (car
(assoc-ref to-be-deleted atom-char))
                                                               (list
(list sigma

(caar a))))))
                                        (set! to-be-deleted (acons
atom-char  (list (list sigma (caar a))) to-be-deleted)))
                                     (loop (cdr a)))
                             (loop (cdr a))))))
               ; get rid of them.
               (let loop ((a atom-chars))
                 (if (not (null? a))
                     (if (assoc-ref to-be-deleted (car a))
                         (let ((atoms (sort-list (assoc-ref
to-be-deleted (car a))
                                                 (lambda (a b) (> (car
a) (car b))))))
                            (if (< (caar atoms) sigma-cutoff)
                                (begin (map delete-func atoms)
                                       (loop (cdr a)))))
                         (loop (cdr a)))))))
            ;; trim all of side chain if average-coverage below cutoff.
            ((member tlc cyclics)
             (let ((mainchain-atoms (list " C  " " N  " " CA " " O  " " CB "))
                   (to-be-deleted   '()))
               ;; generate baddie-list
               (let loop ((a atom-list))
                  (if (not (null? a))
                      (if (not (member (caaar a) mainchain-atoms))
                          (begin (set! to-be-deleted
                                      (cons (list
(sigma-level-at-point imol-map (car   (caddar a))

          (cadr  (caddar a))

          (caddr (caddar a)))
                                                  (caar a)) to-be-deleted))
                                   (loop (cdr a)))
                         (loop (cdr a)))))
              ;; get rid of them
              (if (< (/ (accumulate + 0 (map (lambda (s) (car s))
to-be-deleted)) (length to-be-deleted)) sigma-cutoff )
                  (map delete-func to-be-deleted))))
            ;; ALA, GLY, PRO and
            ;; non-standard amino-acid residues
            (else 'do-nuthin))))))

(add-key-binding "Trim sidechain by map" "z" (lambda () (trim-sidechain 1.0 0)))
;; where sigma=1.0 set-occ-zero=0
;; for atom deletion at 0.8 sigma:
;; (add-key-binding "Trim sidechain by map" "z" (lambda ()
(trim-sidechain 0.8 1)))

Reply via email to