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

Diff of /FigKernelScripts/build_initial_objects_for_start_predictions.pl

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

revision 1.11, Fri Nov 30 21:53:05 2007 UTC revision 1.12, Sun Jan 20 21:44:52 2008 UTC
# Line 22  Line 22 
22    
23  $0 =~ m/([^\/]+)$/;  $self = $1;  $0 =~ m/([^\/]+)$/;  $self = $1;
24  warn "$0 " . join(" ", @ARGV) . "\n";  warn "$0 " . join(" ", @ARGV) . "\n";
25  $usage = "build_initial_objects_for_start_predictions [-orgdir=OrgDir] [tbl] < pegs_to_call > initial_objects";  $usage = "build_initial_objects_for_start_predictions [-orgdir=OrgDir] [-genetic_code=CodeNum] [tbl] < pegs_to_call > initial_objects";
26    
27  use constant FID    =>  0;  use constant FID    =>  0;
28  use constant LOCUS  =>  1;  use constant LOCUS  =>  1;
# Line 36  Line 36 
36    
37  $tbl_file = "";  $tbl_file = "";
38  $trouble  = 0;  $trouble  = 0;
39    $genetic_code_number = 11;
40  while (@ARGV)  while (@ARGV)
41  {  {
42      if ($ARGV[0] =~ m/-h(elp)?/) {      if ($ARGV[0] =~ m/-h(elp)?/) {
# Line 45  Line 46 
46          warn "Using $ARGV[0]\n";          warn "Using $ARGV[0]\n";
47          $fig = new FIGV($1);          $fig = new FIGV($1);
48      }      }
49        elsif ($ARGV[0] =~ /-genetic_code=(\d+)/) {
50            warn "$self is using $ARGV[0]\n";
51            $genetic_code_number = $1;
52        }
53      elsif (-s $ARGV[0]) {      elsif (-s $ARGV[0]) {
54          $tbl_file = $ARGV[0];          $tbl_file = $ARGV[0];
55      }      }
# Line 55  Line 60 
60  }  }
61  die "\nusage: $usage\n\n" if $trouble;  die "\nusage: $usage\n\n" if $trouble;
62    
63    $code_map = &FIG::genetic_code($genetic_code_number);
64    
65  @pegs = <STDIN>;  @pegs = <STDIN>;
66  chomp @pegs;  chomp @pegs;
67  # print "NPEGS=", scalar(@pegs), "\n";  # print "NPEGS=", scalar(@pegs), "\n";
# Line 179  Line 186 
186      }      }
187    
188  #   The following hack handles uncertainty about whether SEED gives back the STOP or not  #   The following hack handles uncertainty about whether SEED gives back the STOP or not
189      if (substr($seq,-6,3) =~ /TAA|TAG|TGA/i)  
190        if ($fig->translate(substr($seq,-6,3), $code_map) eq qq(*))
191      {      {
192          $end = ($begin < $end) ? $end-3 : $end+3;          $end = ($begin < $end) ? $end-3 : $end+3;
193          $seq = substr($seq,0,length($seq) - 3);          $seq = substr($seq,0,length($seq) - 3);
194      }      }
195      elsif (substr($seq,-3,3) !~ /TAA|TAG|TGA/i)      elsif (($fig->translate(substr($seq,-3,3), $code_map) ne qq(*)) && (not $fig->possibly_truncated($genome, $loc)))
196      {      {
197          warn "BAD STOP: $peg $genome $loc $seq\n";          warn "BAD STOP: $peg $genome $loc $seq\n";
198      }      }
199    
     $loc = join("_",($contig,$begin,$end));  
   
200    
201      # BACK INTO THE STOP FROM START OF PEG      # BACK INTO THE STOP FROM START OF PEG
202      $pre_peg = uc $fig->dna_seq($genome,$l);      $pre_peg = uc $fig->dna_seq($genome,$l);
# Line 200  Line 206 
206      for ($i=$len_pre_peg-3; $i > 0 && ! $found; $i-=3)      for ($i=$len_pre_peg-3; $i > 0 && ! $found; $i-=3)
207      {      {
208          $stop =  substr($pre_peg,$i,3);          $stop =  substr($pre_peg,$i,3);
209          if ($stop eq "TAG"  ||  $stop eq "TAA"  ||  $stop eq "TGA")          if ($fig->translate($stop,  $code_map) eq qq(*))
210          {          {
211              # print "FOUND $stop for $l\n";              # print "FOUND $stop for $l\n";
212              $orf = substr($pre_peg,$i+3) . $seq;              $orf = substr($pre_peg,$i+3) . $seq;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3