Opened 5 years ago

Closed 3 years ago

#3636 closed defect (fixed)

mmcif_write fails with temporary/unopened structure

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

Description

The following bug report has been submitted:
Platform:        Linux-3.10.0-1127.13.1.el7.x86_64-x86_64-with-centos-7.8.2003-Core
ChimeraX Version: 1.0 (2020-06-04 23:15:07 UTC)
Description
Saving to mmcif via provider_save() does not work for a model that isn't part of the session, since `model.id` is None.

Log:
UCSF ChimeraX version: 1.0 (2020-06-04)  
© 2016-2020 Regents of the University of California. All rights reserved.  
How to cite UCSF ChimeraX  

> open map_with_ligand.ccp4

Opened map_with_ligand.ccp4, grid size 250,250,96, pixel 0.464,0.464,0.46,
shown at level 3.62, step 1, values float32  

> open model_noligand.pdb

Chain information for model_noligand.pdb #2  
---  
Chain | Description  
A | No description available  
  

> open ligand_answer.pdb

> view :ATP

> phenix fit ligand #2 ATP A #1

Connected to Phenix server on localhost:15010  
Restraints written to
/run/media/tic20/storage/Downloads/ligand_fit/ATP_restraints.cif  
Traceback (most recent call last):  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/cmd_line/tool.py", line 258, in execute  
cmd.run(cmd_text)  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/core/commands/cli.py", line 2805, in run  
result = ci.function(session, **kw_args)  
File "/home/tic20/.local/share/ChimeraX/1.0/site-
packages/chimerax/phenix/cmd.py", line 146, in phenix_fit_ligand  
provider_save(session, model_file, models=[temp_model])  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/save_command/cmd.py", line 79, in provider_save  
mgr).save(session, path, **provider_kw)  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/mmcif/__init__.py", line 87, in save  
mmcif_write.write_mmcif(session, path, **kw)  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/mmcif/mmcif_write.py", line 118, in write_mmcif  
grouped.setdefault(m.id[:-1], []).append(m)  
TypeError: 'NoneType' object is not subscriptable  
  
TypeError: 'NoneType' object is not subscriptable  
  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/mmcif/mmcif_write.py", line 118, in write_mmcif  
grouped.setdefault(m.id[:-1], []).append(m)  
  
See log for complete Python traceback.  
  




OpenGL version: 3.3.0 NVIDIA 450.51.05
OpenGL renderer: TITAN Xp/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation
Manufacturer: Dell Inc.
Model: Precision T5600
OS: CentOS Linux 7 Core
Architecture: 64bit ELF
CPU: 32 Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz
Cache Size: 20480 KB
Memory:
	              total        used        free      shared  buff/cache   available
	Mem:            62G        5.7G         45G        220M         11G         56G
	Swap:          4.9G          0B        4.9G

Graphics:
	03:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP102 [TITAN Xp] [10de:1b02] (rev a1)	
	Subsystem: NVIDIA Corporation Device [10de:11df]	
	Kernel driver in use: nvidia
PyQt version: 5.12.3
Compiled Qt version: 5.12.4
Runtime Qt version: 5.12.8

Change History (6)

comment:1 by Eric Pettersen, 5 years ago

Component: UnassignedInput/Output
Owner: set to Greg Couch
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionmmcif_write fails with temporary/unopened mmCIF file

comment:2 by Eric Pettersen, 5 years ago

Summary: mmcif_write fails with temporary/unopened mmCIF filemmcif_write fails with temporary/unopened structure

in reply to:  3 ; comment:3 by Tristan Croll, 5 years ago

I can work around it easily for now by simply setting model.id to (1,). 
No harm in this case, because it never gets added to the session. 
Actually, could you remind me: in this situation do I need to explicitly 
call its delete() when I'm done with it, or will it clean up on its own 
when it goes out of scope?

On 2020-08-20 19:27, ChimeraX wrote:

comment:4 by Eric Pettersen, 5 years ago

You need to call delete() explicitly. The C++ side holds a reference to the Python object (once created). This behavior is mainly for atoms/residues/etc. where you don't want Python-only attributes to disappear even if there is temporarily no Python-side reference to the object, but the behavior is nonetheless also true for structures.

--Eric

in reply to:  5 ; comment:5 by Tristan Croll, 5 years ago

That's what I thought, thanks. Brain's a bit too fried right now to go 
digging to confirm for myself.

On 2020-08-20 19:36, ChimeraX wrote:

comment:6 by Greg Couch, 3 years ago

Resolution: fixed
Status: assignedclosed

The mmCIF writer uses the model's id hierarchy to group NMR models together. That way the models are coalesced into a single mmCIF data section. That said, I agree it would be useful for writing mmCIF files to work in this case.

Note: See TracTickets for help on using tickets.