网站兼容视图平台推广方案模板
DataPipeline
类中的 process_pdb
方法用于从 PDB 文件中生成特定蛋白质链的特征,作为 AlphaFold3 预测的输入。它的流程与 process_mmcif
类似,但输入来源是 PDB 文件而非 MmcifObject。
源代码:
def process_pdb(self,pdb_path: str,alignment_dir: str,is_distillation: bool = True,chain_id: Optional[str] = None,_structure_index: Optional[str] = None,alignment_index: Optional[Any] = None,seqemb_mode: bool = False,) -> FeatureDict:"""Assembles features for a protein in a PDB file."""if _structure_index is not None:db_dir = os.path.dirname(pdb_path)db = _structure_index["db"]db_path = os.path.join(db_dir, db)fp = open(db_path, "rb")_, offset, length = _structure_index["files"][0]fp.seek(offset)pdb_str = fp.read(length).decode("utf-8")fp.close()else:with open(pdb_path, 'r') as f:pdb_str = f.read()protein_object = protein.from_pdb_string(pdb_str, chain_id)input_sequence = _aatype_to_str_sequence(protein_object.aatype)description = os.path.splitext(os.path.basename(pdb_path))[0].upper()pdb_feats = make_pdb_features(protein_object,description,is_distillation=is_dist