Module - pdbKit
面向过程的PDB处理模块,允许读取PDB文件为biofkit.proteinKit.Protein类。
0. 导入
from pdbKit.proteinKit import pdbKit
1. 读写PDB文件
Function - readPDB
读取PDB文件,使用biofkit独有的类将蛋白质的各个层次(蛋白、肽链、残基、原子)保存在内存中。
def readPDB(pdbFile: str) -> ProteinClass.Protein:
"""读取PDB文件并以Protein类型操作
参数:
pdbFile (str):PDB文件路径。
输出:
Protein:module proteinClass中的Protein类型。
"""
例:
protein: Protein = pdbKit.readPDB(pdbFile='example.pdb')
Function - pdb2Seq
直接提取PDB文件中的序列信息。输出为一个以ChainId为键,序列为值的字典。也可以输出为fasta文件。
def pdb2Seq(pdbFilePath: str, fastaFilePath: str = '', fastaLineLen: int = 80) -> dict[str, str]
"""提取PDB文件中的序列。
参数:
pdbFilePath (str):PDB文件的路径。
fastaFilePath (str):输出的fasta文件的路径,如果留空则不输出fasta。
fastaLineLen (int):输出的fasta文件一行有多少个氨基酸残基字母。
输出:
dict[str, str]:键为ChainId,值为序列。
"""
例:
seq: dict[str, str] = pdbKit.pdb2Seq(pdbFilePath='example.pdb', fastaFilePath='example.fasta')
Function - writePDB
将Protein类写入PDB文件。
def writePDB(protein: list[Protein], filePath: str, printInfo: bool = True) -> None:
"""写入PDB文件
参数:
protein (Protein): 想要导出为PDB文件的Protein类变量。
filePath (str): 输出的路径。
printInfo (bool): 是否在终端打印信息。
"""
2. 蛋白质处理
Function - assemble
Merge Peptides to generate a Protein.
def assemble(pepList: list[Peptide], name: str = 'Unnamed') -> Protein:
"""整合肽链
参数:
pepList (list[Peptide]): 要整合的肽链列表。
name (str): 新蛋白的名字。
输出:
Protein.
"""
Class - ProteinKit
ProteinKit类提供了一些常用的字典,例如氨基酸残基单字母/三字母缩写转换,在函数中有所使用,通常使用时无需实例化。
Attribute - aaDictTHREE2One: dict[str, str]
全大写氨基酸三字母缩写为键,大写单字母缩写为值。
Attribute - aaDictThree2One: dict[str, str]
首字母大写氨基酸三字母缩写为键,大写单字母缩写为值。
Attribute - aaDictthree2One: dict[str, str]
全小写氨基酸三字母缩写为键,大写单字母缩写为值。
Attribute - aaDictOne2Three: dict[str, str]
大写单字母缩写为键,首字母大写三字母缩写为值。
Attribute - aaDictOne2three: dict[str, str]
大写单字母缩写为键,全小写三字母缩写为值。