Sponsored Content
Top Forums Shell Programming and Scripting Conversion from Perl to Shell scripting Post 302464347 by kswapnadevi on Tuesday 19th of October 2010 10:00:43 PM
Old 10-19-2010
Conversion from Perl to Shell scripting

Hai ! I am doing a research on Bioinformatics and a part of the code in perl have to be converted to shell scripting. I am new to shell programming. Pls. kindly help me to convert this code to shell script though it is somewhat lengthy.
PLS KINDLY HELP ME. THANKS IN ADVANCE.
Code:
my @FreeEnergy = `grep -e \'dG\' t1.ct`;
my @dG;
foreach my $fE (@FreeEnergy) {
my @vals = split(' ',$fE);
push(@dG,$vals[3]);
}
my $recSep = $/;
$/ = 'Structure';
open STR, '<', 't1.out' or die "cannot open file \n";
my @structures = <STR>;
close STR;
$/ = $recSep;
my @hairpins = `grep -e \'Structure\' -e \'Hairpin loop:\' -e \'Multi\-loop\' t1.det`;
my ($h,$m) = (0,0);
my (@H,%HairPins,%Multi,@M);
for (my $i=0;$i <@hairpins;$i++) {
my $line = $hairpins[$i];
chomp $line;
if ($line =~ /Structure/) {
if (@H) {
$h++;
my @NH = @H;
my @NM = @M;
$HairPins{$h} = \@NH;
$Multi{$h} = \@NM;
@H = ();
@M = ();
}
} elsif($line =~ /Hairpin/) {
my ($s1,$s2) = ($line =~ /Closing pair is \D\(\s+(\d+)\)-D\(\s+(\d+)\)/);
my $hLoop = "$s1-$s2";
push(@H,$hLoop);
if($i == scalar @hairpins-1) {
$h++;
my @NH = @H;
$HairPins{$h} = \@NH;
my @NM = @M;
$Multi{$h} = \@NM;
@M = ();
@H = ();
}
}
else {
my ($s1,$s2) = ($line =~ /closing pair is \D\(\s+(\d+)\)-\D\(\s+(\d+)\)/);
my $mLoop = "$s1-$s2";
push(@M,$mLoop);
}
}


Last edited by Scott; 10-20-2010 at 02:35 PM.. Reason: Please use code tags, and less formatting of fonts, sizes and colours
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comp-3 conversion possible with Shell Scripting or PERL?

I guess the subject asks it all, but I am wondering (before I go and code a COBOL module) if conversion of regular ASCII data to COMP-3 is possible on a UNIX environment (AIX 5.1)? Any help would be appreciated! Thanks, Dave (13 Replies)
Discussion started by: dfran1972
13 Replies

2. UNIX for Dummies Questions & Answers

Another bash shell to perl conversion

Hello everyone. I am new to linux and need help again. I need help converting this bash shell to linux: for i in `ls -l *.txt` do `./cnvidtf.pl $i` `curl -u login:pswd --disable-espv -T loadfile.seq ftp://11.1.11.1` `mysql -u login -h 11.1.11.1 -ppswd < lddocs.sql` done Thanks! Any help... (6 Replies)
Discussion started by: freak
6 Replies

3. Shell Programming and Scripting

Should I use PERL or Shell scripting?

Hello, I have done some BASIC shell scripting/PERL scripting before so I am familiar with the languages. I am not really sure which one would lend itself better to the application I have to write. I am required to scan the message logs for possible break in attempts. If I use shell scripting... (3 Replies)
Discussion started by: mojoman
3 Replies

4. Shell Programming and Scripting

Call Shell scripting from Perl Scripting.

Hi How to call a shell scripting through a Perl scripting? Actually I need some value from Shell scripting and passes in the Perl scripting. So how can i do this? (2 Replies)
Discussion started by: anupdas
2 Replies

5. Shell Programming and Scripting

Linux/Unix shell scripting vs Perl

Hi, I have general question: i have good working Perl script with .pl extension, and now I have to migrate all to another Linux box, and I was told that I can use only shell scripting, so I'm not sure how different those two things are, will it work without any changes . Is there anything smart I... (6 Replies)
Discussion started by: trento17
6 Replies

6. What is on Your Mind?

