[gmx-users] automating analysis using shell scripting

Tsjerk Wassenaar tsjerkw at gmail.com
Wed Jun 30 09:25:41 CEST 2010


Hi Hassan,

If you have an index file with all the groups, you can use something like:

#!/bin/bash

groups=`grep "^\[" index.ndx | wc -l`

for ((i=0; i<$groups; i++))
do
  echo $((i++)) $i | g_dist ...
done

This will take groups 0 and 1, 2 and 3, etc, passing the selections to
g_dist. If you want to have all unique pairwise combinations, you can
use

#!/bin/bash

groups=`grep "^\[" index.ndx | wc -l`

for ((i=0; i<$((groups-1)); i++))
do
  for ((j=$((i+1); j<$groups;j++)
  do
    echo $i $j | g_dist ...
  done
done

Do mind using the variables $i and $j in the names of the output
files, to make them unique.

Hope it helps,

Tsjerk

On Wed, Jun 30, 2010 at 3:24 AM, Hassan Shallal <hshallal at pacific.edu> wrote:
> Thanks Justin, this is just working amazingly....
>
> ________________________________
>
> From: gmx-users-bounces at gromacs.org on behalf of Justin A. Lemkul
> Sent: Tue 6/29/2010 6:13 PM
> To: Discussion list for GROMACS users
> Subject: Re: [gmx-users] automating analysis using shell scripting
>
>
>
>
>
> Hassan Shallal wrote:
>> Dear Gromacs users,
>>
>> This question is much more of a linux shell scripting than of Gromacs. I have several distances to measure in my produced system for which I use g_dist. I need to shell script this so I don't have to set next to the machine while measuring those distances. The problem I face is that g_dist, and others like g_rms and g_rmsf, asks for input of the number of the group with or without an index file. My question is, how can I use shell scripting to answer those questions given by g_dist, giving it the number of the groups which is usually 0 an 1 using an index file of two atoms in the system?
>>
>> By doing this I can write a shell script of several g_dist lines, each is concerned with a specific distance, the shell script can input the number oif the groups to be measured, and I can do another experiment or go to the gym, or even cook something for dinner until it's done, lol
>>
>> Has anyone of you tried doing this?
>>
>
> Yes, see here:
>
> http://www.gromacs.org/Documentation/How-tos/Making_Commands_Non-Interactive
>
> -Justin
>
>> Thanks alot
>> Hassan Shallal
>> University of the Pacific
>> Stockton, California
>>
>> ________________________________
>>
>> From: gmx-users-bounces at gromacs.org on behalf of Justin A. Lemkul
>> Sent: Sat 6/26/2010 8:39 PM
>> To: Discussion list for GROMACS users
>> Subject: Re: [gmx-users] Re: gmx-users Digest, Vol 74, Issue 143
>>
>>
>>
>>
>>
>> lloyd riggs wrote:
>>> Dear (Justin too),
>>>
>>> Thank you for the replies.  My main problem is lack of time, but I still have
>>> the end of the proteins problem as of now.
>>>
>>> I only made the comment to justin partially as a joke, because he A) answeres
>>> on averidge about 10-20 of these a day, seems too smart to be a help center,
>>> and B) Every freind I have had in the past whom ends up overdoing on the help
>>> BB (ie, CCP4, Phsics at CERN, etc...) ends up getting screwed in the end by
>>> not balancing the "myself" getting my things done and making connections Vs.
>>> Helping everyone else because they know so damned much about a specific
>>> topic.  All of my freinds in the similar situation started off looking about
>>> as promissing, but then get ragged once they graduate, because everyone seems
>>> to want a slave loyal to themselves as a post doc, before the professorship
>>> is obtainable, etc...and end up writting video game software, hateing
>>> academia for the way it really works Vs. the way it is supposed to work in
>>> the scientific ideology we are taught at Universities and highschool.
>>>
>>> In any case, sorry to you Justin, I didn't mean to be such an ass.
>>>
>>
>> Apology accepted.  Please don't feel like you have to save me any trouble or
>> look out for my productivity.  I only reply to email when I really care to, and
>> my comments are intended as helpful, not picky or overly critical :)  I do
>> appreciate this follow-up, as I have received several private emails telling me
>> I'm a useless jerk, and they really do mean it...
>>
>> -Justin
>>
>>> Stephan Watkins
>>>
>>
>> --
>> ========================================
>>
>> Justin A. Lemkul
>> Ph.D. Candidate
>> ICTAS Doctoral Scholar
>> MILES-IGERT Trainee
>> Department of Biochemistry
>> Virginia Tech
>> Blacksburg, VA
>> jalemkul[at]vt.edu | (540) 231-9080
>> http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin
>>
>> ========================================
>> --
>> gmx-users mailing list    gmx-users at gromacs.org
>> http://lists.gromacs.org/mailman/listinfo/gmx-users
>> Please search the archive at http://www.gromacs.org/search before posting!
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-users-request at gromacs.org.
>> Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>>
>>
>>
>
> --
> ========================================
>
> Justin A. Lemkul
> Ph.D. Candidate
> ICTAS Doctoral Scholar
> MILES-IGERT Trainee
> Department of Biochemistry
> Virginia Tech
> Blacksburg, VA
> jalemkul[at]vt.edu | (540) 231-9080
> http://www.bevanlab.biochem.vt.edu/Pages/Personal/justin
>
> ========================================
> --
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before posting!
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>
>
>
> --
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at http://www.gromacs.org/search before posting!
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> Can't post? Read http://www.gromacs.org/mailing_lists/users.php
>



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Molecular Dynamics Group
Groningen Institute for Biomolecular Research and Biotechnology
University of Groningen
The Netherlands



More information about the gromacs.org_gmx-users mailing list