<br>Yes, I&#39;m always looking at the same one, it means the corresponding one in the other trajectory.<br><br>Carla<br><br><div class="gmail_quote">On Tue, Oct 26, 2010 at 2:17 PM, Justin A. Lemkul <span dir="ltr">&lt;<a href="mailto:jalemkul@vt.edu">jalemkul@vt.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><br>
<br>
Carla Jamous wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Please I have a problem:<br>
<br>
I concatenated 3 trajectories and got one long trajectory on which I ran the perl script it gives me lets say 60% for hbond 1.<br>
<br>
But when I look in each of the 3 trajectories alone, this hbond doesn&#39;t even exist in 2 of them.<br>
Do you have an idea where the problem might be because I checked if it&#39;s well concatenated and it is. And I can&#39;t figure out why I have this error.<br>
<br>
</blockquote>
<br></div>
The hydrogen bond indices are regenerated in each trajectory, since not all H-bonds might be present in the same order.  Are you sure you&#39;re continually looking at the same one?<br>
<br>
-Justin<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Thanks,<br>
Carla<div class="im"><br>
<br>
On Tue, Oct 26, 2010 at 2:08 PM, Justin A. Lemkul &lt;<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a> &lt;mailto:<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a>&gt;&gt; wrote:<br>

<br>
<br>
<br>
    Carla Jamous wrote:<br>
<br>
        Hi Justin,<br>
<br>
        Please can you explain this particular comment in your perl<br>
        script: &quot;# There should now be $nres lines left in the file<br>
        # The HB map for the last index is written first (top-down in<br>
        .xpm file)<br>
        #   * Element 0 is index $nres, element 1 is $nres-1, etc.&quot;<br>
<br>
        Is the perl script reading the index file beginning from the<br>
        bottom? If so, why is that? Because in the manual, it says that<br>
        in the matrix, the ordering is identical to that in the index file.<br>
<br>
<br>
    The order is the same, and the indices are mapped exactly as you<br>
    would expect them.  The .xpm file is written, however, from top<br>
    down.  So the final index in hbond.ndx is the top line in the<br>
    matrix.  As such, even though they are in the same &quot;order,&quot; per se,<br>
    the two files (.xpm and .ndx) have to be read in opposite directions.<br>
<br>
    -Justin<br>
<br>
        Thank you.<br>
<br>
        Carla<br>
<br>
<br>
        On Mon, Oct 11, 2010 at 4:31 PM, Justin A. Lemkul<br>
        &lt;<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a> &lt;mailto:<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a>&gt;<br></div><div class="im">
        &lt;mailto:<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a> &lt;mailto:<a href="mailto:jalemkul@vt.edu" target="_blank">jalemkul@vt.edu</a>&gt;&gt;&gt; wrote:<br>
<br>
<br>
           I wrote a Perl script to do a similar task (appended below).<br>
            Perhaps it will be useful to you.  I hope it works; I had to<br>
        hack<br>
           out some things that were specific to my needs and have done only<br>
           limited testing.<br>
<br>
           -Justin<br>
<br>
<br>
<br>
           #!/usr/bin/perl<br>
<br>
           #<br></div>
           # <a href="http://plot_hbmap.pl" target="_blank">plot_hbmap.pl</a> &lt;<a href="http://plot_hbmap.pl" target="_blank">http://plot_hbmap.pl</a>&gt; &lt;<a href="http://plot_hbmap.pl" target="_blank">http://plot_hbmap.pl</a>&gt;<div>
<div></div><div class="h5"><br>
        - plot the probability of<br>
<br>
           finding a particular hydrogen bond<br>
           # based on several input files:<br>
           #   1. coordinate file (for atom naming) - MUST be a .pdb<br>
        file with<br>
           NO CHAIN IDENTIFIERS<br>
           #   2. hbmap.xpm<br>
           #   3. hbond.ndx (modified to contain only the atom numbers<br>
        in the<br>
           [hbonds...] section, nothing else)<br>
           #<br>
<br>
           use strict;<br>
<br>
           unless(@ARGV) {<br>
              die &quot;Usage: perl $0 -s structure.pdb -map hbmap.xpm -index<br>
           hbond.ndx\n&quot;;<br>
           }<br>
