Skip to content

[WIP] Handle hex36 indices#663

Open
hannahbaumann wants to merge 105 commits intomainfrom
modify_pdbstructure
Open

[WIP] Handle hex36 indices#663
hannahbaumann wants to merge 105 commits intomainfrom
modify_pdbstructure

Conversation

@hannahbaumann
Copy link
Copy Markdown
Contributor

@hannahbaumann hannahbaumann commented Oct 23, 2025

Tips

  • Comment "pre-commit.ci autofix" to have pre-commit.ci atomically format your PR.
    Since this will create a commit, it is best to make this comment when you are finished with your work.

Checklist

  • Added a news entry

Developers certificate of origin

@hannahbaumann hannahbaumann changed the base branch from membrane_prototype to main December 15, 2025 12:51
@hannahbaumann hannahbaumann changed the base branch from main to membrane_prototype December 15, 2025 12:52
@hannahbaumann
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@hannahbaumann hannahbaumann changed the title [WIP] Test out changes to pdbstructure for maestro compatibility [WIP] Skip CONECT records if they are not readable Jan 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.87%. Comparing base (0233e65) to head (eeda36f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #663   +/-   ##
=======================================
  Coverage   98.87%   98.87%           
=======================================
  Files          42       42           
  Lines        2669     2669           
=======================================
  Hits         2639     2639           
  Misses         30       30           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hannahbaumann hannahbaumann changed the title [WIP] Skip CONECT records if they are not readable [WIP] Handle hex36 indices Feb 5, 2026
Base automatically changed from membrane_prototype to main February 12, 2026 19:56
@hannahbaumann
Copy link
Copy Markdown
Contributor Author

pre-commit.ci autofix

@github-actions
Copy link
Copy Markdown

No API break detected ✅

try:
val = int(index, base)
if val >= 0xA0000:
val = val - 0xA0000 + 100000
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some ( )to make it more clear the order of operations here?

return int(index)
except:
return int(index, 16) - 0xA0000 + 100000
def _parse_atom_index(index: str) -> int:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather this function raise a custom exception that we then catch when we call it instead of a bare except

for pos in (11, 16, 21, 26):
try:
atoms.append(_parse_atom_index(pdb_line[pos : pos + 5]))
except:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should catch an exception here

except:
pass
self._current_model.connects.append(atoms)
except:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should catch an exception here

"""
index = index.strip()

# Try decimal, then hex, then Maestro base36
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MH: check for a G to see what base we are using, and then use the same base for the entire file and we should be fine

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add a bit more from slack:
It is possible that a base36 might not have a G, in which case the decimal value we convert when we use base16 would be "wrong" but if we use the same base to convert everything into decimal, then things will be internally consistent (for things like CONNECT records).

It also might be nice to have the parsing function take in a base as an argument, so that if a user supplies us a base, we can just use that value.

We can then use another function to guess the base if a user doesn't give us one, then pass that base to the parsing function.

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.

3 participants