Fix RELION & RELION5 star file import for ChimeraX 1.10.1#53
Merged
Conversation
Use pandas type to work with newer versions
The RELION5 star-file reader had the same np.issubdtype(df.dtypes[key], np.number) check that fails on pandas StringDtype columns under ChimeraX 1.10.1 (issue #43). Use pandas' is_numeric_dtype here too so RELION5 imports are covered by the same fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43. Supersedes #44.
Problem
ChimeraX 1.10.1 ships a newer pandas where the
starfilereader returns string columns (e.g.rlnMicrographName) as the pandas extensionStringDtypeinstead of numpyobject.np.issubdtype()only understands numpy dtypes, so classifying the "additional" columns during import raises:Fix
Replace the check with pandas' public
pd.api.types.is_numeric_dtype(), which correctly handles both numpy dtypes and pandas extension dtypes.The identical check existed in both star-file readers, so the fix is applied in both:
src/io/RELION/RELIONParticleData.py— original fix by @bwmr (from Fix Relion Star file import for ChimeraX 1.10.1 #44)src/io/RELION5/RELION5ParticleData.py— the RELION5 reader had the same line and would crash the same way on RELION5 star filesCredit to @bwmr for the root-cause analysis and the original fix in #43/#44; their commit is preserved here. This PR bundles the matching RELION5 fix so #43 is fully resolved (rebased onto current
main, which now includes #39 and #52).🤖 Generated with Claude Code