Print

Print


Hi Sara,

As Nat said, you just need to create a file in your home area called .coot.py (the dot before 'coot.py' is important) where you simply paste the python code. Use 'vi', 'emacs', 'nedit' or whatever text editor you like. That may be different if you use ms-windows? Others can say...

BTW, to put the record straight: it is not 'my' code but Bernhard's. I took it from:

http://strucbio.biologie.uni-konstanz.de/ccp4wiki/index.php/Bernhards_key_bindings_for_coot.py

You may need administrative privileges is to have a coot binary with python scripting enabled. But maybe your binary is already python-enabled and you need to do anything but creating your .coot.py file. Or you can install coot in your home area.

Best,


Miguel

Le 11 janv. 2010 à 18:36, Sara Züger a écrit :

> Thanks Miguel, 
> 
> but is there another way to do this sphere refinement? I'm working on a
> shared computer and have no administrator rights and also no experience with
> python/file handling of coot.
> 
> Or else, if there is no other way, can somebody explain me exactly what I
> have to do/type (like copying a coot.py file into a local folder and change
> that, but how then to tell coot to use this file?)
> 
> Thanks a lot!
> 
> Sara
> 
> -----Ursprüngliche Nachricht-----
> Von: Mailing list for users of COOT Crystallographic Software
> [mailto:[log in to unmask]] Im Auftrag von Miguel Ortiz Lombardia
> Gesendet: Freitag, 8. Januar 2010 18:17
> An: [log in to unmask]
> Betreff: Re: [COOT] how to do sphere refinement
> 
> Hi Sara,
> 
> I have the python version in my ~/.coot.py file:
> 
> <---cut--->
> def key_binding_func_1():
>    from types import ListType
>    active_atom = active_residue()
>    if (not active_atom):
>        add_status_bar_text("No active residue")
>    else:
>        imol      = active_atom[0]
>        chain_id  = active_atom[1]
>        res_no    = active_atom[2]
>        ins_code  = active_atom[3]
>        atom_name = active_atom[4]
>        alt_conf  = active_atom[5]
>        centred_residue = active_atom[1:4]
>        other_residues = residues_near_residue(imol, centred_residue, 5)
>        all_residues = [centred_residue]
>        if (type(other_residues) is ListType):
>            all_residues += other_residues
>        print "imol: %s residues: %s" %(imol, all_residues)
>        refine_residues(imol, all_residues)
> 
> add_key_binding("Refine residues in a sphere", "R", lambda:
> key_binding_func_1())
> <---cut--->
> 
> In principle, if you place your scheme script in your ~/.coot file it will
> work next time you open coot (without having to load the script).
> 
> Having said that, it would be great if sphere refinement would take into
> account atoms on residues from symmetry-related molecules (perhaps it does
> already so? I tried a few weeks/months ago...)
> 
> HTH,
> 
> 
> Miguel
> 
> Le 8 janv. 2010 à 17:22, Sara Züger a écrit :
> 
>> Good evening everybody,
>> 
>> I wanted to try sphere refinement for the real space refinement of a
>> glycosidic bond, however it did not work out... (Coot 0.6-pre-1/Durham
>> (revision 2264)) 
>> That's what I did:
>> 
>> I copied this script into a text file:
>> 
>> (add-key-binding "Refine residues in a sphere" "R"
>>   (lambda ()
>>     (let ((active-atom (active-residue)))
>>       (if (list? active-atom)
>>           (let* ((centred-residue (list-head (cdr active-atom) 3))
>>                  (imol (car active-atom))
>>                  (other-residues (residues-near-residue 
>>                                   imol centred-residue 3.5))
>>                  (all-residues (if (list? other-residues)
>>                                    (cons centred-residue other-residues)
>>                                    (list centred-residue))))
>>             (refine-residues imol all-residues))))))
>> 
>> and then loaded into coot by using "run script". Then I centered on an
> atom
>> of my glycan and pressed shift-r, or opened the key bindings under
>> extensions/settings and used the button for my new key binding.
>> Nothing happened, but I got this error message in the terminal, where I
>> started coot:
>> 
>> (graphics-general-key-press-hook 82)
>> 82 not found in key_bindings
>> (graphics-general-key-press-hook 114)
>> 114 not found in ((82 "R" "Refine residues in a sphere" #<procedure #f
> ()>))
>> 114 not found in key_bindings
>> 
>> What did I miss or do wrong?
>> 
>> Thanks for you help!
>> 
>> Sara
>> 
>> -- 
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>> 
> 
> -- Miguel
> 
> Architecture et Fonction des Macromolécules Biologiques (UMR6098)
> CNRS, Universités d'Aix-Marseille I & II
> Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France
> Tel: +33(0) 491 82 55 93
> Fax: +33(0) 491 26 67 20
> e-mail: [log in to unmask]
> Web: http://www.pangea.org/mol/spip.php?rubrique2
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 

-- Miguel

Architecture et Fonction des Macromolécules Biologiques (UMR6098)
CNRS, Universités d'Aix-Marseille I & II
Case 932, 163 Avenue de Luminy, 13288 Marseille cedex 9, France
Tel: +33(0) 491 82 55 93
Fax: +33(0) 491 26 67 20
e-mail: [log in to unmask]
Web: http://www.pangea.org/mol/spip.php?rubrique2