Opened 6 years ago
Closed 6 years ago
#2342 closed defect (fixed)
API inconsistency copying residue with blank insertion code
| Reported by: | Tristan Croll | Owned by: | Eric Pettersen |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Structure Editing | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
If I try to create a new residue based on an existing one:
---> 61 nr = m.new_residue(r.name, cid, r.number-offset, insert=r.insertion_code)
62 for a in r.atoms:
63 na = atom_map[a] = m.new_atom(a.name, a.element)
/opt/UCSF/ChimeraX-daily/lib/python3.7/site-packages/chimerax/atomic/molobject.py in new_residue(self, residue_name, chain_id, pos, insert)
1551 args = (ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char),
1552 ret = ctypes.py_object)
-> 1553 return f(self._c_pointer, residue_name.encode('utf-8'), chain_id.encode('utf-8'), pos, insert.encode('utf-8'))
1554
1555 @property
ArgumentError: argument 5: <class 'TypeError'>: wrong type
... which occurs because m.new_residue requires the insert argument to be 1 character long, but Residue.insertion_code returns an empty string when it has no insertion code. Easy enough to work around now I know what's going on, but not obvious to diagnose in the first place.
Change History (2)
comment:1 by , 6 years ago
| Status: | assigned → accepted |
|---|
comment:2 by , 6 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.
Now it massages an empty insertion code to a blank before passing it on to the C++ layer