Shell scripting vs Perl scripting

Hi all, I would like to start developping some good scripting skills. Do you think it would be best to start with shell scripting or Perl? I already got a fundation, really basics, in perl. but I am wondering what would be best to be good at first. Can you please help me determine which one to... (14 Replies)
Discussion started by: Pouchie1
14 Replies

7. What is on Your Mind?

Shell Scripting vs Perl scripting

Gents, I have been working in a Solaris/Unix environment for about 9 months. I took some linux classses online before getting the job. But, I am not very good at scripting. I want to learn how to script. Do you think that I should start with Shell scripting or Perl? I wanted to continue with... (2 Replies)
Discussion started by: Pouchie1
2 Replies

8. Web Development

Perl scripting or shell scripting?

i am going to study any one of the scripting languages mentioned above(shell 0r perl scripting) . Which is having more scope for a fresher? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

9. Shell Programming and Scripting

shell or perl script needed for ldif file to text file conversion

This is the ldf file dn: sdcsmsisdn=1000000049,sdcsDatabase=subscriberCache,dc=example,dc=com objectClass: sdcsSubscriber objectClass: top postalCode: 29600 sdcsServiceLevel: 10 sdcsCustomerType: 14 givenName: Adelia sdcsBlackListAll: FALSE sdcsOwnerType: T-Mobile sn: Actionteam... (1 Reply)
Discussion started by: LinuxFriend
1 Replies

10. Shell Programming and Scripting

Help required for Oracle database shutdown script conversion from shell to perl

Please tell me how to convert below program from shell script to perl. Same commands need to use in shutdown, just need program help for startup. export ORACLE_BASE=/home/oracle1 lsnrctl start lndb1 sqlplus '/ as sysdba' startup; (2 Replies)
Discussion started by: learnbash
2 Replies
GENDERS_GETATTR(3)						    LIBGENDERS							GENDERS_GETATTR(3)

NAME
genders_getattr - get attributes from a genders file SYNOPSIS
#include <genders.h> int genders_getattr(genders_t handle, char *attrs[], char *vals[], int len, const char *node); DESCRIPTION
genders_getattr() gets the attributes and values for the node pointed to by node. If node is NULL, attributes and values are retrieved for the current node. The attributes are stored in the attribute list pointed to by attrs and the attribute values are stored in vals. If attribute values are not desired, vals can be set to NULL. len should indicate the number of elements that can be stored in both the attribute list and attribute values list. To avoid passing in a list that is not large enough to store all the attributes and attribute values, genders_getmaxattrs(3) should be used to determine the minimum number of elements attrs and vals should be able to store. genders_attrlist_create(3) and genders_vallist_cre- ate(3) could be used to create lists that are guaranteed to be large enough to store all attributes and attribute values. RETURN VALUES
On success, the number of attributes stored in attrs is returned. On error, -1 is returned, and an error code is returned in handle. The error code can be retrieved via genders_errnum(3) , and a description of the error code can be retrieved via genders_strerror(3). Error codes are defined in genders.h. ERRORS
GENDERS_ERR_NULLHANDLE The handle parameter is NULL. The genders handle must be created with genders_handle_create(3). GENDERS_ERR_NOTLOADED genders_load_data(3) has not been called to load genders data. GENDERS_ERR_OVERFLOW The list pointed to by attrs or vals is not large enough to store all the attributes or attribute values. GENDERS_ERR_PARAMETERS An incorrect parameter has been passed in. GENDERS_ERR_NULLPTR A null pointer has been found in the list passed in. GENDERS_ERR_NOTFOUND The node pointed to by node cannot be found in the genders file or if node=NULL, the machine genders is running on is not listed in the genders database. GENDERS_ERR_MAGIC handle has an incorrect magic number. handle does not point to a genders handle or handle has been destroyed by genders_han- dle_destroy(3). FILES
/usr/include/genders.h SEE ALSO
libgenders(3), genders_handle_create(3), genders_load_data(3), genders_getmaxattrs(3), genders_attrlist_create(3), genders_vallist_cre- ate(3), genders_errnum(3), genders_strerror(3) LLNL
August 2003 GENDERS_GETATTR(3)
All times are GMT -4. The time now is 02:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy