Re: [AMBER] pytraj native contacts

From: Wesley Michael Botello-Smith <>
Date: Wed, 23 Jan 2019 10:35:02 -0800

I have seen the same thing when using pt.native_contacts...
one option is to use pt.compute() instead.
This gives you back an 'OrderedDict' object which contains the output you
would get for the equivalent cpptraj command

e.g. when i run this on a system i am working on right now, which contains
a ligand in an occluded protein binding pocket:

command='nativecontacts :LIG :WAT distance 2.0 includesolvent series
savenonnative resseries present'
print contactData.keys()

I get:

So you could then access the agglomerated native / nonnative contact counts
for each frame or the individual water residue - ligand contact series by
using the appropriate key. E.g. contactData['native'] or
of course, if you dont care about individual contact series, then you could
just leave those out.
Essentially, the pt.compute() command is running the command you give it
exactly as it would be in cpptraj.
If your after consistency this may be a good way to go.

Hope that helps,
-Dr. Wesley Botello-Smith

On Wed, Jan 23, 2019 at 7:57 AM Rosellen, Martin <> wrote:

> Hi,
> I want to write a programme in pytraj that returns the contacts with water
> of a given residue. In cpptraj it works fine and identifies 3 contacts:
> nativecontacts :42 :WAT writecontacts 42_water_contacts.dat resout
> 42_water_contacts_resout.dat distance 2.0 out 42_water_contacts_out.dat
> includesolvent
> I tried to do the same in pytraj but the behaviour of native_contacts is
> not clear to me:
> pytraj.native_contacts(traj, mask=':42', mask2=":WAT", distance=2.0,
> include_solvent=True)
> This gives me 927 contacts.
> I want to further keep the data that gets written out to
> '42_water_contacts.dat' in the cpptraj command, in a variable python
> variable.
> best
> Martin
> _______________________________________________
> AMBER mailing list
AMBER mailing list
Received on Wed Jan 23 2019 - 11:00:03 PST
Custom Search