Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1103 closed defect (fixed)

AddH fails after deleting atoms

Reported by: Tristan Croll Owned by: Eric Pettersen
Priority: major Milestone:
Component: Structure Editing Version: 0.6
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

delete H
addh hbond false

leads to the below traceback:

No usable SEQRES records for for_isolde.updated.pdb (#1) chain C; guessing termini instead
No usable SEQRES records for for_isolde.updated.pdb (#1) chain D; guessing termini instead
No usable SEQRES records for for_isolde.updated.pdb (#1) chain B; guessing termini instead
No usable SEQRES records for for_isolde.updated.pdb (#1) chain A; guessing termini instead
Chain-initial residues that are actual N termini: /C ALA 2, /D ALA 2, /B ILE 28, /A ILE 28
Chain-initial residues that are not actual N termini: /B ALA 257, /B ILE 389, /B ASN 598, /A ALA 257, /A ILE 389, /A ASN 598
Chain-final residues that are actual C termini: 
Chain-final residues that are not actual C termini: /C SER 148, /D SER 148, /B ARG 626, /B LYS 236, /B ASP 378, /B ASP 574, /A ARG 626, /A LYS 236, /A ASP 378, /A ASP 574
Traceback (most recent call last):
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/cmd_line/tool.py", line 205, in execute
    cmd.run(cmd_text)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/core/commands/cli.py", line 2622, in run
    result = ci.function(session, **kw_args)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 55, in cmd_addh
    add_h_func(session, structures, in_isolation=in_isolation, **prot_schemes)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 130, in simple_add_hydrogens
    idatm_type, invert, coordinations.get(atom, []))
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/simple.py", line 34, in add_hydrogens
    _alt_loc_add_hydrogens(atom, alt_loc_atom, *args, **kw)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/simple.py", line 77, in _alt_loc_add_hydrogens
    idatm_type[atom], atom, (list(atom.neighbors)+coordinations)[0], 3.5)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 667, in find_rotamer_nearest
    c_pos = candidate._addh_coord
AttributeError: 'Atom' object has no attribute '_addh_coord'

AttributeError: 'Atom' object has no attribute '_addh_coord'

File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 667, in find_rotamer_nearest
c_pos = candidate._addh_coord

Change History (12)

comment:1 by Eric Pettersen, 7 years ago

Status: assignedaccepted

comment:2 by Eric Pettersen, 7 years ago

Status: acceptedfeedback

I cannot reproduce this problem using 1mtx and the 0.6 release. Can you reproduce it using 1mtx? If not, can you provide the structure it fails on?

--Eric

in reply to:  3 ; comment:3 by tic20@…, 7 years ago

Weird... I can't reproduce it now either. Same structure as before, same 
set of actions (and trying a number of different combinations of 
circumstances)... nothing. The annoying thing is that it happened twice 
in a row (restarting ChimeraX in between) before I submitted the report.

Sorry for the... false alarm?

On 2018-05-01 18:59, ChimeraX wrote:

comment:4 by Eric Pettersen, 7 years ago

Resolution: can't reproduce
Status: feedbackclosed

It is probably a consequence of the import hook -- code that directly imports atomic.molobject can in some circumstances cause two Atom ( + Residue, etc.) classes to be defined. We are working on this problem now and it is open as another ticket (#1101).

--Eric

comment:5 by Tristan Croll, 7 years ago

Resolution: can't reproduce
Status: closedreopened

This is still happening in the current 0.7 build. If I load a model and start ISOLDE, then run addh hbond false, I get the below traceback. Interestingly, if I run addh once *before* starting ISOLDE, then it works correctly *after* (almost - on second run it adds a spurious hydrogen to my N-terminal proline, but that happens whether or not ISOLDE is involved).

  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 55, in cmd_addh
    add_h_func(session, structures, in_isolation=in_isolation, **prot_schemes)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 117, in simple_add_hydrogens
    _make_shared_data(session, structures, in_isolation)
  File "/home/tic20/apps/chimerax/lib/python3.6/site-packages/chimerax/add_h/cmd.py", line 342, in _make_shared_data
    xyzs.append(a._addh_coord)
AttributeError: 'Atom' object has no attribute '_addh_coord'

comment:6 by Eric Pettersen, 7 years ago

Does ISOLDE import things from atomic that aren't in it's "public" API (i.e. in atomic/init)? If so, are you importing from chimerax.core.atomic... or from chimerax.atomic...?

--Eric

in reply to:  7 ; comment:7 by tic20@…, 7 years ago

I’m now importing everything from chimerax.atomic. Will see about making a list of all my imports tomorrow.

 
 
Tristan Croll
Research Fellow
Cambridge Institute for Medical Research
University of Cambridge CB2 0XY
 

 


comment:8 by Eric Pettersen, 7 years ago

Here's what's happening: atomic hasn't actually moved out of core yet (it's a big project) and the import hook only has the ability to intercede in imports from chimerax.atomic, not for submodule imports (once the import of chimerax.atomic has occurred, the import machinery "knows" how to import submodules and the hook never gets called). So, if you do a "from chimerax.atomic.molobject import blah", then there winds up being a second copy of molobject and a second copy of all the classes (e.g. Atom), and class attributes added on the fly to the original class won't be in the copy.

So, first, you need to make your imports from chimerax.atomic rather than a submodule if the appropriate symbol is in chimerax.atomic. If it isn't in there, then I need to make some kind of public API for what you're using and put it in chimerax.atomic for you to use.

--Eric

in reply to:  9 ; comment:9 by tic20@…, 7 years ago

Ah - yes, I have a lot of imports directly from molobject. A whole series of core classes (Dihedral, Rama, Rotamer, etc. etc. etc.) use the molc/State/Collection scheme. If you want to have a look, most of it’s in ISOLDE’s molobject.py and molarray.py.

 
 
Tristan Croll
Research Fellow
Cambridge Institute for Medical Research
University of Cambridge CB2 0XY
 

 


comment:10 by Eric Pettersen, 7 years ago

Cc: Tom Goddard added
Resolution: fixed
Status: reopenedclosed

It looks like what you are importing from molobject is all the pointer-to-object conversion functions (e.g. _atoms, _residues_or_nones, etc.). Since we feel it would frighten normal humans to put them in the main public API (and pollute the namespace in a confusing fashion) we have instead made the, "quasi-public" by moving them into atomic.ctypes_support and removing the leading underscore from their names. So I suggest you update your molobject.py by changing the import statement to:

from chimerax.atomic import ctypes_support as convert

and then all the uses of _blahblah to convert.blahblah

--Eric

in reply to:  11 ; comment:11 by tic20@…, 7 years ago

Phew! A bit of a slog tracking things down, but it's working again (that 
is, AddH runs without error after starting ISOLDE, which I assume is a 
pretty good diagnostic for the underlying problem). ISOLDE is now 
cleanly using only chimerax.atomic, but in the Clipper plugin I still 
have four imports coming from chimerax.core.atomic.structure (since 
they're not exposed via atomic/__init__.py): PickedBonds, AtomsDrawing, 
BondsDrawing, _bond_intercept.

On 2018-06-05 23:07, ChimeraX wrote:

in reply to:  12 ; comment:12 by tic20@…, 7 years ago

Never mind... just importing chimerax.atomic.structure and then using 
them as structure.xxx works fine.

On 2018-06-06 12:58, ChimeraX wrote:

Note: See TracTickets for help on using tickets.