Opened 6 years ago

Closed 6 years ago

#2105 closed defect (fixed)

mmCIF save: local variable '_1to3' referenced before assignment

Reported by: Tristan Croll Owned by: Greg Couch
Priority: major Milestone:
Component: Input/Output Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

On my Linux machine in the RedHat ChimeraX 0.9 release, attempting to save the attached PDB file causes a segmentation fault. I've pasted the traceback below.

#0  0x00007ffff74d7207 in raise () at /lib64/libc.so.6
#1  0x00007ffff74d88f8 in abort () at /lib64/libc.so.6
#2  0x00007fffe74817d5 in __gnu_cxx::__verbose_terminate_handler() () at /lib64/libstdc++.so.6
#3  0x00007fffe747f746 in  () at /lib64/libstdc++.so.6
#4  0x00007fffe747f773 in  () at /lib64/libstdc++.so.6
#5  0x00007fffe747f993 in  () at /lib64/libstdc++.so.6
#6  0x00007fffb3fd2091 in std::__throw_out_of_range_fmt(char const*, ...) ()
    at /opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/atomic/lib/libatomstruct.so
#7  0x00007fff3d97993a in compile_links_ssbonds(atomstruct::Structure const*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) (__s=0x7fff3d98e20c "basic_string::substr", __pos=66, this=0x7fffffff98e0)
    at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/basic_string.h:324
#8  0x00007fff3d97993a in compile_links_ssbonds(atomstruct::Structure const*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) (__pos=66, __n=6, this=0x7fffffff98e0) at /opt/rh/devtoolset-3/root/usr/include/c++/4.9.2/bits/basic_string.h:2227
#9  0x00007fff3d97993a in compile_links_ssbonds(atomstruct::Structure const*, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) (s=s@entry=0x30a8540, links=std::vector of length 0, capacity 0, ssbonds=std::vector of length 0, capacity 0)
    at pdbio_cpp/PDBio.cpp:235
Python Exception <type 'exceptions.ValueError'> Cannot find type const std::set<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_Rep_type: 
#10 0x00007fff3d97bab2 in write_pdb_file(PyObject*, PyObject*) (polymeric_res_names=
    std::set with 35 elements, h36=true, pqr=false, all_coordsets=<optimized out>, xforms=std::vector of length 1, capacity 1 = {...}, displayed_only=false, selected_only=false, os=..., structures=..., this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>, this=<optimized out>)
    at pdbio_cpp/PDBio.cpp:1858
#11 0x00007fff3d97bab2 in write_pdb_file(PyObject*, PyObject*) (args=<optimized out>)
    at pdbio_cpp/PDBio.cpp:2094
#12 0x00007ffff7907739 in _PyMethodDef_RawFastCallKeywords (method=0x7fff3db969e0 <pdbio_functions+32>, self=<optimized out>, args=0x570d0a0, nargs=9, kwnames=<optimized out>) at Objects/call.c:694
#13 0x00007ffff79077f5 in _PyCFunction_FastCallKeywords (func=0x7fffbc43c1f8, args=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:730
#14 0x00007ffff78e0b87 in _PyEval_EvalFrameDefault (kwnames=0x0, oparg=9, pp_stack=<synthetic pointer>)
    at Python/ceval.c:4568
#15 0x00007ffff78e0b87 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at Python/ceval.c:3093
#16 0x00007ffff79f1d4e in _PyEval_EvalCodeWithName (_co=0x7fffbc483150, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, argcount=2, kwnames=0x7fffbc640f00, kwargs=0x5c8b478, kwcount=7, kwstep=1, d-----T---T-----T---T---T---Type <r---Type --

Attachments (1)

6j91_refine_2.pdb (339.7 KB ) - added by Tristan Croll 6 years ago.

Download all attachments as: .zip

Change History (8)

by Tristan Croll, 6 years ago

Attachment: 6j91_refine_2.pdb added

comment:1 by Tristan Croll, 6 years ago

Also raises a Python error when I attempt to save as mmCIF:

Traceback (most recent call last):
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/cmd_line/tool.py", line 254, in execute
    cmd.run(cmd_text)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/core/commands/cli.py", line 2632, in run
    result = ci.function(session, **kw_args)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/core/commands/save.py", line 61, in save
    fmt.export(session, filename, fmt.nicknames[0], **kw)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/core/io.py", line 213, in export
    result = self.export_func(session, path, **kw)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/atomic/mmcif/__init__.py", line 61, in save_file
    return mmcif_write.write_mmcif(session, path, models=models)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/atomic/mmcif/mmcif_write.py", line 108, in write_mmcif
    save_structure(session, f, models, used_data_names)
  File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/atomic/mmcif/mmcif_write.py", line 347, in save_structure
    seq_entities[chars] = (eid, _1to3, [c])
UnboundLocalError: local variable '_1to3' referenced before assignment

UnboundLocalError: local variable '_1to3' referenced before assignment

File "/opt/UCSF/ChimeraX/lib/python3.7/site-packages/chimerax/atomic/mmcif/mmcif_write.py", line 347, in save_structure
seq_entities[chars] = (eid, _1to3, [c])

comment:2 by Tristan Croll, 6 years ago

If I remove the three LINK records it saves successfully as PDB, but not as mmCIF.

comment:3 by Tristan Croll, 6 years ago

OK, I can see that the mmCIF issue is a *completely* different bug.

comment:4 by Eric Pettersen, 6 years ago

Owner: changed from Eric Pettersen to Greg Couch
Priority: criticalmajor
Summary: Segmentation fault saving PDBmmCIF save: local variable '_1to3' referenced before assignment

The PDB crash was because the PDB LINK records were truncated and therefore comparing the symmetry operators crashed because the substring was beyond the bounds of the original record string.

Reassigning to Greg to deal with the mmCIF problem.

in reply to:  6 comment:5 by tic20@…, 6 years ago

Huh. That PDB file was straight out of phenix.refine. Quite surprising that they’re writing incomplete LINK records.
 

 


in reply to:  7 ; comment:6 by Eric Pettersen, 6 years ago

Well, those LINK records end at column 57.  The two symmetry operators are columns 60-72.  Blanks in those columns imply identity operators, though actual RCSB PDB files use ‘1555’ for the identity operator.  Phenix must have truncated them because of the trailing blanks (or simply didn't bother with the blanks).

comment:7 by Greg Couch, 6 years ago

Resolution: fixed
Status: assignedclosed

Fixed.

Note: See TracTickets for help on using tickets.