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

Annotation of /FigKernelScripts/changed_starts.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download) (as text)

1 : overbeek 1.3 # -*- perl -*-
2 : overbeek 1.1
3 :     use FIG;
4 : overbeek 1.4 my $fig = new FIG;
5 : overbeek 1.1
6 :     $usage = "usage: changed_starts Proposed Annotations >> modified.starts";
7 :    
8 :     (
9 :     ($proposed = shift @ARGV) && open(PROPOSED,"<$proposed") &&
10 : overbeek 1.4 ($annotations = shift @ARGV) && open(ANN,">$annotations")
11 : overbeek 1.1 )
12 :     || die $usage;
13 :    
14 :     $/ = "///\n";
15 :    
16 :     while (defined($entry = <PROPOSED>))
17 :     {
18 : overbeek 1.2 if ($entry =~ /ID=(\S+).*\nOLD_START_POS=(\d+)\nNEW_START_POS=(\d+).*?CONF_GAP=(\S+).*?NEW_START_LOC=(\S+)_(\d+)_(\d+)\n/s)
19 : overbeek 1.1 {
20 :     ($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);
23 : overbeek 1.4 $old_loc = join("_",($contig,$old_beg,$end));
24 :     $new_loc = join("_",($contig,$beg,$end));
25 :     push(@changes,[$peg,$old_loc,$new_loc,$conf_gap]);
26 : overbeek 1.1 }
27 :     }
28 :    
29 :     foreach $_ (sort { $b->[3] <=> $a->[3] } @changes)
30 :     {
31 : overbeek 1.4 ($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 : overbeek 1.5 if ((substr($trans,-1) ne "*") && (($peg =~ /^new/) || (! $fig->possibly_truncated($peg))))
36 : overbeek 1.4 {
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 : overbeek 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3