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
#!/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";
}
}