- Biopython 教程
- Biopython - 首頁
- Biopython - 簡介
- Biopython - 安裝
- 建立簡單應用
- Biopython - 序列
- 高階序列操作
- 序列 I/O 操作
- Biopython - 序列比對
- Biopython - BLAST 概述
- Biopython - Entrez 資料庫
- Biopython - PDB 模組
- Biopython - 基序物件
- Biopython - BioSQL 模組
- Biopython - 群體遺傳學
- Biopython - 基因組分析
- Biopython - 表型微陣列
- Biopython - 繪圖
- Biopython - 聚類分析
- Biopython - 機器學習
- Biopython - 測試技術
- Biopython 資源
- Biopython - 快速指南
- Biopython - 有用資源
- Biopython - 討論
Biopython - PDB 模組
Biopython 提供 Bio.PDB 模組來處理多肽結構。PDB(蛋白質資料庫)是最大的線上蛋白質結構資源。它包含大量不同的蛋白質結構,包括蛋白質-蛋白質、蛋白質-DNA、蛋白質-RNA 複合物。
為了載入 PDB,鍵入以下命令:
from Bio.PDB import *
蛋白質結構檔案格式
PDB 以三種不同的格式分發蛋白質結構:
- 基於 XML 的檔案格式,Biopython 不支援該格式
- pdb 檔案格式,這是一種特殊格式的文字檔案
- PDBx/mmCIF 檔案格式
蛋白質資料庫分發的 PDB 檔案可能包含格式錯誤,這些錯誤使它們變得模稜兩可或難以解析。Bio.PDB 模組嘗試自動處理這些錯誤。
Bio.PDB 模組實現了兩種不同的解析器,一種是 mmCIF 格式,另一種是 pdb 格式。
讓我們詳細瞭解如何解析每種格式:
mmCIF 解析器
讓我們使用以下命令從 pdb 伺服器下載 mmCIF 格式的示例資料庫:
>>> pdbl = PDBList()
>>> pdbl.retrieve_pdb_file('2FAT', pdir = '.', file_format = 'mmCif')
這將從伺服器下載指定的檔案 (2fat.cif),並將其儲存在當前工作目錄中。
這裡,PDBList 提供了列出和下載線上 PDB FTP 伺服器上檔案的選項。retrieve_pdb_file 方法需要下載的檔名(不帶副檔名)。retrieve_pdb_file 還可以選擇指定下載目錄 pdir 和檔案格式 file_format。檔案格式的可能值如下:
- “mmCif”(預設,PDBx/mmCif 檔案)
- “pdb”(PDB 格式)
- “xml”(PMDML/XML 格式)
- “mmtf”(高度壓縮)
- “bundle”(用於大型結構的 PDB 格式存檔)
要載入 cif 檔案,請使用 Bio.MMCIF.MMCIFParser,如下所示:
>>> parser = MMCIFParser(QUIET = True)
>>> data = parser.get_structure("2FAT", "2FAT.cif")
這裡,QUIET 在解析檔案期間抑制警告。**get_structure 將解析檔案並返回 id 為 2FAT 的結構**(第一個引數)。
執行上述命令後,它將解析檔案並列印可能的警告(如果存在)。
現在,使用以下命令檢查結構:
>>> data <Structure id = 2FAT> To get the type, use type method as specified below, >>> print(type(data)) <class 'Bio.PDB.Structure.Structure'>
我們已成功解析檔案並獲得了蛋白質的結構。我們將在後面的章節中學習蛋白質結構的詳細資訊以及如何獲取它。
PDB 解析器
讓我們使用以下命令從 pdb 伺服器下載 PDB 格式的示例資料庫:
>>> pdbl = PDBList()
>>> pdbl.retrieve_pdb_file('2FAT', pdir = '.', file_format = 'pdb')
這將從伺服器下載指定的檔案 (pdb2fat.ent),並將其儲存在當前工作目錄中。
要載入 pdb 檔案,請使用 Bio.PDB.PDBParser,如下所示:
>>> parser = PDBParser(PERMISSIVE = True, QUIET = True)
>>> data = parser.get_structure("2fat","pdb2fat.ent")
這裡,get_structure 與 MMCIFParser 類似。PERMISSIVE 選項嘗試儘可能靈活地解析蛋白質資料。
現在,使用以下程式碼片段檢查結構及其型別:
>>> data <Structure id = 2fat> >>> print(type(data)) <class 'Bio.PDB.Structure.Structure'>
好的,標題結構儲存字典資訊。要執行此操作,請鍵入以下命令:
>>> print(data.header.keys()) dict_keys([ 'name', 'head', 'deposition_date', 'release_date', 'structure_method', 'resolution', 'structure_reference', 'journal_reference', 'author', 'compound', 'source', 'keywords', 'journal']) >>>
要獲取名稱,請使用以下程式碼:
>>> print(data.header["name"]) an anti-urokinase plasminogen activator receptor (upar) antibody: crystal structure and binding epitope >>>
您還可以使用以下程式碼檢查日期和解析度:
>>> print(data.header["release_date"]) 2006-11-14 >>> print(data.header["resolution"]) 1.77
PDB 結構
PDB 結構由單個模型組成,包含兩條鏈。
- 鏈 L,包含一定數量的殘基
- 鏈 H,包含一定數量的殘基
每個殘基由多個原子組成,每個原子都有一個由 (x, y, z) 座標表示的 3D 位置。
讓我們在以下部分詳細瞭解如何獲取原子的結構:
模型
Structure.get_models() 方法返回模型的迭代器。它定義如下:
>>> model = data.get_models() >>> model <generator object get_models at 0x103fa1c80> >>> models = list(model) >>> models [<Model id = 0>] >>> type(models[0]) <class 'Bio.PDB.Model.Model'>
這裡,模型準確描述了一種 3D 構象。它包含一個或多個鏈。
鏈
Model.get_chain() 方法返回鏈的迭代器。它定義如下:
>>> chains = list(models[0].get_chains()) >>> chains [<Chain id = L>, <Chain id = H>] >>> type(chains[0]) <class 'Bio.PDB.Chain.Chain'>
這裡,鏈描述了一個正確的多肽結構,即一系列連續結合的殘基。
殘基
Chain.get_residues() 方法返回殘基的迭代器。它定義如下:
>>> residue = list(chains[0].get_residues()) >>> len(residue) 293 >>> residue1 = list(chains[1].get_residues()) >>> len(residue1) 311
好的,殘基包含屬於氨基酸的原子。
原子
Residue.get_atom() 返回原子的迭代器,定義如下:
>>> atoms = list(residue[0].get_atoms()) >>> atoms [<Atom N>, <Atom CA>, <Atom C>, <Atom Ov, <Atom CB>, <Atom CG>, <Atom OD1>, <Atom OD2>]
原子儲存原子的 3D 座標,稱為向量。它定義如下
>>> atoms[0].get_vector() <Vector 18.49, 73.26, 44.16>
它表示 x、y 和 z 座標值。