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

Annotation of /FigKernelScripts/changed_starts.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : overbeek 1.3 # -*- perl -*-
2 : olson 1.7 #
3 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
4 :     # for Interpretations of Genomes. All Rights Reserved.
5 :     #
6 :     # This file is part of the SEED Toolkit.
7 :     #
8 :     # The SEED Toolkit is free software. You can redistribute
9 :     # it and/or modify it under the terms of the SEED Toolkit
10 :     # Public License.
11 :     #
12 :     # You should have received a copy of the SEED Toolkit Public License
13 :     # along with this program; if not write to the University of Chicago
14 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
15 :     # Genomes at veronika@thefig.info or download a copy from
16 :     # http://www.theseed.org/LICENSE.TXT.
17 :     #
18 :    
19 : overbeek 1.1
20 :     use FIG;
21 : overbeek 1.4 my $fig = new FIG;
22 : overbeek 1.1
23 :     $usage = "usage: changed_starts Proposed Annotations >> modified.starts";
24 :    
25 :     (
26 :     ($proposed = shift @ARGV) && open(PROPOSED,"<$proposed") &&
27 : overbeek 1.4 ($annotations = shift @ARGV) && open(ANN,">$annotations")
28 : overbeek 1.1 )
29 :     || die $usage;
30 :    
31 :     $/ = "///\n";
32 :    
33 :     while (defined($entry = <PROPOSED>))
34 :     {
35 : 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)
36 : overbeek 1.1 {
37 :     ($peg,$old_pos,$new_pos,$conf_gap,$contig,$beg,$end) = ($1,$2,$3,$4,$5,$6,$7);
38 :    
39 :     $old_beg = ($beg < $end) ? $beg - ($new_pos-$old_pos) : $beg + ($new_pos-$old_pos);
40 : overbeek 1.4 $old_loc = join("_",($contig,$old_beg,$end));
41 :     $new_loc = join("_",($contig,$beg,$end));
42 :     push(@changes,[$peg,$old_loc,$new_loc,$conf_gap]);
43 : overbeek 1.1 }
44 :     }
45 :    
46 :     foreach $_ (sort { $b->[3] <=> $a->[3] } @changes)
47 :     {
48 : overbeek 1.4 ($peg,$old_loc,$new_loc,$conf_gap) = @$_;
49 : overbeek 1.6 $peg =~ /\|(\d+\.\d+)/;
50 :     $genome = $1;
51 : overbeek 1.4 $dna = $fig->dna_seq($genome,$new_loc);
52 :     $trans = $fig->translate($dna,undef,'start');
53 : overbeek 1.5 if ((substr($trans,-1) ne "*") && (($peg =~ /^new/) || (! $fig->possibly_truncated($peg))))
54 : overbeek 1.4 {
55 :     print STDERR "missing STOP on $peg\n";
56 :     }
57 :     else
58 :     {
59 :     $trans =~ s/\*$//;
60 :     }
61 :     print join("\t",($peg,$old_loc,$new_loc,$conf_gap,$trans)),"\n";
62 :     print ANN "$peg\tChanged start from $old_loc to $new_loc\n";
63 : overbeek 1.1 }

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3