阅读: 2023/4/17 16:16:38
ent--><
作者 / 七八分
公众号 / 叮当学术
今天在GitHub上看到了一个PyMOL的ChatGPT插件,可将OpenAI 的 GPT-3.5-turbo 模型集成到 PyMOL 中,方便我们在PyMOL中使用ChatGPT获取PyMOL的使用方法、解释等,再也不用担心记不住PyMOL的命令啦~???
项目地址:
https://github.com/JinyuanSun/ChatMol
下面笔者为大家介绍该插件的安装和使用方法。
1??首先,下载插件脚本“chatmol.py”,并将其保存在任意合适的位置,下载地址如下:
https://github.com/JinyuanSun/ChatMol/blob/main/chatmol.py
2??安装OpenAI的Python包
pip install openai
3??在PyMOL中运行ChatGPT
打开PyMOL,在命令行输入:
run /path/to/chatmol.py
注:需要替换/path/to为脚本的实际路径
插件安装完成后,还需要设置一下Open AI的API密钥,密钥的获取方法笔者在之前的笔记中已经分享过了,需要的小伙伴可以翻看以前的笔记或者自行搜索一下。设置密钥时,在PyMOL的命令行输入以下命令:
set_api_key your_api_key_here
注:以上命令中需要替换your_api_key_here为自己实际的API 密钥。
配置好后就可以在PyMOL中使用ChatGPT了,只需使用“chatgpt”命令,后面跟上提问的问题就可以了。比如:
chatgpt "How do I align two proteins?"
可得到回答:
ChatGPT: To align two proteins in PyMOL, you can use the `align` command. This command aligns two structures based on their alpha-carbon atoms. Here's an example code snippet that demonstrates how to align two proteins:
```
# Fetch two proteins
fetch 1ake, async=0
fetch 1tim, async=0
# Align the two proteins
align 1ake, 1tim
# Visualize the aligned proteins
show cartoon
color red, 1ake
color blue, 1tim
```
In this example, we first fetch two proteins (`1ake` and `1tim`) using the `fetch` command. Then, we use the `align` command to align the two proteins. Finally, we visualize the aligned proteins using the `show` and `color` commands.
Note that the `align` command requires that the two proteins have the same number of alpha-carbon atoms. If the two proteins have different numbers of alpha-carbon atoms, you can use the `fit` command instead. The `fit` command aligns two structures based on their entire backbone atoms.
也可以让ChatMol代码按照您的命令自动运行,只需加入“,True”即可。如:
chatgpt How do I color a protein by secondary structure?, True
如果不想每次打开PyMOL都运行一次脚本,可以将运行命令写入PyMOL 的启动脚本中,即编辑 PyMOL 启动时加载的配置文件。这个配置文件通常是 /.pymolrc文件,具体步骤如下:
在PyMOL的菜单栏点击File -> Edit pymolrc,然后输入以下内容:
run E:\Directory\PyMOL\Script\chatmol.py
注:E:\Directory\PyMOL\Script\chatmol.py为笔者chatmol.py脚本所在的路径,大家编辑时需要更改为自己的路径。
配置完成后,再次打开PyMOL就可以直接使用ChatGPT了,也无需再次输入API。
转自:“叮当学术”微信公众号
如有侵权,请联系本站删除!
上一篇:【学术会议】Academic.net推荐:2023年第七届深度学习技术国际会议 (ICDLT 2023)
下一篇:干货|ROC曲线原理