{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# Getting started with HTMD Molecules" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "-" } }, "source": [ "Assuming that you have already downloaded and installed **HTMD**, this tutorial introduces you to the software, specially into the `Molecule` class, whose features serve as a good introduction for the more complex features of HTMD." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Let's get started! The first thing you will have to get familiar with in HTMD is the [Molecule](https://www.htmd.org/docs/latest/htmd.molecule.molecule.html) class.\n", "* Objects of this class are meant to *store structural information on molecules*.\n", "* Despite it's name, a `Molecule` object does not only contain a single molecule. \n", " * Instead, similar to [VMD](http://www.ks.uiuc.edu/Research/vmd/) (a visualization software we also use in HTMD), a `Molecule` object can also contain a whole system including water, ions, proteins, ligands, lipids etc.\n", "* Think of it as a container of structural information." ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "First, we need to import HTMD, so that any class and function defined by HTMD is available in the workspace:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from htmd.ui import *" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Reading files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The [Molecule](https://www.htmd.org/docs/latest/htmd.molecule.molecule.html) class provides file readers for various structure formats like PDB, PRMTOP, PSF, GRO, MOL2, MAE and more. It is also able to read various MD trajectory and coordinate formats including XTC, DCD, COOR, CRD, TRR, XYZ etc.\n", "The method for reading files is [Molecule.read()](https://www.htmd.org/docs/latest/htmd.molecule.molecule.html#htmd.molecule.molecule.Molecule.read), however you can also specify the file name in the class constructor and it will automatically call `read()`.\n", "Let's see an example:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "mol = Molecule('3PTB')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "or just use a local file:\n", "\n", " mol = Molecule('yourprotein.pdb')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "PDB files contain both atom information and coordinates. Some other formats separate the atom information from the coordinates. \n", "In that case you can start for example by reading atom information from a PSF file and then read atom coordinates using the `read` method of `Molecule` as in the next example.\n", "You could also read them in reverse order, creating the `Molecule` using the XTC and then reading the PSF (it would not matter).\n", "\n", " mol = Molecule('yourstructure.psf')\n", " mol.read('yourtrajectory.xtc')" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2016-10-10T13:53:29.811236", "start_time": "2016-10-10T13:53:29.806944" }, "slideshow": { "slide_type": "slide" } }, "source": [ "## Writing files\n", "\n", "The `Molecule` class also provides file writers for multiple formats using the [Molecule.write()](https://www.htmd.org/docs/latest/htmd.molecule.molecule.html#htmd.molecule.molecule.Molecule.write) method.\n", "\n", " mol.write('yourtrajectory.dcd')\n", " mol.write('yourstructure.prmtop')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Looking inside a Molecule" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "-" } }, "source": [ "Printing the `Molecule` object shows its properties:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "slideshow": { "slide_type": "-" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Molecule with 1701 atoms and 1 frames\n", "Atom field - altloc shape: (1701,)\n", "Atom field - atomtype shape: (1701,)\n", "Atom field - beta shape: (1701,)\n", "Atom field - chain shape: (1701,)\n", "Atom field - charge shape: (1701,)\n", "Atom field - coords shape: (1701, 3, 1)\n", "Atom field - element shape: (1701,)\n", "Atom field - insertion shape: (1701,)\n", "Atom field - masses shape: (1701,)\n", "Atom field - name shape: (1701,)\n", "Atom field - occupancy shape: (1701,)\n", "Atom field - record shape: (1701,)\n", "Atom field - resid shape: (1701,)\n", "Atom field - resname shape: (1701,)\n", "Atom field - segid shape: (1701,)\n", "Atom field - serial shape: (1701,)\n", "angles shape: (0, 3)\n", "bonds shape: (42, 2)\n", "box shape: (3, 1)\n", "boxangles shape: (3, 1)\n", "crystalinfo: {'beta': 90.0, 'c': 67.629999999999995, 'translations': array([[ 0. , 0. , 0. ],\n", " [ 27.445, 0. , 33.815],\n", " [ 0. , 29.26 , 33.815],\n", " [ 27.445, 29.26 , 0. ]]), 'z': 4, 'b': 58.520000000000003, 'rotations': array([[[ 1., 0., 0.],\n", " [ 0., 1., 0.],\n", " [ 0., 0., 1.]],\n", "\n", " [[-1., 0., 0.],\n", " [ 0., -1., 0.],\n", " [ 0., 0., 1.]],\n", "\n", " [[-1., 0., 0.],\n", " [ 0., 1., 0.],\n", " [ 0., 0., -1.]],\n", "\n", " [[ 1., 0., 0.],\n", " [ 0., -1., 0.],\n", " [ 0., 0., -1.]]]), 'alpha': 90.0, 'gamma': 90.0, 'numcopies': 4, 'a': 54.890000000000001, 'sGroup': ['P', '21', '21', '21']}\n", "dihedrals shape: (0, 4)\n", "fileloc shape: (1, 2)\n", "fstep: None\n", "impropers shape: (0, 4)\n", "reps: \n", "ssbonds shape: (0,)\n", "step shape: (0,)\n", "time shape: (0,)\n", "topoloc: /data/joao/maindisk/software/repos/Acellera/htmd/tutorials/3PTB\n", "viewname: 3PTB\n" ] } ], "source": [ "print(mol)" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Properties and methods of `Molecule` objects" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each `Molecule` object has a number of **properties** (data associated to the molecule) and **methods** (operations that you can perform on the molecule). Some of the properties correspond to data which is usually found in PDB files.\n", "\n", "| Properties |Methods |\n", "|:----------:|:-----------:|\n", "|record |read( ) |\n", "|serial |write( ) |\n", "|name |get( ) |\n", "|resname |set( ) |\n", "|chain |atomselect( )|\n", "|resid |copy( ) |\n", "|segid |filter( ) |\n", "|coords |append( ) |\n", "|box |insert( ) |\n", "|reps |view( ) |\n", "|... |moveBy( ) |\n", "| |rotateBy( ) |\n", "| |... |" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Properties can be accessed,\n", "\n", "* either directly:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ 1, 2, 3, ..., 1700, 1701, 1702])" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mol.serial" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "or,\n", "\n", "* via the `Molecule.get` method:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ 1, 2, 3, ..., 1700, 1701, 1702])" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mol.get('serial')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To get help on the `Molecule()` class, do:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on class Molecule in module htmd.molecule.molecule:\n", "\n", "class Molecule(builtins.object)\n", " | Class to manipulate molecular structures.\n", " | \n", " | Molecule contains all the fields of a PDB and it is independent of any force field. It can contain multiple\n", " | conformations and trajectories, however all operations are done on the current frame. The following PDB fields \n", " | are accessible as attributes (record, serial, name, altloc, resname, chain, resid, insertion, coords,\n", " | occupancy, beta, segid, element, charge). The coordinates are accessible via the coords attribute \n", " | ([number of atoms x 3 x number of frames] where [x,y,z] are the second dimension.\n", " | \n", " | Parameters\n", " | ----------\n", " | filename : str\n", " | Optionally load a PDB file from the specified file. If there's no file and the value is four characters long\n", " | assume it is a PDB accession code and try to download from the RCSB web server.\n", " | name : str\n", " | Give a name to the Molecule that will be used for visualization\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol = Molecule( './test/data/dhfr/dhfr.pdb' ) # doctest: +SKIP\n", " | >>> mol = Molecule( '3PTB', name='Trypsin' )\n", " | >>> print(mol) # doctest: +ELLIPSIS\n", " | Molecule with 1701 atoms and 1 frames\n", " | PDB field - altloc shape: (1701,)\n", " | PDB field - beta shape: (1701,)\n", " | ...\n", " | \n", " | .. currentmodule:: htmd.molecule.molecule.Molecule\n", " | .. rubric:: Methods\n", " | .. autoautosummary:: htmd.molecule.molecule.Molecule\n", " | :methods:\n", " | .. rubric:: Attributes\n", " | .. autoautosummary:: htmd.molecule.molecule.Molecule\n", " | :attributes:\n", " | \n", " | Attributes\n", " | ----------\n", " | \n", " | box : np.ndarray\n", " | Box dimensions of the simulation.\n", " | charge : np.ndarray\n", " | Charges read from prmtop or psf files.\n", " | masses : np.ndarray\n", " | Masses read from prmtop or psf files.\n", " | frame : int\n", " | The current frame. Atomselections and get commands will be calculated on this frame.\n", " | fileloc : list\n", " | The location of the files used to read this Molecule\n", " | time : list\n", " | The time for each frame of the simulation\n", " | step : list\n", " | The step for each frame of the simulation\n", " | reps : :class:`Representations` object\n", " | A list of representations that is used when visualizing the molecule\n", " | viewname : str\n", " | The name used for the molecule in the viewer\n", " | angles : np.ndarray\n", " | Angle terms, valid only if PSF read and molecule unmodified\n", " | dihedrals : np.ndarray\n", " | Dihedral terms, valid only if PSF read and molecule unmodified\n", " | impropers : np.ndarray\n", " | Improper terms, valid only if PSF read and molecule unmodified\n", " | atomtype : np.ndarray\n", " | Atom types, valid only if PSF read and molecule unmodified\n", " | \n", " | Methods defined here:\n", " | \n", " | __init__(self, filename=None, name=None)\n", " | Initialize self. See help(type(self)) for accurate signature.\n", " | \n", " | __repr__(self)\n", " | Return repr(self).\n", " | \n", " | __str__(self)\n", " | Return str(self).\n", " | \n", " | align(self, sel, refmol=None, refsel=None, frames=None)\n", " | Align the molecule to a reference structure\n", " | \n", " | Parameters\n", " | ----------\n", " | sel : str\n", " | Atom selection string\n", " | refmol : :class:`Molecule`, optional\n", " | Optionally pass a reference Molecule on which to align. If none is given it will align on the first frame of the same Molecule\n", " | refsel : str, optional\n", " | An atom selection for the reference Molecule if one is given. Default: same as `sel`\n", " | frames : list or range\n", " | A list of frames which to align. By default it will align all frames of the Molecule\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.align('protein')\n", " | >>> mol.align('name CA', refmol=Molecule('3PTB'))\n", " | \n", " | append(self, mol, collisions=False, coldist=1.3)\n", " | Append a molecule at the end of the current molecule\n", " | \n", " | Parameters\n", " | ----------\n", " | mol : :class:`Molecule`\n", " | Target Molecule which to append to the end of the current Molecule\n", " | collisions : bool\n", " | If set to True it will remove residues of `mol` which collide with atoms of this Molecule object.\n", " | coldist : float\n", " | Collision distance in Angstrom between atoms of the two molecules. Anything closer will be considered a collision.\n", " | \n", " | Example\n", " | -------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.filter(\"not resname BEN\")\n", " | >>> lig=tryp.copy()\n", " | >>> lig.filter(\"resname BEN\")\n", " | >>> mol.append(lig)\n", " | \n", " | atomselect(self, sel, indexes=False, strict=False, fileBonds=True, guessBonds=True)\n", " | Select a set of atoms based on a selection text\n", " | \n", " | Parameters\n", " | ----------\n", " | sel : str\n", " | Text selection, e.g. 'name CA'. See VMD atomselect for documentation.\n", " | indexes : bool\n", " | If True returns the indexes instead of a bitmap\n", " | strict: bool\n", " | If True it will raise an error if no atoms were selected.\n", " | fileBonds : bool\n", " | If True will use bonds read from files.\n", " | guessBonds : bool\n", " | If True will use guessed bonds.\n", " | \n", " | Return\n", " | ------\n", " | asel : np.ndarray\n", " | Either a bitmap of selected atoms or their indexes\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.atomselect('resname MOL')\n", " | array([False, False, False, ..., False, False, False], dtype=bool)\n", " | \n", " | center(self, loc=(0, 0, 0), sel='all')\n", " | Moves the geometric center of the Molecule to a given location\n", " | \n", " | Parameters\n", " | ----------\n", " | loc : list, optional\n", " | The location to which to move the geometric center\n", " | sel : str\n", " | An Atomselection string of the atoms whose geometric center we want to center on the `loc` position\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.center()\n", " | >>> mol.center([10, 10, 10], 'name CA')\n", " | \n", " | copy(self)\n", " | Create a copy of the molecule object\n", " | \n", " | Returns\n", " | -------\n", " | newmol : :class:`Molecule`\n", " | A copy of the object\n", " | \n", " | dropFrames(self, keep='all', drop=None)\n", " | Removes trajectory frames from the Molecule\n", " | \n", " | Parameters\n", " | ----------\n", " | keep : int or list of ints\n", " | Index of frame, or list of frame indexes which we want to keep (and drop all others).\n", " | drop : int or list of ints\n", " | Index of frame, or list of frame indexes which we want to drop (and keep all others).\n", " | \n", " | empty(self, numAtoms)\n", " | Creates an empty molecule of N atoms.\n", " | \n", " | Parameters\n", " | ----------\n", " | numAtoms : int\n", " | Number of atoms to create in the molecule.\n", " | \n", " | Example\n", " | -------\n", " | >>> newmol = Molecule()\n", " | >>> newmol.empty(100)\n", " | \n", " | filter(self, sel, _logger=True)\n", " | Removes all atoms not included in the atomselection\n", " | \n", " | Parameters\n", " | ----------\n", " | sel: str\n", " | Atom selection text\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.filter('protein')\n", " | \n", " | get(self, field, sel=None)\n", " | Retrieve a specific PDB field based on the selection\n", " | \n", " | Parameters\n", " | ----------\n", " | field : str\n", " | The PDB field we want to get\n", " | sel : str\n", " | Atom selection string selecting which atoms we want to get the field from. Default all.\n", " | \n", " | Returns\n", " | ------\n", " | vals : np.ndarray\n", " | Array of values of `field` for all atoms in the selection.\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.get('resname')\n", " | array(['ILE', 'ILE', 'ILE', ..., 'HOH', 'HOH', 'HOH'], dtype=object)\n", " | >>> mol.get('resname', sel='resid 158')\n", " | array(['LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU', 'LEU'], dtype=object)\n", " | \n", " | insert(self, mol, index, collisions=False, coldist=1.3)\n", " | Insert the contents of one molecule into another at a specific index.\n", " | \n", " | Parameters\n", " | ----------\n", " | mol : :class:`Molecule`\n", " | Molecule to be inserted\n", " | index : integer\n", " | The atom index at which the passed molecule will be inserted\n", " | collisions : bool\n", " | If set to True it will remove residues of `mol` which collide with atoms of this Molecule object.\n", " | coldist : float\n", " | Collision distance in Angstrom between atoms of the two molecules. Anything closer will be considered a collision.\n", " | \n", " | Example\n", " | -------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.numAtoms\n", " | 1701\n", " | >>> mol.insert(tryp, 0)\n", " | >>> mol.numAtoms\n", " | 3402\n", " | \n", " | moveBy(self, vector, sel=None)\n", " | Move a selection of molecule atoms by a given vector\n", " | \n", " | Parameters\n", " | ----------\n", " | vector: list\n", " | 3D coordinates to add to the Molecule coordinates\n", " | sel: str\n", " | Atomselection of atoms which we want to move\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.moveBy([3, 45 , -8])\n", " | \n", " | mutateResidue(self, sel, newres)\n", " | Mutates a residue by deleting it's sidechain and renaming it\n", " | \n", " | Parameters\n", " | ----------\n", " | sel : str\n", " | Atomselection for the residue we want to mutate. The selection needs to include all atoms of the residue.\n", " | newres : str\n", " | The name of the new residue\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.mutateResidue('resid 158', 'ARG')\n", " | \n", " | read(self, filename, type=None, skip=None, frames=None, append=False, overwrite='all')\n", " | Read any supported file. Currently supported files include pdb, psf, prmtop, prm, pdbqt, xtc, coor, xyz,\n", " | mol2, gjf, mae, and crd, as well as all others supported by MDTraj.\n", " | \n", " | Detects from the extension the file type and loads it into Molecule\n", " | \n", " | Parameters\n", " | ----------\n", " | filename : str\n", " | Name of the file we want to read\n", " | type : str, optional\n", " | File type of the file. If None, it's automatically determined by the extension\n", " | skip : int, optional\n", " | If the file is a trajectory, skip every `skip` frames\n", " | frames : list, optional\n", " | If the file is a trajectory, read only the given frames\n", " | append : bool, optional\n", " | If the file is a trajectory or coor file, append the coordinates to the previous coordinates. Note append is slow.\n", " | overwrite : list of str\n", " | A list of the existing fields in Molecule that we wish to overwrite when reading this file.\n", " | \n", " | remove(self, selection, _logger=True)\n", " | Remove atoms from the Molecule\n", " | \n", " | Parameters\n", " | ----------\n", " | selection : str\n", " | Atomselection string selecting the atoms we want to remove\n", " | \n", " | Returns\n", " | -------\n", " | removed : np.array\n", " | The list of atoms removed\n", " | \n", " | Example\n", " | -------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.remove('name CA') # doctest: +ELLIPSIS\n", " | array([ 1, 9, 16, 20, 24, 36, 43, 49, 53, 58,...\n", " | \n", " | rotate(self, axis, angle, center=(0, 0, 0), sel=None)\n", " | .. warning:: Deprecated since version 1.3.2. Use :func:`htmd.molecule.molecule.Molecule.rotateBy` instead.\n", " | \n", " | Rotate atoms around an axis for a given angle in radians.\n", " | \n", " | Parameters\n", " | ----------\n", " | axis : 3dim vector\n", " | Axis of rotation\n", " | angle : float\n", " | Angle of rotation in radians\n", " | center : list\n", " | The rotation center\n", " | sel :\n", " | Atomselection for atoms to rotate\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.rotate([0, 1, 0], 1.57)\n", " | \n", " | rotateBy(self, M, center=(0, 0, 0), sel='all')\n", " | Rotate a selection of atoms by a given rotation around a center\n", " | \n", " | Parameters\n", " | ----------\n", " | M : np.ndarray\n", " | The rotation matrix\n", " | center : list\n", " | The rotation center\n", " | sel :\n", " | Atomselection for atoms to rotate\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol = tryp.copy()\n", " | >>> mol.rotateBy(rotationMatrix([0, 1, 0], 1.57))\n", " | \n", " | sequence(self, oneletter=True, noseg=False)\n", " | Return the AA sequence of the Molecule.\n", " | \n", " | Parameters\n", " | ----------\n", " | oneletter : bool\n", " | Whether to return one-letter or three-letter AA codes. There should be only one atom per residue.\n", " | noseg : bool\n", " | Ignore segments and return the whole sequence as single string.\n", " | \n", " | Returns\n", " | -------\n", " | sequence : str\n", " | The primary sequence as a dictionary segid - string (if oneletter is True) or segid - list of\n", " | strings (otherwise).\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.sequence()\n", " | {'0': 'IVGGYTCGANTVPYQVSLNSGYHFCGGSLINSQWVVSAAHCYKSGIQVRLGEDNINVVEGNEQFISASKSIVHPSYNSNTLNNDIMLIKLKSAASLNSRVASISLPTSCASAGTQCLISGWGNTKSSGTSYPDVLKCLKAPILSDSSCKSAYPGQITSNMFCAGYLEGGKDSCQGDSGGPVVCSGKLQGIVSWGSGCAQKNKPGVYTKVCNYVSWIKQTIASN'}\n", " | >>> sh2 = Molecule(\"1LKK\")\n", " | >>> pYseq = sh2.sequence(oneletter=False)\n", " | >>> pYseq['1']\n", " | ['PTR', 'GLU', 'GLU', 'ILE']\n", " | >>> pYseq = sh2.sequence(oneletter=True)\n", " | >>> pYseq['1']\n", " | '?EEI'\n", " | \n", " | set(self, field, value, sel=None)\n", " | Set a specific PDB field based on the selection\n", " | \n", " | Parameters\n", " | ----------\n", " | field : str\n", " | Which field of the Molecule to set\n", " | value : string or integer\n", " | All atoms that match the atom selection will have the PDB field `field` set to this scalar value\n", " | (Or 3-vector if setting the coordinates)\n", " | sel : str\n", " | Atom selection string\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.set('segid', 'P', sel='protein')\n", " | \n", " | setDihedral(self, atom_quad, radians, bonds=None)\n", " | Sets the angle of a dihedral.\n", " | \n", " | Parameters\n", " | ----------\n", " | atom_quad : list\n", " | Four atom indexes corresponding to the atoms defining the dihedral\n", " | radians : float\n", " | The angle in radians to which we want to set the dihedral\n", " | bonds : np.ndarray\n", " | An array containing all bonds of the molecule. This is needed if more than one rotation is performed as the\n", " | bond guessing can get messed up if atoms come very close after the rotation.\n", " | \n", " | view(self, sel=None, style=None, color=None, guessBonds=True, viewer=None, hold=False, name=None, viewerhandle=None, gui=False)\n", " | Visualizes the molecule in a molecular viewer\n", " | \n", " | Parameters\n", " | ----------\n", " | sel : str\n", " | Atomselection string for a representation.\n", " | style : str\n", " | Representation style. See more `here `__.\n", " | color : str\n", " | Coloring mode or color ID. See more `here `__.\n", " | guessBonds : bool\n", " | Allow VMD to guess bonds for the molecule\n", " | viewer : str ('vmd', 'webgl')\n", " | Choose viewer backend. Default is taken from htmd.config\n", " | hold : bool\n", " | If set to True, it will not visualize the molecule but instead collect representations until set back to False.\n", " | name : str, optional\n", " | A name to give to the molecule in VMD\n", " | viewerhandle : :class:`VMD ` object, optional\n", " | A specific viewer in which to visualize the molecule. If None it will use the current default viewer.\n", " | \n", " | viewCrystalPacking(self)\n", " | If the Molecule was read from a crystallographic PDB structure it shows the crystal packing of the molecule.\n", " | \n", " | wrap(self, wrapsel=None, fileBonds=True, guessBonds=True)\n", " | Wraps coordinates of the molecule into the simulation box\n", " | \n", " | Parameters\n", " | ----------\n", " | wrapsel : str\n", " | Selection of atoms on which to center the wrapping box\n", " | \n", " | Examples\n", " | --------\n", " | >>> mol=tryp.copy()\n", " | >>> mol.wrap()\n", " | >>> mol.wrap('protein')\n", " | \n", " | write(self, filename, sel=None, type=None)\n", " | Writes any of the supported formats (pdb, coor, psf, xtc, xyz, mol2, gro) and any formats supported by MDtraj\n", " | \n", " | Parameters\n", " | ----------\n", " | filename : str\n", " | The filename of the file we want to write to disk\n", " | sel : str, optional\n", " | The atomselections of the atoms we want to write. If None it will write all atoms\n", " | type : str, optional\n", " | The filetype we want to write. By default, detected from the file extension\n", " | \n", " | ----------------------------------------------------------------------\n", " | Data descriptors defined here:\n", " | \n", " | __dict__\n", " | dictionary for instance variables (if defined)\n", " | \n", " | __weakref__\n", " | list of weak references to the object (if defined)\n", " | \n", " | frame\n", " | \n", " | numAtoms\n", " | Number of atoms in the molecule\n", " | \n", " | numFrames\n", " | Number of coordinate frames in the molecule\n", " | \n", " | numResidues\n", " | \n", " | x\n", " | Get the x coordinates at the current frame\n", " | \n", " | y\n", " | Get the y coordinates at the current frame\n", " | \n", " | z\n", " | Get the z coordinates at the current frame\n", "\n" ] } ], "source": [ "help(Molecule)" ] } ], "metadata": { "anaconda-cloud": {}, "celltoolbar": "Slideshow", "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3.0 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" }, "nav_menu": {}, "toc": { "navigate_menu": true, "number_sections": true, "sideBar": true, "threshold": 6.0, "toc_cell": false, "toc_section_display": "block", "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 0 }