Repository navigation
Conversation
Implement the DSSP 4 secondary structure assignment in `biotite.structure`. The function is split into the detection of backbone hydrogen bonds via the DSSP energy criterion and the assignment of the secondary structure elements based on these hydrogen bonds. The results are identical to the original DSSP software for all test structures. `DsspElement` is moved from `biotite.application.dssp` into `biotite.structure` and obtains a `NONE` member for residues that are not amino acids or have an incomplete backbone.
Merging this PR will improve performance by 11.34%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | benchmark_match_kmer_selection[KmerTable-11*11*1*1***111] |
276.7 µs | 244.7 µs | +13.07% |
| ⚡ | benchmark_match[KmerTable-None] |
327.6 µs | 295.4 µs | +10.92% |
| ⚡ | benchmark_match_kmer_selection[BucketKmerTable(10000)-11*11*1*1***111] |
353.5 µs | 321.2 µs | +10.05% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing padix-key:dssp (137abd5) with v2 (9c84779)
Footnotes
-
14 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
annotate_dssp()tobiotite.structure, a pure Python/NumPy implementation of the DSSP secondary structure assignment in its most recent version (DSSP 4, Hekkelman et al. 2025, based on Kabsch & Sander 1983). This includes the polyproline II helix and the preference of π-helices over α-helices.The implementation is split into two parts:
_find_dssp_hbonds(): Find the backbone hydrogen bonds based on the DSSP electrostatic energy criterion. Candidate residue pairs are found via aCellListand the energies are computed in a vectorized manner. As in DSSP, only the two strongest bonds per N-H donor are kept._assign_dssp_elements(): Assign the secondary structure elements from these hydrogen bonds and the backbone geometry. n-turns, helices, turns, bends and PPII helices are assigned via vectorized shifted masks. Only joining bridges to ladders and merging ladders across β-bulges uses loops, as this logic is inherently sequential (over bridges/ladders, not residues).Changes to
DsspElementAs
annotate_dssp()returnsDsspElementvalues andbiotite.structuremust not depend onbiotite.application,DsspElementis moved frombiotite.application.dssptobiotite.structure. AsDsspElementwas introduced inv2, this does not break any released API.Analogous to
PSeaElement, it obtains aNONEmember (symbol'') for residues that are not amino acids or lack one of the backbone atomsN,CA,CorO.Validation
test_dssp_consistencyrequires an exact match withDsspApp(DSSP 4.6) for all structures intests/structure/data/pdb, covering multiple chains, chain gaps and non-canonical amino acids (9940 residues, no differences).annotate_dssp()takes 1-18 ms for the test structures compared to ~1.4 s forDsspApp, and ~0.13 s for a ribosome (4V6X).Deviation from the original software
In DSSP the amide hydrogen of the first residue after a chain break is placed based on the C=O of the residue before the gap (or even of the previous chain). Here such residues cannot act as hydrogen bond donor instead, as the hydrogen position is undefined. This did not lead to any difference in the tested structures and is documented in the docstring.