Opened 6 years ago

Closed 5 years ago

#1976 closed defect (fixed)

"is_default" does nothing in Open and Save ChimeraXClassifier

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

Description

In toolshed/installed.py the value is parsed (lines 490 and 513 for Open and Save respectively), but it's never actually used. I'm trying to implement an open command for structure factor .cif files, and need to be able to disambiguate from mmCIF. At the moment, if I define the DataFormat and Open commands in Clipper's bundle_info.xml:

    <ChimeraXClassifier>ChimeraX :: DataFormat :: Structure factor CIF :: sfcif :: Reflection data :: .cif :: :: :: :: :: Crystallographic reflection file :: </ChimeraXClassifier>
    <ChimeraXClassifier>ChimeraX :: Open :: Structure factor CIF :: sfcif :: false :: structure_model:Structure, over_sampling:Float</ChimeraXClassifier>

... then my open command ends up taking precedence over mmCIF.

Change History (4)

in reply to:  1 ; comment:1 by Conrad Huang, 6 years ago

'''is_default''' is a concept that had not been completely thought 
through.  As you noted, the value is unused (except for '''Fetch''', 
where it is used to determine the default format to use when fetching 
from the remote end, e.g., use mmCIF instead of PDB for RCSB).  Currently,

a. both the '''tag''' and '''is_default''' parameters of '''Open''' and 
'''Save''' are ignored; and
b. '''core/io.py''' only supports one open function per format.

So, basically, there is no way to add a non-default, secondary file 
opener for any format.

What ''is'' currently supported is having multiple formats share the 
same suffix.  Unfortunately, the choice of which format to use depends 
on dictionary order, i.e., arbitrary.  One possible solution is:

a. ignore, for backwards compatibility, '''tag''' and '''is_default''' 
from the '''Open''' and '''Save''' classifiers
b. add an optional '''priority''' to the '''!DataFormat''' classifier
c. fix '''core/io.py''' to accept the optional '''priority''' parameter 
during registration, and use it to determine which module to use when 
multiple formats (possibly from multiple modules) share the same suffix
d. fix the toolshed code to pass priority value when registering formats

(A numerical priority per format gives us more flexibility for choosing 
from multiple possibilities than an is-/is-not-default boolean.)

Comments?

On 5/29/2019 4:21 AM, ChimeraX wrote:

in reply to:  2 ; comment:2 by goddard@…, 6 years ago

The PDB IHM files have suffix .cif.  When I register the format I say the file suffix is ".ihm".  Since you have to give the "format" option to open such a file with .cif suffix so it is not interpreted as mmCIF ("open mymodel.cif format ihm") the file suffix doesn't matter.  So one idea is just make up a file suffix for PDB structure factors (e.g. ".sfc"). Maybe you can register a file format and specify no file suffixes -- not sure if that would break any code.

One other idea for the ".cif" nightmare is to add a CIF reader that looks into the file and tries to figure out if it is mmCIF, IHM, crystallography CIF, structure factors, ... and then calls the proper reader code.  I'm not thrilled about this idea.  You still won't be able to say "save mydata.cif" without specifying a format.


comment:3 by Greg Couch, 5 years ago

Component: Tool ShedInput/Output
Owner: changed from Conrad Huang to pett

Eric reorganized the data format support.

comment:4 by pett, 5 years ago

Resolution: fixed
Status: assignedclosed

I believe the issue is moot at this point, but with the new implementation what could have been done is register a format with no suffixes. You could only open such a file by explicitly specifying the "format" keyword.

Note: See TracTickets for help on using tickets.