当前位置: 首页 > news >正文

AF3 unify_template_features 函数解读

AlphaFold3 data_pipeline 模块的 unify_template_features 函数用于将多条链的模板特征整合为一个统一的 FeatureDict,以适应对多链复合物的处理。每条链的模板特征经过索引偏移处理后,拼接为一个完整的模板特征矩阵。

该方法的核心在于:

  1. 序列对齐:根据每条链的长度,将模板特征填充到一个统一的序列矩阵中。
  2. 链索引标记:为每条链的模板特征添加 template_chain_index,标识模板来源的链。
  3. 特征拼接:将所有链的模板特征按模板数量拼接,并生成最终的特征字典。

源代码:

def unify_template_features(template_feature_list: Sequence[FeatureDict]
) -> FeatureDict:out_dicts = []seq_lens = [fd["template_aatype"].shape[1] for fd in template_feature_list]for i, fd in enumerate(template_feature_list):out_dict = {}n_templates, n_res = fd["template_aatype"].shape[:2]for k, v in fd.items():seq_keys = ["template_aatype","template_all_atom_positions","template_all_atom_mask",]if k in seq_keys:new_shape = list(v.shape)assert (new_shape[1] == n_res)new_shape[1] = sum(seq_lens)new_array = np.zeros(new_shape, dtype=v.dtype)if k == "template_aatype":new_array[..., residue_constants.HHBLITS_AA_TO_ID['-']] = 1offset = sum(seq_lens[:i])new_array[:, offset:offset + seq_lens[i]] = vout_dict[k] = new_arrayelse:out_dict[k] = vchain_indices = np.array(n_templates * [i])out_dict["template_chain_index"] = chain_indicesif n_templates != 0:out_dicts.append(out
http://www.lryc.cn/news/542932.html

相关文章:

  • FFmpeg.NET:.NET 平台上的音视频处理利器
  • 解决 Git 合并冲突:当本地修改与远程提交冲突时
  • SOME/IP-SD -- 协议英文原文讲解5
  • spark的一些指令
  • Redis常用数据类型及其应用案例
  • kafka数据拉取和发送
  • LLM全栈框架完整分类清单(预训练+微调+工具链)
  • 蓝桥杯备考:贪心算法之矩阵消除游戏
  • 【Matlab仿真】Matlab Function中如何使用静态变量?
  • DeepSeek 提示词:高效的提示词设计
  • 深入学习Java中的Lambda表达式
  • 1.2 AI 量化炒股的起源与发展
  • 计算机单位之详解——存储单位Byte 网络传输单位bps 视频码率单位bps
  • IDEA关闭SpringBoot程序后仍然占用端口的排查与解决
  • deepseek清华大学第二版 如何获取 DeepSeek如何赋能职场应用 PDF文档 电子档(附下载)
  • 【python随手记】——读取文本文件内容转换为json格式
  • k8s集群3主5从高可用架构(kubeadm方式安装k8s)
  • 基于 sklearn 的均值偏移聚类算法的应用
  • 三、大模型微调的多种方法与应用场景
  • 第2课 树莓派镜像的烧录
  • SQL之order by盲注
  • AI大模型(四)基于Deepseek本地部署实现模型定制与调教
  • java后端开发day19--学生管理系统升级
  • MFC文件和注册表的操作
  • vscode如何使用鼠标滚轮调整字体大小
  • C++之vector和list辨析
  • 冯诺依曼体系结构 ──── linux第8课
  • EX_25/2/22
  • rust安装教程以及git连接到远程仓库
  • Kafka系列之:记录一次源头数据库刷数据,造成数据丢失的原因