欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 会展 > AF3 make_atom14_masks函数解读

AF3 make_atom14_masks函数解读

2025/3/31 17:15:06 来源:https://blog.csdn.net/qq_27390023/article/details/146552426  浏览:    关键词:AF3 make_atom14_masks函数解读

AlphaFold3 data_transforms 模块 make_atom14_masks 函数的作用是为蛋白质的每个氨基酸残基构建一个更密集的原子表示(14个维度而不是37个维度),并生成相应的掩码和映射。这是蛋白质结构预测任务中的一个重要步骤,因为它允许模型专注于更关键的原子,同时忽略一些不太重要的原子,从而提高计算效率和预测精度。

源代码:

def make_atom14_masks(protein):"""Construct denser atom positions (14 dimensions instead of 37)."""restype_atom14_to_atom37 = []restype_atom37_to_atom14 = []restype_atom14_mask = []for rt in rc.restypes:atom_names = rc.restype_name_to_atom14_names[rc.restype_1to3[rt]]restype_atom14_to_atom37.append([(rc.atom_order[name] if name else 0) for name in atom_names])atom_name_to_idx14 = {name: i for i, name in enumerate(atom_names)}restype_atom37_to_atom14.append([(atom_name_to_idx14[name] if name in atom_name_to_idx14 else 0)for name in rc.atom_types])restype_atom14_mask.append([(1.0 if name else 0.0) for name in atom_names])# Add dummy mapping for restype 'UNK'restype_atom14_to_atom37.append([0] * 14)restype_atom37_to_atom14.append([0] * 37)restype_atom14_mask.append([0.0] * 14)restype_atom14_to_atom37 = torch.tensor(restype_atom14_to_atom37,dtype=torch.int32,device=protein["aatype"].device,)restype_atom37_to_atom14 = torch.tensor(restype_atom37_to_atom14,dtype=torch.int32,device=protein["aatype"].device,)restype_atom14_mask = torch.tensor(restype_atom14_mask,dtype=torch.float32,device=protein["aatype"].device,)protein_aatype = protein['aatype'].to(torch.long)# create the mapping for (residx, atom14) --> atom37, i.e. an array# with shape (num_res, 14) containing the atom37 indices for this proteinresidx_atom14_to_atom37 = restype_atom14_to_atom37[protein_aatype]residx_atom14_mask = restype_atom14_mask[protein_aatype]protein["atom14_atom_exists"] = residx_atom14_maskprotein["residx_atom14_to_atom37"] = residx_atom14_to_atom37.long()# create the gather indices for mapping 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词