Opened 9 years ago

Closed 9 years ago

#436 closed defect (fixed)

Tool setup.py cannot register multiple extensions for file format

Reported by: Eric Pettersen Owned by: Greg Couch
Priority: blocker Milestone:
Component: Input/Output Version:
Keywords: Cc: conrad@…, meng@…
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

FASTA and several other sequence formats have no "standard" file suffix, so we want to register several common suffixes for each for convenience. Though the bottom-most layer of the file-registration mechanism (io.register_format) supports multiple suffixes, none of the layers above do. You can't even register multiple extensions laboriously by giving the format/category/suffix triplet multiple times, since the last one "wins".

Change History (5)

comment:1 by Greg Couch, 9 years ago

Status: newaccepted

This should be fixed with the new metadata format. I'll convert the alignments bundle soon.

comment:2 by Greg Couch, 9 years ago

Resolution: fixed
Status: acceptedclosed

Both .fa and .msf files can be opened.

comment:3 by Eric Pettersen, 9 years ago

Cc: conrad@… meng@… added
Resolution: fixed
Status: closedreopened

Despite the fact that the setup.py.in for the alignments bundle specifies multiple extensions for the FASTA format, only ".fa" works. This is apparently because some cached version of the bundle with a different name overwrites the multiple-extension registration with just ".fa": warning: both chimerax.seqalign and ChimeraX-Alignments supply package chimerax.seqalign

Below is startup messages from ChimeraX, along with stack traces generated as the the FASTA format is registered (which you can see happens twice. We need to straighten out when the cache gets ignored.

--Eric

essex:/Users/pett/src/chimera2/src/core<27> ../../ChimeraX.app/Contents/MacOS/ChimeraX
Registering format FASTA with extensions ['.fa', '.fasta', '.afasta', '.afa']

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 170, in _run_module_as_main

"main", mod_spec)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code

exec(code, run_globals)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ChimeraX_main.py", line 632, in <module>

raise SystemExit(init(sys.argv))

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ChimeraX_main.py", line 400, in init

sess.toolshed = toolshed.init(sess.logger, debug=sess.debug)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 2131, in init

_toolshed = Toolshed(*args, kw)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 364, in init

rebuild_cache=rebuild_cache)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 424, in reload

bi.register()

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 1743, in register

self._register_file_types()

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 1787, in _register_file_types

format = io.register_format(fi.name, fi.category, fi.suffixes)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/io.py", line 170, in register_format

traceback.print_stack()

warning: both ChimeraX-CellPack and chimerax.cellpack supply package chimerax.cellpack
warning: both chimerax.mouse-modes and ChimeraX-RightMouseModes supply package chimerax.mouse_modes
warning: both chimerax.model-panel and ChimeraX-ModelPanel supply package chimerax.model_panel
warning: both chimerax.log and ChimeraX-Log supply package chimerax.log
warning: both ChimeraX-CommandLine and chimerax.cmd-line supply package chimerax.cmd_line
warning: both chimerax.sideview and ChimeraX-SideView supply package chimerax.sideview
warning: both chimerax.seqalign and ChimeraX-Alignments supply package chimerax.seqalign
warning: both chimerax.seqalign and ChimeraX-Alignments supply package chimerax.seqalign.io
Registering format FASTA with extensions .fa

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 170, in _run_module_as_main

"main", mod_spec)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code

exec(code, run_globals)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ChimeraX_main.py", line 632, in <module>

raise SystemExit(init(sys.argv))

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ChimeraX_main.py", line 400, in init

sess.toolshed = toolshed.init(sess.logger, debug=sess.debug)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 2131, in init

_toolshed = Toolshed(*args, kw)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 364, in init

rebuild_cache=rebuild_cache)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 424, in reload

bi.register()

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 1743, in register

self._register_file_types()

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/toolshed/init.py", line 1787, in _register_file_types

format = io.register_format(fi.name, fi.category, fi.suffixes)

File "/Users/pett/src/chimera2/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/io.py", line 170, in register_format

traceback.print_stack()

warning: both chimerax.stl and ChimeraX-STL supply package chimerax.stl
warning: both chimerax.vtk and ChimeraX-VTK supply package chimerax.vtk
warning: both ChimeraX-Shortcuts and chimerax.shortcuts supply package chimerax.shortcuts
warning: both ChimeraX-AddMissingAtoms and chimerax.addmissingatoms supply package chimerax.addmissingatoms
warning: both chimerax.mav and ChimeraX-MAV supply package chimerax.mav
WARNING: bundle "chimerax.cellpack"'s API forgot to override initialize()
WARNING: bundle "chimerax.stl"'s API forgot to override initialize()
WARNING: bundle "chimerax.vtk"'s API forgot to override initialize()

comment:4 by Eric Pettersen, 9 years ago

Cc: conrad@… added; conrad@… removed

comment:5 by Tom Goddard, 9 years ago

Resolution: fixed
Status: reopenedclosed

Eric reports this is fixed.

Note: See TracTickets for help on using tickets.