<div>Dear Justin</div>
<div> </div>
<div>thank you very much.</div>
<div> </div>
<div>what I used as HB.pl exactly is as follows:</div>
<div> </div>
<div>is there problem in that?</div>
<div> </div>
<div>#!/usr/bin/perl</div>
<div>#<br># <a href="http://plot_hbmap.pl">plot_hbmap.pl</a> - plot the probability of finding a particular hydrogen bond<br># based on several input files:<br>#   1. coordinate file (for atom naming) - MUST be a .pdb file with NO CHAIN<br>
IDENTIFIERS<br>#   2. hbmap.xpm<br>#   3. hbond.ndx (modified to contain only the atom numbers in the [hbonds...] <br>section, nothing else)<br>#</div>
<div>use strict;</div>
<div>unless(@ARGV) {<br>     die &quot;Usage: perl $0 -s structure.pdb -map hbmap.xpm -index hbond.ndx\n&quot;;<br>}</div>
<div># define input hash<br>my %args = @ARGV;</div>
<div># input variables<br>my $map_in;<br>my $struct;<br>my $ndx;</div>
<div>if (exists($args{&quot;-map&quot;})) {<br>     $map_in = $args{&quot;-map&quot;};<br>} else {<br>     die &quot;No -map specified!\n&quot;;<br>}</div>
<div>if (exists($args{&quot;-s&quot;})) {<br>     $struct = $args{&quot;-s&quot;};<br>} else {<br>     die &quot;No -s specified!\n&quot;;<br>}</div>
<div>if (exists($args{&quot;-index&quot;})) {<br>     $ndx = $args{&quot;-index&quot;};<br>} else {<br>     die &quot;No -index specified!\n&quot;;<br>}</div>
<div># open the input<br>open(MAP, &quot;&lt;$map_in&quot;) || die &quot;Cannot open input map file!\n&quot;;<br>my @map = &lt;MAP&gt;;<br>close(MAP);</div>
<div>open(STRUCT, &quot;&lt;$struct&quot;) || die &quot;Cannot open input coordinate file!\n&quot;;<br>my @coord = &lt;STRUCT&gt;;<br>close(STRUCT);</div>
<div>open(NDX, &quot;&lt;$ndx&quot;) || die &quot;Cannot open input index file!\n&quot;;<br>my @index = &lt;NDX&gt;;<br>close(NDX);</div>
<div># determine number of HB indices and frames<br>my $nres = 0;<br>my $nframes = 0;<br>for (my $i=0; $i&lt;scalar(@map); $i++) {<br>     if ($map[$i] =~ /static char/) {<br>         my $res_line = $map[$i+1];<br>         my @info = split(&quot; &quot;, $res_line);</div>

<div>         $nframes = $info[0];<br>         my @nframes = split(&#39;&#39;, $nframes);<br>         shift(@nframes);    # get rid of the &quot;<br>         $nframes = join(&#39;&#39;, @nframes);</div>
<div>         $nres = $info[1];<br>     }<br>}</div>
<div>print &quot;Processing the map file...\n&quot;;<br>print &quot;There are $nres HB indices.\n&quot;;<br>print &quot;There are $nframes frames.\n&quot;;</div>
<div># initialize hashes for later output writing<br># counter $a holds the HB index from hbond.ndx<br>my %hbonds;<br>for (my $a=0; $a&lt;$nres; $a++) {<br>     $hbonds{$a+1} = 0;<br>}</div>
<div># donor/acceptor hashes for bookkeeping purposes<br>my %donors;<br>for (my $b=1; $b&lt;=$nres; $b++) {<br>     $donors{$b} = 0;<br>}</div>
<div>my %acceptors;<br>for (my $c=1; $c&lt;=$nres; $c++) {<br>     $acceptors{$c} = 0;<br>}</div>
<div># clean up the output - up to 18 lines of comments, etc.<br>splice(@map, 0, 18);</div>
<div># remove any &quot;x-axis&quot; or &quot;y-axis&quot; lines<br>for (my $n=0; $n&lt;scalar(@map); $n++) {<br>     if (($map[$n] =~ /x-axis/) || ($map[$n] =~ /y-axis/)) {<br>             shift(@map);<br>             $n--;<br>
     }<br>}</div>
<div># There should now be $nres lines left in the file<br># The HB map for the last index is written first (top-down in .xpm file)<br>#   * Element 0 is index $nres, element 1 is $nres-1, etc.</div>
<div>for (my $i=$nres; $i&gt;=1; $i--) {<br>     # There will be $nframes+2 elements in @line (extra two are &quot; at beginning<br>     # and end of the line)<br>     # Establish a conversion factor and split the input lines<br>
     my $j = $nres - $i;<br>     my @line = split(&#39;&#39;, $map[$j]);</div>
<div>     # for each index, write to hash<br>     for (my $k=1; $k&lt;=($nframes+1); $k++) {<br>         if ($line[$k] =~ /o/) {<br>             $hbonds{$i}++;<br>         }<br>     }<br>}</div>
<div>print &quot;Processing the index file...\n&quot;;</div>
<div># Open up the index file and work with it<br>for (my $n=0; $n&lt;$nres; $n++) {<br>     my @line = split(&quot; &quot;, $index[$n]);<br>     $donors{$n+1} = $line[0];<br>     $acceptors{$n+1} = $line[2];<br>}</div>
<div><br># some arrays for donor and acceptor atom names<br>my @donor_names;<br>my @donor_resn;<br>my @acceptor_names;<br>my @acceptor_resn;</div>
<div># Open up the structure file and work with it<br>print &quot;Processing coordinate file...\n&quot;;<br>foreach $_ (@coord) {<br>     my @line = split(&quot; &quot;, $_);<br>     my $natom = $line[1];<br>     my $name = $line[2];<br>
     my $resn = $line[3];<br>     my $resnum = $line[4];</div>
<div>     if ($line[0] =~ /ATOM/) {<br>         unless ($resn =~ /SOL/) {<br>             for (my $z=1; $z&lt;=$nres; $z++) {<br>                 if ($donors{$z} == $natom) {<br>                     $donor_names[$z] = $name;<br>
                     $donor_resn[$z] = join(&#39;&#39;, $resn, $resnum);<br>                 } elsif ($acceptors{$z} == $natom) {<br>                     $acceptor_names[$z] = $name;<br>                     $acceptor_resn[$z] = join(&#39;&#39;, $resn, $resnum);<br>
                 }<br>             }<br>         }<br>     }<br>}</div>
<div># open a single output file for writing<br>open(OUT, &quot;&gt;&gt;summary_HBmap.dat&quot;) || die &quot;Cannot open output file!\n&quot;;<br>printf(OUT &quot;%10s\t%10s\t%10s\t%10s\%10s\n&quot;, &quot;#    Donor&quot;, &quot; &quot;, &quot;Acceptor&quot;, &quot; &quot;,<br>
&quot;% Exist.&quot;);</div>
<div>for (my $o=1; $o&lt;=$nres; $o++) {<br>     printf(OUT &quot;%10s\t%10s\t%10s\t%10s\t%10.3f\n&quot;, $donor_resn[$o],<br>$donor_names[$o], $acceptor_resn[$o], $acceptor_names[$o],<br>(($hbonds{$o}/$nframes)*100));<br>
}</div>
<div>close(OUT);</div>
<div>exit;<br><br clear="all"><br>-- <br></div><pre style="FONT-FAMILY: arial,helvetica,sans-serif">Leila Karami<br>Ph.D. student of Physical Chemistry<br>K.N. Toosi University of Technology<br>Theoretical Physical Chemistry Group</pre>
<br>