(define mid-string (lambda (text-in) (substring text-in 1 3))) (if (defined? 'coot-main-menubar) (let ((menu (coot-menubar-menu "PDB_REDO"))) (add-simple-coot-menu-menuitem menu "Fetch fully optimised PDB from PDB_REDO..." (lambda () (generic-single-entry "Fetch PDB_REDO structure with accession code: " "" " Fetch! " (lambda (text) (if (not (= (string-length text) 4)) (info-dialog (string-append "Young fool! - follow the instructions you should...\n" "Else slow to develop will your 'leet Jedi " "powers be...")) (let* ((pdbid (string-downcase text)) (stub (string-append "http://www.cmbi.ru.nl/pdb_redo/" (mid-string pdbid) "/" pdbid "/" pdbid "_final")) (pdb-file-name (string-append pdbid "_final.pdb")) (mtz-file-name (string-append pdbid "_final.mtz")) (url-pdb (string-append stub ".pdb")) (url-mtz (string-append stub ".mtz"))) (format #t "getting ~s~%" url-mtz) (net-get-url url-mtz mtz-file-name) (format #t "getting ~s~%" url-pdb) (net-get-url url-pdb pdb-file-name) (read-pdb pdb-file-name) (format #t "make-and-draw-map with ~s~%" mtz-file-name) (make-and-draw-map mtz-file-name "DELFWT" "PHDELWT" "" 0 1) (make-and-draw-map mtz-file-name "FWT" "PHWT" "" 0 0))))))) (add-simple-coot-menu-menuitem menu "Fetch conservatively optimised PDB from PDB_REDO..." (lambda () (generic-single-entry "Fetch PDB_REDO structure with accession code: " "" " Fetch! " (lambda (text) (if (not (= (string-length text) 4)) (info-dialog (string-append "Young fool! - follow the instructions you should...\n" "Else slow to develop will your 'leet Jedi " "powers be...")) (let* ((pdbid (string-downcase text)) (stub (string-append "http://www.cmbi.ru.nl/pdb_redo/" (mid-string text) "/" text "/" text "_besttls")) (pdb-file-name (string-append text "_besttls.pdb")) (mtz-file-name (string-append text "_besttls.mtz")) (url-pdb (string-append stub ".pdb")) (url-mtz (string-append stub ".mtz"))) (format #t "getting ~s~%" url-mtz) (net-get-url url-mtz mtz-file-name) (format #t "getting ~s~%" url-pdb) (net-get-url url-pdb pdb-file-name) (read-pdb pdb-file-name) (format #t "make-and-draw-map with ~s~%" mtz-file-name) (make-and-draw-map mtz-file-name "DELFWT" "PHDELWT" "" 0 1) (make-and-draw-map mtz-file-name "FWT" "PHWT" "" 0 0)))))))))