HTMD: 一个针对分子的可编程环境

HTMD是一个针对分子的可编程环境,用于准备、处理、模拟、可视化和分析分子系统。HTMD是基于Python的,所以研究者可以很容易地根据他们的需要进行扩展。使用HTMD,只需几行就可以完成非常复杂的protocols。

在一个脚本中,可以计划整个computational experiment,从操作PDBs,建立、执行和分析模拟,计算马尔可夫状态模型、动力学速率、亲和力和路径。

在HTMD中,你首先要熟悉的是Molecule类。

Molecule储存着结构信息,不仅仅包含一个单一的分子,也包含整个系统,包括水、离子、蛋白质、配体、脂类等。把这些对象看作是结构信息的容器。

在HTMD中,有几个子模块,导入最重要的子模块:

from htmd.ui import *

Reading files

Molecule类提供了各种结构格式的文件阅读器,如PDB, PRMTOP, PSF, GRO, MOL2, MAE等等。它还能够读取各种MD轨迹和坐标格式,包括XTC、DCD、COOR、CRD、TRR、XYZ等。

读取文件的方法是Molecule.read(),然而你也可以在类的构造函数中指定文件名,它将自动调用read()。例子:

mol = Molecule('3PTB')

读取本地文件的例子:

mol = Molecule('localprotein.pdb')

PDB文件同时包含原子信息和坐标。其他一些格式将原子信息和坐标分开。在这种情况下,你可以先从PSF文件中读取原子信息,然后像下一个例子那样使用Molecule的读取方法读取原子坐标。你也可以按相反的顺序读取,用XTC创建Molecule,然后再读取PSF。

mol = Molecule('localstructure.psf')
mol.read('localtrajectory.xtc')

Writing files

Molecule类还使用Molecule.write()方法为多种格式提供file writers。

mol.write('localtrajectory.dcd')
mol.write('localstructure.prmtop')

Looking inside a Molecule

Printing the Molecule object shows its properties: 

print(mol)
Molecule with 1701 atoms and 1 frames
Atom field - altloc shape: (1701,)
Atom field - atomtype shape: (1701,)
Atom field - beta shape: (1701,)
Atom field - chain shape: (1701,)
Atom field - charge shape: (1701,)
Atom field - coords shape: (1701, 3, 1)
Atom field - element shape: (1701,)
Atom field - insertion shape: (1701,)
Atom field - masses shape: (1701,)
Atom field - name shape: (1701,)
Atom field - occupancy shape: (1701,)
Atom field - record shape: (1701,)
Atom field - resid shape: (1701,)
Atom field - resname shape: (1701,)
Atom field - segid shape: (1701,)
Atom field - serial shape: (1701,)
angles shape: (0, 3)
bonds shape: (42, 2)
bondtype shape: (42,)
box shape: (3, 1)
boxangles shape: (3, 1)
crystalinfo: {'a': 54.890000000000001, 'b': 58.520000000000003, 'c': 67.629999999999995, 'alpha': 90.0, 'beta': 90.0, 'gamma': 90.0, 'sGroup': ['P', '21', '21', '21'], 'z': 4, 'numcopies': 4, 'rotations': array([[[ 1.,  0.,  0.],
        [ 0.,  1.,  0.],
        [ 0.,  0.,  1.]],

       [[-1.,  0.,  0.],
        [ 0., -1.,  0.],
        [ 0.,  0.,  1.]],

       [[-1.,  0.,  0.],
        [ 0.,  1.,  0.],
        [ 0.,  0., -1.]],

       [[ 1.,  0.,  0.],
        [ 0., -1.,  0.],
        [ 0.,  0., -1.]]]), 'translations': array([[  0.   ,   0.   ,   0.   ],
       [ 27.445,   0.   ,  33.815],
       [  0.   ,  29.26 ,  33.815],
       [ 27.445,  29.26 ,   0.   ]])}
dihedrals shape: (0, 4)
fileloc shape: (1, 2)
impropers shape: (0, 4)
reps:
ssbonds shape: (0,)
step shape: (1,)
time shape: (1,)
topoloc: 3PTB
viewname: 3PTB

Obviously there is a great deal of structural information available. 

Properties can be accessed, 

  • either directly: 

mol.serial
array([   1,    2,    3, ..., 1700, 1701, 1702])
  • via the Molecule.get method: 

mol.get('serial')
array([   1,    2,    3, ..., 1700, 1701, 1702])

To get help on a particular method of the Molecule() class, one can do: 

help(Molecule.get)
Help on function get in module moleculekit.molecule:

get(self, field, sel=None)
    Retrieve a specific PDB field based on the selection

    Parameters
    ----------
    field : str
        The PDB field we want to get
    sel : str
        Atom selection string for which atoms we want to get the field from. Default all.
        See more here

    Returns
    ------
    vals : np.ndarray
        Array of values of field for all atoms in the selection.

    Examples
    --------
    >>> mol=tryp.copy()
    >>> mol.get('resname')
    array(['ILE', 'ILE', 'ILE', ..., 'HOH', 'HOH', 'HOH'], dtype=object)
    >>> mol.get('resname', sel='resid 158')
    array(['LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU'], dtype=object)

Properties and methods of Molecule objects

Properties

Methods

record

read( )

serial

write( )

name

get( )

resname

set( )

chain

atomselect( )

resid

copy( )

segid

filter( )

coords

append( )

box

insert( )

reps

view( )

moveBy( )

rotateBy( )

参考来源:HTMD — Acellera documentation

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值