Skip to content

Read lowercase bond orders and aromatic flags from chem_comp_bond - #952

Open
raashish1601 wants to merge 1 commit into
biotite-dev:mainfrom
raashish1601:fix/case-insensitive-bond-order
Open

raashish1601 wants to merge 1 commit into
biotite-dev:mainfrom
raashish1601:fix/case-insensitive-bond-order

Conversation

@raashish1601

Copy link
Copy Markdown

Fixes #951.

The file in #951 writes chem_comp_bond in lowercase (doub ... n n). _parse_intra_residue_bonds() already upper-cases value_order, but not pdbx_aromatic_flag, so the lookup key becomes e.g. ("DOUB", "n"), which is not in COMP_BOND_ORDER_TO_TYPE, and every intra-residue bond falls back to BondType.ANY. Both items are case-insensitive in the PDBx/mmCIF dictionary (ucode), so lowercase files are valid.

get_component() has the same lookup without any upper-casing, so a component with lowercase values raises a KeyError there.

This upper-cases both values in both places.

Tests: test_lowercase_bond_order (lowercases both columns of 1l2y.cif and compares the bonds with the original) and test_lowercase_bond_order_in_component (same for TYR.cif and get_component()). Both fail on main and pass with the change. I ran tests/structure/io and tests/structure/test_info.py in a Linux container (2167 passed, 1 skipped), using the CCD from the 1.7.1 wheel since the build there had no internet CCD setup. ruff check and ruff format --check pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bond information not parsed properly

1 participant