Bio.PDB.Entity 模組

Residue、Chain、Model 和 Structure 類別的基本類別。

它是一個簡單的容器類別,具有類似列表和字典的屬性。

class Bio.PDB.Entity.Entity(id)

基底:Generic[_Parent, _Child]

PDB 層次結構的基本容器物件。

Structure、Model、Chain 和 Residue 是 Entity 的子類別。它處理儲存和查找。

level: str
__init__(id)

初始化類別。

parent: _Parent | None
child_list: list[_Child]
child_dict: dict[Any, _Child]
__len__()

傳回子項的數量。

__getitem__(id)

傳回具有給定 id 的子項。

__delitem__(id)

移除子項。

__contains__(id)

檢查是否存在具有給定 id 的子元素。

__iter__()

迭代處理子項。

__eq__(other)

測試相等性。這會比較包含所有父項 ID 的 full_id。

__ne__(other)

測試不相等性。

__gt__(other)

測試大於。

__ge__(other)

測試大於或等於。

__lt__(other)

測試小於。

__le__(other)

測試小於或等於。

__hash__()

雜湊方法以允許唯一性 (集合)。

property id

傳回識別碼。

strictly_equals(other: _Self, compare_coordinates: bool = False) bool

比較此實體與另一個實體是否相等。

遞迴比較此實體的子項與另一個實體的子項。比較大多數屬性,包括名稱和 ID。

參數:
  • other (Entity) – 要與此實體比較的實體

  • compare_coordinates (bool) – 是否比較原子座標

傳回:

兩個實體是否完全相等

傳回類型:

bool

get_level()

傳回層次結構中的層級。

A - 原子 R - 殘基 C - 鏈 M - 模型 S - 結構

set_parent(entity: _Parent)

設定父 Entity 物件。

detach_parent()

分離父項。

detach_child(id)

移除子項。

add(entity: _Child)

將子項加入 Entity。

insert(pos: int, entity: _Child)

在指定位置將子項加入 Entity。

get_iterator()

傳回子項的迭代器。

get_list()

傳回子項列表的副本。

has_id(id)

檢查是否存在具有給定 id 的子項。

get_parent()

傳回父 Entity 物件。

get_id()

傳回 id。

get_full_id()

傳回完整的 ID。

完整的 ID 是一個元組,包含從頂層物件 (Structure) 一直到目前物件的所有 ID。例如,Residue 物件的完整 ID 看起來會像這樣:

(“1abc”, 0, “A”, (” “, 10, “A”))

這對應到:

ID 為 “1abc” 的 Structure、ID 為 0 的 Model、ID 為 “A” 的 Chain,以及 ID 為 (” “, 10, “A”) 的 Residue。

Residue 的 ID 表示該殘基不是雜原子殘基(或水分子),因為它的雜原子欄位為空白,其序列識別碼為 10,插入碼為 “A”。

transform(rot, tran)

將旋轉和平移套用到原子座標。

參數:
  • rot (3x3 NumPy 陣列) – 右乘旋轉矩陣

  • tran (大小為 3 的 NumPy 陣列) – 平移向量

範例

這是一個不完整但具說明性的範例

from numpy import pi, array
from Bio.PDB.vectors import Vector, rotmat
rotation = rotmat(pi, Vector(1, 0, 0))
translation = array((0, 0, 1), 'f')
entity.transform(rotation, translation)
center_of_mass(geometric=False)

以 NumPy 陣列形式傳回 Entity 的質心。

如果 geometric 為 True,則改為傳回幾何中心。

copy()

遞迴複製實體。

__annotations__ = {'child_dict': dict[typing.Any, ~_Child], 'child_list': list[~_Child], 'level': <class 'str'>, 'parent': typing.Optional[~_Parent]}
__orig_bases__ = (typing.Generic[~_Parent, ~_Child],)
__parameters__ = (~_Parent, ~_Child)
class Bio.PDB.Entity.DisorderedEntityWrapper(id)

基底類別:object

用於將等效實體分組的包裝類別。

此類別是一個簡單的包裝類別,可將多個等效實體分組,並將所有方法呼叫轉發到其中一個(目前選取的物件)。DisorderedResidue 和 DisorderedAtom 是此類別的子類別。

例如:DisorderedAtom 物件包含多個 Atom 物件,其中每個 Atom 物件代表結構中無序原子的特定位置。

__init__(id)

初始化類別。

__getattr__(method)

將方法呼叫轉發到選取的子項。

__getitem__(id)

傳回具有指定 ID 的子項。

__setitem__(id, child)

新增一個與特定 ID 相關聯的子項。

__contains__(id)

檢查子項是否具有給定的 ID。

__iter__()

傳回子項的數量。

__len__()

傳回子項的數量。

__sub__(other)

與另一個物件做減法。

__gt__(other)

如果子項大於另一個,則傳回 True。

__ge__(other)

如果子項大於或等於另一個,則傳回 True。

__lt__(other)

如果子項小於另一個,則傳回 True。

__le__(other)

如果子項小於或等於另一個,則傳回 True。

copy()

遞迴複製無序實體。

get_id()

傳回 id。

strictly_equals(other: DisorderedEntityWrapper, compare_coordinates: bool = False) bool

使用嚴格的相等定義,將此實體與另一個實體進行比較。

遞迴比較此實體的子項與另一個實體的子項。比較大多數屬性,包括選取的子項、名稱和 ID。

參數:
  • other (DisorderedEntityWrapper) – 要與此實體比較的實體

  • compare_coordinates (bool) – 是否比較原子座標

傳回:

兩個實體是否完全相等

傳回類型:

bool

disordered_has_id(id)

檢查是否有與此 ID 關聯的物件存在。

detach_parent()

分離父項。

get_parent()

傳回父物件。

set_parent(parent)

設定物件及其子項的父物件。

disordered_select(id)

選取具有指定 ID 的物件做為目前作用中的物件。

未捕獲的方法呼叫會轉發到選取的子物件。

disordered_add(child)

新增無序的項目。

這是由 DisorderedAtom 和 DisorderedResidue 實作。

disordered_remove(child)

移除無序的條目。

這是由 DisorderedAtom 和 DisorderedResidue 實作。

is_disordered()

回傳 2,表示此實體是一個實體的集合。

disordered_get_id_list()

回傳 ID 的列表。

disordered_get(id=None)

取得與 ID 相關聯的子物件。

如果 ID 為 None,則回傳目前選取的子物件。

disordered_get_list()

回傳子物件的列表。