Fix numpy 2.4 scalar conversion error - #157
Conversation
|
Hi @chemonke thanks for the contribution. Do you mind checking out the failing test? |
There was a problem hiding this comment.
Pull request overview
This PR addresses NumPy 2.4+ compatibility issues in BioPandas structure parsing, primarily fixing an MMTF parsing failure caused by stricter scalar conversion rules, and improving amino3to1 residue boundary detection across PDB/MMTF/mmCIF.
Changes:
- Fix NumPy 2.4+
TypeErrorinmmtf_to_dfby extracting a scalar index fromnp.argwhere(...). - Make
amino3to1residue grouping more robust by including chain IDs and safely handling missing insertion codes. - Add a changelog entry describing the update (needs alignment with the PR’s actual fixes).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/CHANGELOG.md | Adds a release note entry for the change (currently misaligned with the PR’s primary fix). |
| biopandas/pdb/pandas_pdb.py | Updates amino3to1 residue boundary key to include chain_id and tolerate missing insertion codes. |
| biopandas/mmtf/pandas_mmtf.py | Fixes NumPy 2.4 scalar conversion in mmtf_to_df; updates amino3to1 residue boundary key similarly. |
| biopandas/mmcif/pandas_mmcif.py | Updates amino3to1 residue boundary key to include chain + insertion handling for mmCIF. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'll have a look at it tomorrow when I'm home again. |
4e879a3 to
5cf868e
Compare
|
Full disclosure: my background is in chemistry, and I haven't finished my data science degree yet, so I'm basically a beginner. I don't expect any problems from the indexing change in b4b69b1. But the |
|
Hey @a-r-j This came back on my radar because the downstream package broke when pandas 3.0 was introduced to nixpkgs, as expected. When I last worked on this, I recall seeing the CI error for publishing and not knowing what to make of it, and now the CI logs aren't available anymore. I'm not familiar with AppVeyor. Let me know if there's anything I can do, I'd be happy to help. |
Code of Conduct
Description
See #156
Related issues or pull requests
Fixes #156 , test now passes.
Pull Request Checklist
./docs/sources/CHANGELOG.mdfile (if applicable)./biopandas/*/testsdirectories (if applicable)biopandas/docs/sources/(if applicable)PYTHONPATH='.' pytest ./biopandas -svand make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g.,PYTHONPATH='.' pytest ./biopandas/classifier/tests/test_stacking_cv_classifier.py -sv)flake8 ./biopandas