Linux上安装MGLtools并将pdb文件转为pdbqt文件

文章详细介绍了如何在Linux系统中下载、安装MGLtools,并特别强调了安装过程中对Python解释器的修改,以使用autodocktools将pdb文件转换为pdbqt格式。此外,还提供了一段Python脚本来批量处理pdb文件的转换。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

写在前面:安装MGLtools的目的是为了使用autodocktools中批量.pdb转.pdbqt的功能 


Downloads – mgltools

 下载好,然后放在你的目录下

然后【注意这里你下载的文件名可能为:mgltools_x86_64Linux2_1.5.6.tar_.gz,多了一个_,无所谓直接】

tar -zxvf mgltools_x86_64Linux2_1.5.6.tar_.gz

 cd mgltools_x86_64Linux2_1.5.6/

bash install.sh

mgl的安装位置应该是你当时下载以后解压到的位置:/mnt/d/MGLTools/mgltools_x86_64Linux2_1.5.6/ 

vim ~/.bashrc

使用转.pdbqt的功能:

更改python解释器,这一步必须要做:

也就说相当于使用了他们内置的python解释器,这样你就不用单独再创建一个python2.7解释器了,并且如果你自己创建python27解释器会有很多问题

# 进入脚本文件中修改python编译器
vim $MGL_ROOT/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_receptor4.py

# 更改第一行
#!/usr/bin/env python
->
#!/usr/bin/env $MGL_ROOT/bin/python

使用功能:

pythonsh [yourpath or .]/prepare_receptor4.py -r receptor_filename [options]

代码:

原文用的是ADFR进行转换,我这里用的是MGLtools将pdb转为pdbqt文件

import os
import glob

################
# Usage: prepare_ligand4.py -l filename
    # Description of command...
    #      -l     ligand_filename (.pdb or .mol2 or .pdbq format)
    # Optional parameters:
    #     [-v]    verbose output
    #     [-o pdbqt_filename] (default output filename is ligand_filename_stem + .pdbqt)
    #     [-d]    dictionary to write types list and number of active torsions
    #     [-A]    type(s) of repairs to make:
    #              bonds_hydrogens, bonds, hydrogens (default is to do no repairs)
    #     [-C]    do not add charges (default is to add gasteiger charges)
    #     [-p]    preserve input charges on atom type, eg -p Zn
    #            (default is not to preserve charges on any specific atom type)
    #     [-U]    cleanup type:
    #              nphs_lps, nphs, lps, '' (default is 'nphs_lps')
    #     [-B]    type(s) of bonds to allow to rotate
    #            (default sets 'backbone' rotatable and 'amide' + 'guanidinium' non-rotatable)
    #     [-R]    index for root
    #     [-F]    check for and use largest non-bonded fragment (default is not to do this)
    #     [-M]    interactive (default is automatic output)
    #     [-I]    string of bonds to inactivate composed of
    #                of zero-based atom indices eg 5_13_2_10
    #                will inactivate atoms[5]-atoms[13] bond
    #                            and atoms[2]-atoms[10] bond
    #                   (default is not to inactivate any specific bonds)
    #     [-Z]    inactivate all active torsions
    #                   (default is leave all rotatable active except amide and guanidinium)
    #     [-g]    attach all nonbonded fragments
    #     [-s]    attach all nonbonded singletons:
    #                NB: sets attach all nonbonded fragments too
    #                   (default is not to do this)
################


def pdbs_to_pdbqts(pdb_dir, pdbqt_dir):
    print(glob.glob(os.path.join(pdb_dir, '*.pdb')))
    for file in glob.glob(os.path.join(pdb_dir, '*.pdb')):
        name = os.path.splitext(os.path.basename(file))[0]
        outfile = os.path.join(pdbqt_dir, name + '.pdbqt')
        pdb_to_pdbqt(file, outfile)
        print('Wrote converted file to {}'.format(outfile))


def pdb_to_pdbqt(pdb_file, pdbqt_file):
    os.system('/mnt/d/MGLTools/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/AutoDockTools/Utilities24/prepare_ligand4.py -l {} -o {}'.format(pdb_file, pdbqt_file))
    return pdbqt_file

# prepare ligand for docking
if __name__ == '__main__':
    pdb_dir, pdbqt_dir = 'output_ligand/pdb','output_ligand/pdbqt'
    pdbs_to_pdbqts(pdb_dir, pdbqt_dir)

Linux上安装MGLtools - 知乎

【保姆级】ADFR共价对接 (Covalent Docking) 教程 - 知乎

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Pengsen Ma

太谢谢了

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值