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

AF3 pair_sequences函数解读

AlphaFold3 msa_pairing模块的pair_sequences函数的核心目标是基于 MSA(多序列比对)中的物种信息,在多条链之间建立 MSA 配对索引,从而帮助 AlphaFold3 捕捉共进化信息,提升蛋白复合物预测的准确性。函数pair_sequences 通过调用 _make_msa_df、  _create_species_dict  以及_match_rows_by_sequence_similarity实现其功能。

源代码:

def pair_sequences(
        examples: List[Mapping[str, np.ndarray]],
) -> Dict[int, np.ndarray]:
    """Returns indices for paired MSA sequences across chains."""

    num_examples = len(examples)

    all_chain_species_dict = []
    common_species = set()
    for chain_features in examples:
        msa_df = _make_msa_df(chain_features)
        species_dict = _create_species_dict(msa_df)
        all_chain_species_dict.append(species_dict)
        common_species.update(set(species_dict))

    common_species = sorted(common_species)
    common_species.remove(b'')  # Remove target sequence species.

    all_paired_msa_rows = [np.zeros(len(examples), int)]
    all_paired_msa_rows_dict = {k: [] for k in range(num_examples)}
    all_paired_msa_rows_dict[num_examples] = [np.zeros(len(examples), int)]

    for species in common_species:
        if not species:
            continue
        this_species_msa_dfs = []
        species_dfs_present = 0
        for species_dict in all_chain_species_dict:
            if species in species_dict:
                this_species_msa_dfs.append(species_dict[species])
                species_dfs_present += 1
            else:
                this_species_msa_dfs.append(None)

        # Skip species that are present in only one chain.
        if species_dfs_present <= 1:
            continue

        if np.any(
                np.array([len(species_df) for species_df in
                          this_species_msa_dfs if
                          isinstance(species_df, pd.DataFrame)]) > 600):
            continue

        paired_msa_rows = _match_rows_by_sequence_similarity(this_species_msa_dfs)
        all_paired_msa_rows.extend(paired_msa_rows)
        all_paired_msa_rows_dict[species_dfs_present].extend(paired_msa_rows)
    all_paired_msa_rows_dict = {
        num_examples: np.array(paired_msa_rows) for
        num_examples, paired_msa_rows in all_paired_msa_rows_dict.items()
    }
    return all_paired_msa_rows_dict

代码解读:

函数输入
def pair_sequences(examples: List[Mapping[str, np.ndarray]]) -> Dict[int, np.ndarray]

examples:包含多条链的 MSA 信息,每个元素是一个字典,代表一条蛋白链的 MSA 相关特征。

  • 例如,examples[0] 可能对应链 A 的 MSA 特征,examples[1] 可能对应链 B 的 MSA 特征。
代码执行过程
1️⃣ 提取所有链的 MSA 并构建物种索引
num_examples = len(examples)

all_chain_species_dict = []
common_species = set()
for chain_features in examples:
  

相关文章:

  • 2月27(信息差)
  • Spock框架:让单元测试更优雅的高效武器
  • 【nextjs官方demo】Chapter 6连接数据库报错
  • docker 运行claude 的computer use
  • Linux驱动学习(四)--字符设备注册
  • MySQL练习
  • AI人工智能机器学习之降维和数据压缩
  • 基于W2605C语音识别合成芯片的智能语音交互闹钟方案-AI对话享受智能生活
  • lvgl运行机制分析
  • 车载以太网-基于linux的ICMP协议
  • 决策树(Decision Tree)详细解释(带示例)
  • 精神分裂症患者GAF评分的可视化分析|使用集成学习模型 LightGBM
  • Linux操作系统:基于 Linux 的工业机器人项目设计与实现
  • 【uniapp】在UniApp中实现持久化存储:安卓--生成写入数据为jsontxt
  • python环境打包2 pytorch和cuda的安装逻辑
  • 鸿蒙兼容Mapbox地图应用测试
  • 解决npm run dev报错
  • STM32 微控制器库RCC_OscInitTypeDef结构参数介绍
  • 精通 Fiddler:Web 调试利器的深度探索
  • RabbitMQ系列(七)基本概念之Channel
  • 北京哪家公司做网站/付费推广
  • 株洲网站建设 英铭/怎么制作网站教程
  • dw软件是做什么用的/优化建站seo门户
  • 黄页网址大全/涟源网站seo
  • 如何做企业网站的更新/精准营销的案例
  • 什么是手机网站/网页模板建站系统