Module - proteinClass
蛋白相关的类文件,包含Atom
,Residue
,Peptide
和Protein
四个层次。
0. 导入
# 单独导入
from biofkit.proteinKit import proteinClass
# 随pdbKit一同导入
from biofkit.proteinKit import pdbKit
1. Class - Atom
Atom(serial: int, atom: str, x: float, y: float, z: float)
Attributes
- serial (int): 原子的序号(如在PDB文件中的标号)。
- atom (str): 原子的类型。
- x (float): X轴坐标。
- y (float): Y轴坐标。
- z (float): Z轴坐标。
Public Method - getCoord
获得该原子的坐标,返回一个长度为3的坐标字典,对应X,Y,Z。
def getCoord(self) -> dict[str, float]:
"""获取原子坐标。
输出:
dict[str, float]: 坐标字典
"""
例子:
eAtom: Atom = Atom(0, 'CA', 0., 0., 0.)
eAtom.getCoord()
2. Class - Residue
Residue(atomList: list[Atom], resSeq: int = 0, resName: str = '*')
Attributes
- resSeq (int): 残基的标号。
- resName (str): 残基的类型。
- atomSet (list[Atom]): 这个残基所有原子组成的列表。
Public Method - getName
获得该残基的类型,即氨基酸类型。
def getName(self) -> str:
"""获取残基类型。
输出:
str: 残基的类型。
"""
3. Class - Peptide
Peptide(resList: list[Residue], chainId: str = 'A')
Attributes
- chainId (str): 链的ID。
- resSet (list[Residue]): 这条肽链的所有氨基酸残基组成的列表。
Public Method - getChainId
获取链的ID。
def getChainId(self) -> str:
"""获取肽链的ID。
输出:
str: 肽链的ID。
"""
Public Method - cut
取肽链的部分,返回一个新的肽链。
def cut(self, end: int, beginning: int = 0, newChainId: str = 'X') -> Peptide:
"""取开始和结束之间的肽链残基子集,索引从0开始
参数:
end (int): 结尾的索引。
beginning (int): 起始的索引,默认是0。
newChainId (int): 新肽链的名称,默认是X。
输出:
Peptide: 一条新的肽链。
"""
4. Class - Protein
Protein(pepList: list[Peptide], proteinName: str = 'Unnamed')
Attributes
- name (str): 蛋白的名称。
- pepSet (list[Peptide]): 肽链的列表。
Public Method - pick
从Protein
中提取特定的肽链。
def pick(self, chainId: list[str]) -> list[Peptide]:
"""从Protein中提取特定的肽链。
参数:
chainId (list[str]): 要提取肽链的ID。
输出:
list[Peptide]: 所有符合ID的肽链的列表。
"""
Public Method - select
从Protein
中提取特定的肽链并作为新的Protein
创建。
def select(self, chainId: list[str]) -> Protein:
"""从Protein中提取特定的肽链并创建Protein.
参数:
chainId (list[str]): 要提取肽链的ID。
输出:
Protein: 新的包含目标肽链的Protein类。