![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl- matrix problem | aj05 | Shell Programming and Scripting | 2 | 02-20-2009 04:17 AM |
| problem with perl | ali560045 | Shell Programming and Scripting | 6 | 05-29-2008 07:26 AM |
| Perl problem | meevagh | Shell Programming and Scripting | 6 | 05-09-2008 04:59 PM |
| Having a problem with a FTP Script using perl | scottzx7rr | Shell Programming and Scripting | 6 | 12-19-2007 06:26 PM |
| PERL function problem | avadhani | Shell Programming and Scripting | 2 | 06-15-2005 04:18 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem with perl ~ tr///
I am trying to run the following script which is a file format converter. The frame variable in the input file has a file of 3,2,1 which needs to be 0,1,2 respectively i.e. 3 =0 etc.
I have included the tr/// function into the script to do this, however it does not seem to be working input its orf00002 111 974 +3 2.94 and output should be orf00002 Glimmer3 CDS 111 974 2 + 0 note "Glimmer3 prediction" ; colour 3 However, the output is actually orf00002 Glimmer3 CDS 111 974 2 + 18446744073709551614 note "Glimmer3 prediction" ; colour 3 I would appreciate any help as i just can't see the problem. The script does exactly what it is supposed to do without the tr/// function but with the wrong values for the frame variable thanks in advance and the script is included below Brian Code:
#!/usr/bin/perl -w
while (<>) {
/(\S+)\s+(\d+)\s+(\d+)\s+([\/+\-])(\d)\s+(\d+)/;
$header = $1;
$start = $2;
$stop = $3;
$strand = $4;
$frame = $5;
$frame = ~ tr/321/012/;
$score = $6;
if ($strand eq "+"){
print "$header\tGlimmer3\tCDS\t$start\t$stop\t$score\t$strand\t$frame\tnote \"Glimmer3 prediction\" ; colour 3\n";
}elsif ($strand eq "-"){
print "$header\tGlimmer3\tCDS\t$stop\t$start\t$score\t$strand\t$frame\tnote \"Glimmer3 prediction\" ; colour 3\n";
}
}
Last edited by pludi; 10-06-2009 at 05:26 AM.. Reason: code tags please.... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|