<br>
           # define input hash<br>
           my %args = @ARGV;<br>
<br>
           # input variables<br>
           my $map_in;<br>
           my $struct;<br>
           my $ndx;<br>
<br>
           if (exists($args{&quot;-map&quot;})) {<br>
              $map_in = $args{&quot;-map&quot;};<br>
           } else {<br>
              die &quot;No -map specified!\n&quot;;<br>
           }<br>
<br>
           if (exists($args{&quot;-s&quot;})) {<br>
              $struct = $args{&quot;-s&quot;};<br>
           } else {<br>
              die &quot;No -s specified!\n&quot;;<br>
           }<br>
<br>
           if (exists($args{&quot;-index&quot;})) {<br>
              $ndx = $args{&quot;-index&quot;};<br>
           } else {<br>
              die &quot;No -index specified!\n&quot;;<br>
           }<br>
<br>
           # 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);<br>
<br>
           open(STRUCT, &quot;&lt;$struct&quot;) || die &quot;Cannot open input coordinate<br>
        file!\n&quot;;<br>
           my @coord = &lt;STRUCT&gt;;<br>
           close(STRUCT);<br>
<br>
           open(NDX, &quot;&lt;$ndx&quot;) || die &quot;Cannot open input index file!\n&quot;;<br>
           my @index = &lt;NDX&gt;;<br>
           close(NDX);<br>
<br>
           # 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);<br>
<br>
                  $nframes = $info[0];<br>
                  my @nframes = split(&#39;&#39;, $nframes);<br>
                  shift(@nframes);    # get rid of the &quot;<br>
                  $nframes = join(&#39;&#39;, @nframes);<br>
<br>
                  $nres = $info[1];<br>
              }<br>
           }<br>
<br>
           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;;<br>
<br>
           # 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>
           }<br>
<br>
           # donor/acceptor hashes for bookkeeping purposes<br>
           my %donors;<br>
           for (my $b=1; $b&lt;=$nres; $b++) {<br>
              $donors{$b} = 0;<br>
           }<br>
<br>
           my %acceptors;<br>
           for (my $c=1; $c&lt;=$nres; $c++) {<br>
              $acceptors{$c} = 0;<br>
           }<br>
<br>
           # clean up the output - up to 18 lines of comments, etc.<br>
           splice(@map, 0, 18);<br>
<br>
           # 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>
           }<br>
<br>
           # There should now be $nres lines left in the file<br>
           # The HB map for the last index is written first (top-down in<br>
        .xpm file)<br>
           #   * Element 0 is index $nres, element 1 is $nres-1, etc.<br>
<br>
           for (my $i=$nres; $i&gt;=1; $i--) {<br>
              # There will be $nframes+2 elements in @line (extra two<br>
        are &quot; at<br>
           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]);<br>
<br>
              # 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>
           }<br>
<br>
           print &quot;Processing the index file...\n&quot;;<br>
<br>
           # 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>
           }<br>
<br>
<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;<br>
<br>
           # 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];<br>
<br>
              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>
           }<br>
<br>
           # open a single output file for writing<br>
           open(OUT, &quot;&gt;&gt;summary_HBmap.dat&quot;) || die &quot;Cannot open output<br>
        file!\n&quot;;<br>
           printf(OUT &quot;%10s\t%10s\t%10s\t%10s\%10s\n&quot;, &quot;#    Donor&quot;, &quot; &quot;,<br>
           &quot;Acceptor&quot;, &quot; &quot;, &quot;% Exist.&quot;);<br>
<br>
           for (my $o=1; $o&lt;=$nres; $o++) {<br>
              printf(OUT &quot;%10s\t%10s\t%10s\t%10s\t%10.3f\n&quot;,<br>
        $donor_resn[$o],<br>
           $donor_names[$o], $acceptor_resn[$o], $acceptor_names[$o],<br>
           (($hbonds{$o}/$nframes)*100));<br>
           }<br>
<br>
           close(OUT);<br>
<br>
           exit;<br>
<br>
<br>
<br>
<br>
           Carla Jamous wrote:<br>
<br>
               Hi everyone,<br>
