Paul Emsley wrote:
Sander Nabuurs wrote:
Dear all,
Is there a way in Coot to export the Residue Density Fit values as
calculated by the Validate > Density fit analysis to a text file?
Basically
a simple output with residue number and density fit value would suffice.
I've been looking into the different scripting possibilities of Coot,
but
being a new user, I've not been able to figure this out...
Dear Sanders Nabuurs,
You can do it in scheme or python with a bit of scripting, but I
suggest that you use the stand-alone command-line program
density-score-by-residue.
As a follow up to this:
Sanders informs me that that executable is not available in the binary
tar file. I'll make a note to fix that. In the meantime here is some
scripting:
(define (density-fit-table imol . file-name)
(define (table-output-score imol imol-map port)
(for-each
(lambda (res)
(let ((res-no (list-ref res 2))
(chain-id (list-ref res 1))
(ins-code (list-ref res 3)))
(format port "res: ~s ~s ~%" (cdr res)
(score-residue-range-fit-to-map res-no res-no "" chain-id imol
imol-map))))
(residues-matching-criteria imol (lambda r #t))))
(let ((imol-map (imol-refinement-map)))
(if (not (valid-map-molecule? imol-map))
(info-dialog "Oops - must set the refinement map first")
(if (null? file-name)
(table-output-score imol imol-map #t)
(call-with-output-file (car file-name)
(lambda (port)
(table-output-score imol imol-map port)))))))
typical usage:
(density-fit-table 0)
or
(density-fit-table 0 "file.tab")
Paul.