Skip to content

Parse hybrid-36 all-digit residue fields as decimal - #2281

Open
shaneraphel wants to merge 1 commit into
prody:mainfrom
shaneraphel:parsepdb-hybrid36-decimal
Open

shaneraphel wants to merge 1 commit into
prody:mainfrom
shaneraphel:parsepdb-hybrid36-decimal

Conversation

@shaneraphel

@shaneraphel shaneraphel commented Sep 19, 2026 •

Copy link
Copy Markdown

parsePDB flips dec false on the first hybrid-36 letter and never recovers. After that, ' 16' is all digits and spaces (isnumeric), so it misses hybrid36ToDec and falls through to int(resnum_str, 16). writePDB(..., hybrid36=True) then fails to round-trip: 16 → 22, 99 → 153, 100 → 256.

All-digit residue fields are now parsed as decimal int(resnum_str). Uppercase hybrid-36 still uses hybrid36ToDec. Lowercase hex and hexadecimal=True stay on int(..., 16).

Fixes #2273

After the first leftover hybrid-36 letter, leftover isnumeric
digits were leftover int(..., 16), so writePDB hybrid36 output
did not round-trip.
@shaneraphel shaneraphel changed the title Parse leftover hybrid-36 all-digit residue fields as decimal Parse hybrid-36 all-digit residue fields as decimal Sep 20, 2026
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.

parsePDB reads plain decimal residue numbers as hexadecimal after a hybrid-36 overflow (writePDB output does not round trip)

2 participants