On 30/04/15 23:51, Murpholino Peligro wrote:
Hi
Is it possible open 30 maps in red-ugly to red-bright? and the next 30 maps in green-ugly to green-bright? So I can have in total 60 maps over my structure in different "shades" of green and red...


script attached.

There's a small function at the top where you map your maps and return a list of molecule numbers - you will probably want to do this in a different way to the way I have done it.

Paul.


;; return a list of molecule numbers for the red maps
;; 
(define (read-many-maps-1)

  (map (lambda (i)
	 (let ((map-filename "rnase.map"))
	   ;; to get a list of map molecule numbers I read in the same
	   ;; map 30 times (and change the contour level) - this might
	   ;; not be what you want, so change this.
	   (let ((imol (handle-read-ccp4-map map-filename 0)))
	     ;; what's the relation between the map and the contour
	     ;; level? You will probably want to change this
	     (set-contour-level-absolute imol (+ 0.1 (* i 0.06)))
	     imol)))
       (range 30)))

;; also return a list of molecule numbers for the green maps
;; 
(define (read-many-maps-2)

  (map (lambda (i)
	 (let ((map-filename "rnase.map"))
	   (let ((imol (handle-read-ccp4-map map-filename 0)))
	     (set-contour-level-absolute imol (+ 0.1 (* i 0.1)))
	     imol)))
       (range 30)))


(define (coloured-maps mol-list ugly bright)

  (define (get-colour imol-idx)
    (let ((f (/ imol-idx (length mol-list))))
      (map (lambda (c1 c2) 
	     (+ c1 (* f (- c2 c1))))
	   ugly bright)))

  (for-each (lambda (imol-idx)
	      (let ((c (get-colour imol-idx)))
		;; debugging
		;; (format #t "map number: ~s   colour: ~a ~%~!"  (list-ref mol-list imol-idx) c)
		(apply set-map-colour (append (list (list-ref mol-list imol-idx)) c))))
	    (range (length mol-list))))



;; -------------- run those functions --------------------------------------------

;; -- red maps 
;; 
(let ((ugly   (list 0.3 0.2 0.2))  ;; pale dark red
      (bright (list 1.0 0.2 0.2))) ;; bright red
  (coloured-maps (read-many-maps-1) ugly bright))


;; -- green maps 
;; 
(let ((ugly   (list 0.2 0.3 0.2))  ;; pale dark green
      (bright (list 0.2 1.0 0.2))) ;; bright green

  (coloured-maps (read-many-maps-2) ugly bright))

(graphics-draw)



Reply via email to