[Bio] / FigKernelScripts / changed_starts.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/changed_starts.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Sat Jul 23 16:04:32 2005 UTC revision 1.4, Sun Aug 7 14:27:00 2005 UTC
# Line 1  Line 1 
1    # -*- perl -*-
2    
3  use FIG;  use FIG;
4    my $fig = new FIG;
5    
6  $usage = "usage: changed_starts Proposed Annotations >> modified.starts";  $usage = "usage: changed_starts Proposed Annotations >> modified.starts";
7    
8  (  (
9   ($proposed    = shift @ARGV) && open(PROPOSED,"<$proposed") &&   ($proposed    = shift @ARGV) && open(PROPOSED,"<$proposed") &&
10   ($annotations = shift @ARGV) && open(ANN,">>$annotations")   ($annotations = shift @ARGV) && open(ANN,">$annotations")
11  )  )
12      || die $usage;      || die $usage;
13    
# Line 13  Line 15 
15    
16  while (defined($entry = <PROPOSED>))  while (defined($entry = <PROPOSED>))
17  {  {
18      if ($entry =~ /ID=(fig\|\d+\.\d+\.peg\.\d+).*\nOLD_START_POS=(\d+)\nNEW_START_POS=(\d+).*?CONF_GAP=(\S+).*?NEW_START_LOC=(\S+)_(\d+)_(\d+)\n/s)      if ($entry =~ /ID=(\S+).*\nOLD_START_POS=(\d+)\nNEW_START_POS=(\d+).*?CONF_GAP=(\S+).*?NEW_START_LOC=(\S+)_(\d+)_(\d+)\n/s)
19      {      {
20          ($peg,$old_pos,$new_pos,$conf_gap,$contig,$beg,$end) = ($1,$2,$3,$4,$5,$6,$7);          ($peg,$old_pos,$new_pos,$conf_gap,$contig,$beg,$end) = ($1,$2,$3,$4,$5,$6,$7);
21    
22          $old_beg = ($beg < $end) ? $beg - ($new_pos-$old_pos) : $beg + ($new_pos-$old_pos);          $old_beg = ($beg < $end) ? $beg - ($new_pos-$old_pos) : $beg + ($new_pos-$old_pos);
23          $old_start = join("_",($contig,$old_beg,$end));          $old_loc = join("_",($contig,$old_beg,$end));
24          $new_start = join("_",($contig,$beg,$end));          $new_loc = join("_",($contig,$beg,$end));
25          push(@changes,[$peg,$old_start,$new_start,$conf_gap]);          push(@changes,[$peg,$old_loc,$new_loc,$conf_gap]);
         print ANN "$peg\tChanged start from $old_start to $new_start\n";  
26      }      }
27  }  }
28    
29  foreach $_ (sort { $b->[3] <=> $a->[3] } @changes)  foreach $_ (sort { $b->[3] <=> $a->[3] } @changes)
30  {  {
31      print join("\t",@$_),"\n";      ($peg,$old_loc,$new_loc,$conf_gap) = @$_;
32        $genome = &FIG::genome_of($peg);
33        $dna    = $fig->dna_seq($genome,$new_loc);
34        $trans  = $fig->translate($dna,undef,'start');
35        if ((substr($trans,-1) ne "*") && (! $fig->possibly_truncated($peg)))
36        {
37            print STDERR "missing STOP on $peg\n";
38        }
39        else
40        {
41            $trans =~ s/\*$//;
42        }
43        print join("\t",($peg,$old_loc,$new_loc,$conf_gap,$trans)),"\n";
44        print ANN "$peg\tChanged start from $old_loc to $new_loc\n";
45  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3