Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3633 closed defect (fixed)

"save xxx.cif sel true" causes a traceback when nothing is selected

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
"save xxx.cif sel true" causes a traceback when nothing is selected.

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 6nnr format mmcif fromDatabase pdb

6nnr title:  
high-resolution structure of wild-type E. coli thymidylate synthase [more
info...]  
  
Chain information for 6nnr #1  
---  
Chain | Description  
A B | Thymidylate synthase  
  
Non-standard residues in 6nnr #1  
---  
CB3 — 10-propargyl-5,8-dideazafolic acid  
EPE — 4-(2-hydroxyethyl)-1-piperazine ethanesulfonic acid (HEPES)  
NA — sodium ion  
UMC — 2'-deoxy-5'-uridylic acid  
  

> save test.cif selectedOnly true

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 "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/save_command/cmd.py", line 66, in cmd_save  
Command(session, registry=registry).run(provider_cmd_text, log=log)  
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 "/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 139, in write_mmcif  
save_structure(session, f, [m], [xforms[m]], used_data_names, selected_only,
displayed_only)  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/mmcif/mmcif_write.py", line 270, in save_structure  
restrict = concatenate(session.selection.items("atoms"))  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/molarray.py", line 343, in concatenate  
c = object_class(None)  
TypeError: 'NoneType' object is not callable  
  
TypeError: 'NoneType' object is not callable  
  
File "/opt/UCSF/ChimeraX/lib/python3.7/site-
packages/chimerax/atomic/molarray.py", line 343, in concatenate  
c = object_class(None)  
  
See log for complete Python traceback.  
  

> save test.pdb selectedOnly true

> select clear




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        6.8G         42G        241M         13G         55G
	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 pett, 5 years ago

Component: UnassignedInput/Output
Owner: set to Greg Couch
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submission"save xxx.cif sel true" causes a traceback when nothing is selected

comment:2 by Greg Couch, 5 years ago

Resolution: fixed
Status: assignedclosed

Now successfully writes an mmCIF file with no atoms when the selection is empty asked to limit output to selected atoms.

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

It might be a good idea to raise a `UserError` in this case? My most 
common use case for this command is saving a file without hydrogens... 
if it just saves an empty file without complaint, it could lull the user 
into a false sense of security, thinking their work is successfully 
saved.

On 2020-08-20 08:22, ChimeraX wrote:

comment:4 by pett, 5 years ago

I don't think you'd want to raise a UserError, in case the command was being run in a script on many files, some of which might not have the kind of moiety the selection is targeting. A warning would be okay though.

--Eric

comment:5 by pett, 5 years ago

Or warn when session.in_script is True and raise UserError otherwise?

comment:6 by Greg Couch, 5 years ago

Added the warning when in a script and a UserError otherwise.

Note: See TracTickets for help on using tickets.