<br>
               I tried to analyze the H-bonds in my trajectory with<br>
        g-hbond and<br>
               I analysed the xpm and ndx file. But now I need to know the<br>
               percentage of existence of each hbond during my<br>
        trajectory. Is<br>
               there a way to do it with a command line? Or is there a<br>
        program<br>
               (someone told me there are python programs for analysis of<br>
               gromacs trajectories) to extract this information from<br>
        the .xpm<br>
               file?<br>
<br>
               Thank you.<br>
<br>
               Cheers,<br>
               Carla<br>
<br>
<br>
           --     ========================================<br>
<br>
           Justin A. Lemkul<br>
           Ph.D. Candidate<br>
           ICTAS Doctoral Scholar<br>
           MILES-IGERT Trainee<br>
           Department of Biochemistry<br>
           Virginia Tech<br>
           Blacksburg, VA<br></div></div>
           jalemkul[at]<a href="http://vt.edu" target="_blank">vt.edu</a> &lt;<a href="http://vt.edu" target="_blank">http://vt.edu</a>&gt; &lt;<a href="http://vt.edu" target="_blank">http://vt.edu</a>&gt; | (540)<div class="im">
<br>
        231-9080<br>
<br>
           <a href="http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin" target="_blank">http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin</a><br>
<br>
           ========================================<br>
           --     gmx-users mailing list    <a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a><br>
        &lt;mailto:<a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a>&gt;<br></div>
           &lt;mailto:<a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a> &lt;mailto:<a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a>&gt;&gt;<div><div></div><div class="h5">
<br>
<br>
           <a href="http://lists.gromacs.org/mailman/listinfo/gmx-users" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-users</a><br>
           Please search the archive at<br>
           <a href="http://www.gromacs.org/Support/Mailing_Lists/Search" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/Search</a> before<br>
        posting!<br>
           Please don&#39;t post (un)subscribe requests to the list. Use the www<br>
           interface or send it to <a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a><br>
        &lt;mailto:<a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a>&gt;<br>
           &lt;mailto:<a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a><br>
        &lt;mailto:<a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a>&gt;&gt;.<br>
<br>
           Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
<br>
<br>
    --     ========================================<br>
<br>
    Justin A. Lemkul<br>
    Ph.D. Candidate<br>
    ICTAS Doctoral Scholar<br>
    MILES-IGERT Trainee<br>
    Department of Biochemistry<br>
    Virginia Tech<br>
    Blacksburg, VA<br>
    jalemkul[at]<a href="http://vt.edu" target="_blank">vt.edu</a> &lt;<a href="http://vt.edu" target="_blank">http://vt.edu</a>&gt; | (540) 231-9080<br>
    <a href="http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin" target="_blank">http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin</a><br>
<br>
    ========================================<br>
    --     gmx-users mailing list    <a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a><br>
    &lt;mailto:<a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a>&gt;<br>
    <a href="http://lists.gromacs.org/mailman/listinfo/gmx-users" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-users</a><br>
    Please search the archive at<br>
    <a href="http://www.gromacs.org/Support/Mailing_Lists/Search" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/Search</a> before posting!<br>
    Please don&#39;t post (un)subscribe requests to the list. Use the www<br>
    interface or send it to <a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a><br>
    &lt;mailto:<a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a>&gt;.<br>
    Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
<br>
</div></div></blockquote><div><div></div><div class="h5">
<br>
-- <br>
========================================<br>
<br>
Justin A. Lemkul<br>
Ph.D. Candidate<br>
ICTAS Doctoral Scholar<br>
MILES-IGERT Trainee<br>
Department of Biochemistry<br>
Virginia Tech<br>
Blacksburg, VA<br>
jalemkul[at]<a href="http://vt.edu" target="_blank">vt.edu</a> | (540) 231-9080<br>
<a href="http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin" target="_blank">http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin</a><br>
<br>
========================================<br>
-- <br>
gmx-users mailing list    <a href="mailto:gmx-users@gromacs.org" target="_blank">gmx-users@gromacs.org</a><br>
<a href="http://lists.gromacs.org/mailman/listinfo/gmx-users" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-users</a><br>
Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/Search" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/Search</a> before posting!<br>
Please don&#39;t post (un)subscribe requests to the list. Use the www interface or send it to <a href="mailto:gmx-users-request@gromacs.org" target="_blank">gmx-users-request@gromacs.org</a>.<br>
Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
</div></div></blockquote></div><br>