LLM生成模型在生物蛋白质应用:ESM3

ops/2024/9/24 1:14:49/

参考:
https://github.com/evolutionaryscale/esm

通过GPT模型原理,输入蛋白质序列等模态输出预测的蛋白质序列及结构
在这里插入图片描述

使用

参考:https://colab.research.google.com/github/evolutionaryscale/esm/blob/main/examples/generate.ipynb#scrollTo=Ta7VVnJLy7Wd

安装:

pip install esm

huggingface下载模型这个需要token:
https://huggingface.co/settings/tokens
在这里插入图片描述

from huggingface_hub import login
from esm.models.esm3 import ESM3
from esm.sdk.api import ESM3InferenceClient, ESMProtein, GenerationConfig# This will prompt you to get an API key from huggingface hub, make one with
# "Read" or "Write" permission and copy it back here.
login()# This will download the model weights and instantiate the model on your machine.
model: ESM3InferenceClient = ESM3.from_pretrained("esm3_sm_open_v1").to("cuda") # or "cpu"# Generate a completion for a partial Carbonic Anhydrase (2vvb)
prompt = "___________________________________________________DQATSLRILNNGHAFNVEFDDSQDKAVLKGGPLDGTYRLIQFHFHWGSLDGQGSEHTVDKKKYAAELHLVHWNTKYGDFGKAVQQPDGLAVLGIFLKVGSAKPGLQKVVDVLDSIKTKGKSADFTNFDPRGLLPESLDYWTYPGSLTTPP___________________________________________________________"
protein = ESMProtein(sequence=prompt)
# Generate the sequence, then the structure. This will iteratively unmask the sequence track.
protein = model.generate(protein, GenerationConfig(track="sequence", num_steps=8, temperature=0.7))
# We can show the predicted structure for the generated sequence.
protein = model.generate(protein, GenerationConfig(track="structure", num_steps=8))
protein.to_pdb("./generation.pdb")
# Then we can do a round trip design by inverse folding the sequence and recomputing the structure
protein.sequence = None
protein = model.generate(protein, GenerationConfig(track="sequence", num_steps=8))
protein.structure = None
protein = model.generate(protein, GenerationConfig(track="structure", num_steps=8))
protein.to_pdb("./round_tripped.pdb")

输入prompt一小段蛋白质序列,模型延迟生成_未知位置的序列
在这里插入图片描述
比如这两端各有3个_需要生成6个token填充_
在这里插入图片描述

再把生成的序列预测结构:

# We can show the predicted structure for the generated sequence.
protein = model.generate(protein, GenerationConfig(track="structure", num_steps=8))
protein.to_pdb("./generation.pdb")

在这里插入图片描述
在这里插入图片描述
蛋白质结构pymol展示:

!pip install py3Dmol
import py3Dmol# First we can create a `py3Dmol` view object
view = py3Dmol.view(width=500, height=500)
# py3Dmol requires the atomic coordinates to be in PDB format, so we convert the `ProteinChain` object to a PDB string
pdb_str = protein.to_pdb_string()
# Load the PDB string into the `py3Dmol` view object
view.addModel(pdb_str, "pdb")
# Set the style of the protein chain
view.setStyle({"cartoon": {"color": "spectrum"}})
# Zoom in on the protein chain
view.zoomTo()
# Display the protein chain
view.show()

在这里插入图片描述


http://www.ppmy.cn/ops/52679.html

相关文章

HarmonyOS应用开发——Hello World

下载 HUAWEI DevEco Studio: https://developer.harmonyos.com/cn/develop/deveco-studio/#download 同意,进入配置页面: 配置下载源以及本地存放路径,包括nodejs和ohpm: 配置鸿蒙SDK路径: 接受协议: 确认无误后&#…

SpringBoot整合Swagger页面如何禁止访问swagger-ui.html

在Spring Boot中禁止访问Swagger UI页面并在拦截器中进行拦截可以通过配置Spring Security来实现。下面是一个简单的示例,演示如何实现这一点: 在Spring Boot项目中创建一个Spring Security配置类,如下所示: import org.springf…

discuz插件之优雅草超级列表互动增强v1.2版本更新

https://doc.youyacao.com/9/2142 v1.2更新 discuz插件之优雅草超级列表互动增强v1.2版本更新 [title]20220617 v1.2发布[/title] 增加了对php8的支持 增加了 对discuz3.5的支持

CAS原理与JUC原子类

一、CAS基本原理 1、Unsafe类 (1)概念及作用:增强Java语言操作底层资源的能力,里面的方法多为native修饰的方法(基于C实现),不建议在代码中使用,不安全。 (2&#xff…

ThreeJS-截屏下载pdf或者图片时白屏

JS-页面截图下载为pdf 关于如何下载为 pdf 在上面的这篇文章中有写,大家可以看下,下载图片代码在最下面 这时我们发现 three 部分是空白的如下: 这就多少有点尴尬了,这时我们习惯性的看下后台报错 是不是发现了惊喜,…

数据收集和数据分析

数据分析和收集是一个多步骤的过程,涉及到不同的方法和思维构型。 以下是一些常见的数据收集方法和数据分析的思维模式: ### 数据收集方法: 1. **调查问卷**: 通过设计问卷来收集定量或定性数据。(质量互变规律里面…

模板方法模式和命令模式

文章目录 模板方法模式1.引出模板模式1.豆浆制作问题2.基本介绍3.原理类图 2.豆浆制作代码实现1.类图2.SoyaMilk.java 豆浆的抽象类3.PeanutSoyaMilk.java 花生豆浆4.RedBeanSoyaMilk.java 红豆豆浆5.Client.java6.结果 3.钩子方法1.基本介绍2.代码实现1.SoyaMilk.java 添加钩子…

mysql数据库管理

查看数据库结构 Mysql是一套数据库管理系统,在每台Mysql服务器中,支持运行多个数据库每一个数据库相当一个容器 1:查看数据库结构 [rootlocalhost ~]# mysql -u root -ppwd123mysql> show databases;mysql> use mysqlmysql> show…