Skip to content

Fix base_pairs() missing base pairs with parallel base normals - #1108

Merged
padix-key merged 1 commit into
biotite-dev:mainfrom
padix-key:fix/basepairs-parallel-normals
Nov 28, 2026
Merged

padix-key merged 1 commit into
biotite-dev:mainfrom
padix-key:fix/basepairs-parallel-normals

Conversation

@padix-key

Copy link
Copy Markdown
Member

base_pairs() documents DSSR criterion (iii) as "angle between the base normal vectors <=65°", but _check_dssr_criteria() only accepted pairs whose normal vectors are nearly antiparallel (angle >=115°). Pairs in which both bases share the same face (DSSR's M+N pairs with a positive scalar product of the z-axes, e.g. reverse Watson-Crick and Hoogsteen pairs) were therefore never found. The DSSR paper (Lu et al. 2015, doi:10.1093/nar/gkv716) states the criterion without a direction, so the absolute value of the scalar product is now used. In 1EHZ the G15-C48 Levitt pair and A31-PSU39 are now found.

This is a behaviour change of base_pairs() and of everything built on it (dot_bracket_from_structure(), pseudoknots() input). It is a trade-off: for 1XNR with unique=False, compared to the NDB annotations in tests/structure/data/base_pairs/ (659 reference pairs), the number of reference pairs found rises from 532 to 592, while the pairs not in the reference rise from 70 to 123, i.e. precision drops from 88% to 83%. The additional non-reference pairs are mostly contacts with zero or one base-base hydrogen bond that are admitted by criterion (v).

Changed test references: the expected values in tests/structure/test_dotbracket.py and test_pseudoknots in tests/structure/test_pseudoknots.py are no external data, but the base_pairs() output for 4P5J, so they were regenerated. base_pairs() now finds four more pairs in 4P5J (author numbering): C8-C52, U26-C32, C63-C83 and U12-A50. The first three are listed in the ndb_struct_na_base_pair category of the 4P5J entry; with them all 32 pairs annotated there are found, before the fix 29 of them. U12-A50 is not annotated there, it is a contact between the uracil base and the ribose of A50. Hence basepair_residue_positions has 34 instead of 30 pairs and expected_output 12 instead of 2 dot-bracket strings. In test_pseudoknots there are now 12 instead of 2 optimal solutions: C8-C52 has order 1, the order of A9-G48, G10-C49 and U12-A50 is a permutation of 1, 2 and 3, and either C63-C83 has order 2 or C82-A23(84) has order 1. The assertions of that test had to be restructured for this, as the old ones were written for exactly one pair of alternatives.

Closes #1070

Authored by Claude

@padix-key
padix-key force-pushed the fix/basepairs-parallel-normals branch from 9ed98bd to f0133af Compare November 26, 2026 14:53
@codspeed

codspeed Bot commented Nov 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 111 untouched benchmarks
⏩ 14 skipped benchmarks1


Comparing padix-key:fix/basepairs-parallel-normals (f0133af) with main (82c2f2c)

Open in CodSpeed

Footnotes

  1. 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. ↩

@padix-key
padix-key merged commit c0916d6 into biotite-dev:main Nov 28, 2026
32 of 33 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.

base_pairs(): base pairs with parallel base normals (e.g. trans WC, Hoogsteen) are never found

1 participant