Sara Zueger, Biochemisches Inst.
Tue, 12 Jan 2010 07:46:17 -0800
Ok, now, thanks to Miguel I figured out what I did wrong: I had to make a .coot.py file with only my new code inside. Key binding was now present. However sphere refinement still did not work.There was another error (which seems to be somehow similar to the error at the very beginning when I used the script from the coot documentary):
from the terminal: ----------------------------------------------- (graphics-general-key-press-hook 82) Key 82 not found in bindingsimol: 0 residues: [['L', 251, ''], ['L', 28, ''], ['L', 252, ''], ['S', 7, ''], ['L', 25, ''], ['S', 161, ''], ['L', 27, ''], ['S', 104, ''], ['S', 178, ''], ['L', 253, ''], ['S', 199, ''], ['L', 26, ''], ['S', 207, ''], ['L', 3, ''], ['L', 2, ''], ['S', 13, '']]
------------------------------------------------L251 is my first NAG, and L25 the ASN to which it is linked and then some waters on chain S...
Any suggestions ? Sorry for the trouble (I start to feel a little awkward...) Sara On Tue, 12 Jan 2010 14:57:03 +0100 "Sara Zueger, Biochemisches Inst." <szue...@bioc.uzh.ch> wrote:
Hello dear coot-cracks, Sorry for bothering you again :I could generate the .coot.py file by copying the coot.py file from share/coot/python/ into my home folder and adding the mentioned code:------------ 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())----------------------------------------------------------------- However, there is this error message on starting up coot: Loading ~/.coot.py... Running python script /home/szueger/.coot.py Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/szueger/.coot.py", line 25, in <module> _coot = swig_import_helper() File "/home/szueger/.coot.py", line 15, in swig_import_helperfp, pathname, description = imp.find_module('_coot', [dirname(__file__)])NameError: global name '__file__' is not definedBut this has nothing to do with the code snippet I copied at the end of .coot.py (right?) and I did not change anything else... ?? (I copied the coot.py file from share/coot/python/). Also the key binding is not displayed under extensions/settings/key_bindings.This error message appears either under shared or under home environment. But not if I remove .coot.py.Do I have to change something else in .coot.py? Thanks a lot again! Sara PS: these are the first 25 lines from the .coot.py: ------------------------------- from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try:fp, pathname, description = imp.find_module('_coot', [dirname(__file__)])except ImportError: import _coot return _coot if fp is not None: try: _mod = imp.load_module('_coot', fp, pathname, description) finally: fp.close() return _mod _coot = swig_import_helper() del swig_import_helper else: import _coot del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. ------------------------------------------------ On Mon, 11 Jan 2010 09:43:19 -0800 Nathaniel Echols <nathaniel.ech...@gmail.com> wrote:2010/1/11 Sara Züger <szue...@bioc.uzh.ch>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 Ihave to do/type (like copying a coot.py file into a local folder and changethat, but how then to tell coot to use this file?)Coot will automatically use ~/.coot.py if present - all you need to do iscopy-and-paste Miguel's code snippet. You don't need administrator rights,since you're only modifying your home directory. -Nat