Find structure water between ligand and receptor with AMBERTOOLS.

The method has two steps.

1. Use AMBERTOOLS to find the hydrogen bonds with ligand or receptor

2. Use BASH script to find the common water residues.

+++++++++++++++++++++++++++++++++++++++++++++++++

First of all, build a hbond.in as the template.

trajin trajectory.dcd 1 1
hbond acceptormask :WAT@O=,N=,S= donormask :LIG@O=,N=,S= avgout \
avg_1la.dat printatomnum
hbond donormask :WAT@O=,N=,S= acceptormask :LIG@O=,N=,S= avgout \
avg_1lb.dat printatomnum
hbond acceptormask :WAT@O=,N=,S= donormask :REC@O=,N=,S= avgout \
avg_1ra.dat printatomnum
hbond donormask :WAT@O=,N=,S= acceptormask :REC@O=,N=,S= avgout \
avg_1rb.dat printatomnum

Then, build a BASH script to find the hbond. avgout can output the residue number of each frame. Assuming the trajectory.dcd file has 1000 frames.

for i in {1..1000};do
        cp hbond.in temp${i}.in
        for j in 1 3 5 7 9;do
                sed -i ${j}s/1/$i/g temp${i}.in
        done
        cpptraj ../*prmtop temp${i}.in &
        sleep 0.1
done
rm -r temp*.in

Finally, use BASH script to find structure water.

rm -f n_swater.dat swater.dat
for i in {1..1000};do
        a=`grep WAT *_${i}la.dat | awk '{print $1}' | cut -f3 -d "_"`
        b=`grep WAT *_${i}lb.dat | awk '{print $3}' | cut -f3 -d "_"`
        l=`echo $a $b | tr ' ' '\n' | sort -n | uniq`

        a=`grep WAT *_${i}ra.dat | awk '{print $1}' | cut -f3 -d "_"`
        b=`grep WAT *_${i}rb.dat | awk '{print $3}' | cut -f3 -d "_"`
        r=`echo $a $b | tr ' ' '\n' | sort -n | uniq`

        swater=`echo $l $r | tr ' ' '\n' | sort -n | uniq -d`
        n_swater=`echo $swater | tr ' ' '\n' | wc -l`
        echo $i $swater >> swater.dat #oxygen atom number list in each frame.
        printf "%6s %s\n" $i $n_swater >> n_swater.dat #structure water number in each frame.
done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s