Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for segment names in pdb files #2637

Merged
merged 3 commits into from
Dec 6, 2023
Merged

Conversation

dkoes
Copy link
Contributor

@dkoes dkoes commented Oct 24, 2023

This adds support for handling segment names in pdb files (they were previously ignored). Importantly, atoms with different segments are now placed in different residues. When building biological assemblies, Prody distinguishes between the mirrored chains of an assembly by setting their segment names. Without this fix, you will end up with multiple residues within a single OBResidue.

Different segments should have different residues.
@ghutchis
Copy link
Member

ghutchis commented Nov 5, 2023

@dkoes - I'm seeing test failures in the new test:

Traceback (most recent call last):
File "/Users/runner/work/openbabel/openbabel/test/testpdbformat.py", line 28, in testSegname
mol = pybel.readstring('pdb','''ATOM 102 N CYS A 16 59.916 27.715 54.719 1.00 30.93 A N
AttributeError: 'NoneType' object has no attribute 'readstring'

@dkoes
Copy link
Contributor Author

dkoes commented Nov 6, 2023

Huh, why might that be? I'm importing pybel with from testbindings import pybel which is what other test files do. The test passes on my workstation and on CI.

@fredrikw
Copy link
Contributor

fredrikw commented Nov 7, 2023

A quick look on the failing test seems to indicate that the new test is run also on installs without the bindings. (https://github.com/openbabel/openbabel/actions/runs/6626985692/job/18417945235?pr=2637)
So I would assume it is fixed by either rewriting the test to not use the bindings, similar to the other test in testpdbformat.py or split it out to a new file and only run the test when the bindings are built.
With option one being preferred I would think, since this should probably be a feature that should be available (and tested) also without bindings.

Writing out was buggy (wrong n to snprintf).  Modify test to evaluate
segnames with obabel and only test bindings if they are present.
@dkoes
Copy link
Contributor Author

dkoes commented Nov 7, 2023

Thanks for explaining that to me. I've added an obabel test and guarded the pybel dependent test with a check for the presence of pybel (need this test to actually test the API). The new test revealed a bug with writing the segnames, so that has also been fixed.

@ghutchis ghutchis merged commit 283cc84 into openbabel:master Dec 6, 2023
6 checks passed
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.

None yet

3 participants