Skip to content

Bug: Opening Relion 3-style .star file results in type checking error in ChimeraX 1.10.1 #43

@bwmr

Description

@bwmr

Hi,

With the newest version of ChimeraX, opening a standard Relion-3 style star file fails with a type checking error. The star file looks like this:

data_

loop_
_rlnMicrographName #1
_rlnCoordinateX #2
_rlnCoordinateY #3
_rlnCoordinateZ #4
_rlnAngleRot #5
_rlnAngleTilt #6
_rlnAnglePsi #7
Position_1_ali.tomostar	1185.011000	1830.586000	721.641000	-51.494000	138.327000	149.882000
Position_1_ali.tomostar	1419.641000	1761.641000	712.586000	110.320000	142.700000	-94.925000
Position_1_ali.tomostar	1335.326000	1707.326000	577.956000	65.899000	71.599000	6.616000

The error message in ChimeraX is pasted below. TL,DR this is probably caused by newer numpy / pandas versions. I will implement a fix and submit a PR.

Best,
Benedikt

Traceback (most recent call last):
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/widgets/ArtiaxOpenDialog.py", line 66, in _qt_safe
    run(session, "open " + " ".join([FileNameArg.unparse(p) for p in paths]) + (""
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/run.py", line 49, in run
    results = command.run(text, log=log, return_json=return_json)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/cli.py", line 3221, in run
    result = ci.function(session, **kw_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 132, in cmd_open
    models = Command(session, registry=registry).run(provider_cmd_text, log=log)[0]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/core/commands/cli.py", line 3221, in run
    result = ci.function(session, **kw_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 215, in provider_open
    models, status = collated_open(session, None, [data], data_format, _add_models,
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 526, in collated_open
    return remember_data_format()
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/chimerax/open_command/cmd.py", line 497, in remember_data_format
    models, status = func(*func_args, **func_kw)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/io/formats.py", line 25, in open
    return open_particle_list(session, data, file_name, format_name=self.name, from_chimx=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/io/io.py", line 104, in open_particle_list
    data = formats[format_name].particle_data(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/io/RELION/RELIONParticleData.py", line 126, in __init__
    super().__init__(
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/io/ParticleData.py", line 507, in __init__
    self.read_file()
  File "/Users/bwi/Library/Application Support/ChimeraX/1.10/lib/python/site-packages/chimerax/artiax/io/RELION/RELIONParticleData.py", line 252, in read_file
    if np.issubdtype(df.dtypes[key], np.number):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/ChimeraX-1.10.1.app/Contents/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/numerictypes.py", line 417, in issubdtype
    arg1 = dtype(arg1).type
           ^^^^^^^^^^^
TypeError: Cannot interpret '<StringDtype(na_value=nan)>' as a data type

TypeError: Cannot interpret '' as a data type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions