Posts

Showing posts from August, 2015

Publication-quality matplotlib figures

Image
We're going to go from this...
... to this


Install prettyplotlib, a useful tool for graph styling


sudo pip install prettyplotlib 

Add a new method to style the axes to prettyplotlib/util.py 

def styling(ax, xpad=10.0, ypad=10.0, axiswidth=2.0, axistickwidth=2.0, axiscolor="#333333"):

    for axis in ['bottom','left']: ax.spines[axis].set_linewidth(axiswidth)

    for tick in ax.get_xaxis().get_major_ticks():
        tick.set_pad(xpad)
        tick.label1 = tick._get_text1()

    for tick in ax.get_yaxis().get_major_ticks():
        tick.set_pad(ypad)
        tick.label1 = tick._get_text1()

    ax.get_yaxis().set_tick_params(direction='out', width=axistickwidth)
    ax.get_xaxis().set_tick_params(direction='out', width=axistickwidth)

    ax.spines['bottom'].set_color(axiscolor)
    ax.spines['left'].set_color(axiscolor)

    ax.tick_params(axis='x', colors=axiscolor)
    ax.tick_params(axis='y', colors=axiscolor)

Set figure siz…

Merge force-fields in gromacs

Using gromacs with two force-fields are for ligand one for protein? Wanting to do that but not knowing how? Look no further.

The technical problem is as follows: let's say you have your favourite custom force-field. For me it resides in charmm.ff and it's my hybrid charmm36+charmm22* set of parameters.

To simulate a ligand inside of a system parametrized using the ff-above, I went to paramchem.org and obtained small molecule parameters for my ligand. These were in CHARMM format, so (courtesy of Alex Mackerell) I converted those to gromacs itp files. That left me with a dependency on charmm36-jun2015.ff.tgz

There is only a handful of lines I want from charmm36-jun2015.ff, the ligand is very simple. There is no easy way to get those out, or to merge my custom charmm with Alex's.

Prerequisites

Install networkx, a python package for dealing with graphs
pip install networkx
Let's take some example ligand molecules, such as the TPP - the ligand for EmrE drug transporter. Atta…