Apply-cs.scm

From CCP4 wiki
Jump to navigation Jump to search

(define (apply-cs imol chain-id cs-file-name)
  (if (file-exists? cs-file-name)
      (call-with-input-file cs-file-name
	(lambda (port)
	  (let loop ((resno (read port))
		     (attributes '()))
	    (if (eof-object? resno)
		(set-atom-attributes attributes)
		(let ((cs (read port)))
		  (let* ((atts (map (lambda (atom)
				      (list imol chain-id resno ""
					    (car (car atom))
					    (car (cdr (car atom)))
					    "B" cs))
				    (residue-info imol chain-id resno ""))))
		    (loop (read port)
			  (append atts attributes))))))))))