Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/biotite/structure/info/atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
__author__ = "Patrick Kunzmann"
__all__ = ["residue"]

import functools
from biotite.structure.info.ccd import get_ccd

# fmt: off
Expand Down Expand Up @@ -75,6 +76,13 @@ def residue(res_name, allow_missing_coord=False):
['CB' 'HB3']
['OXT' 'HXT']]
"""
# Use a cache internally, but always return a copy,
# as the returned AtomArray is mutable
return _residue(res_name, allow_missing_coord).copy()


@functools.lru_cache(maxsize=100)
def _residue(res_name, allow_missing_coord=False):
# Avoid circular import
from biotite.structure.io.pdbx import get_component

Expand Down
Loading