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

Diff of /FigKernelScripts/find_neighbors_using_figfams.pl

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

revision 1.6, Thu Jan 31 15:31:39 2008 UTC revision 1.8, Wed Feb 13 23:04:18 2008 UTC
# Line 37  Line 37 
37    
38  my ($i, $fam_data, $to_call_dir, $N, $foundF);  my ($i, $fam_data, $to_call_dir, $N, $foundF);
39    
40  # First, let's determine which FigfamsData directory to use  #...First, let's determine which FigfamsData directory to use:
   
41  for ($i=0; ($i < @ARGV) && ($ARGV[$i] !~ /^-fams=/); $i++) {}  for ($i=0; ($i < @ARGV) && ($ARGV[$i] !~ /^-fams=/); $i++) {}
42  if ($i < @ARGV) {  if ($i < @ARGV) {
43      if ($ARGV[$i] =~ /^-fams=(\S+)/) {      if ($ARGV[$i] =~ /^-fams=(\S+)/) {
# Line 58  Line 57 
57  (  (
58   ($to_call_dir = shift @ARGV) &&   ($to_call_dir = shift @ARGV) &&
59   ($N           = shift @ARGV) &&   ($N           = shift @ARGV) &&
60   ($foundF      = shift @ARGV) && open(FOUNDFAMS, ">>$foundF")   ($foundF      = shift @ARGV)
61  )  )
62      || die "\n   $usage\n\n";      || die "\n   $usage\n\n";
63    
# Line 79  Line 78 
78      $to_call = new NewGenome($to_call_dir);      $to_call = new NewGenome($to_call_dir);
79  }  }
80    
81    
82    open(FOUNDFAMS, ">>$foundF") || die "Could not append-open $foundF";
83    
84    my $called_by_file = "$to_call_dir/called_by";
85    open(CALLED_BY, ">>$called_by_file")
86        || die "Could not append-open $called_by_file";
87    
88    
89    #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
90    #...Get the current ORF-calls if they exist;
91    #   else, try to call a set of candidate ORFs.
92    #-----------------------------------------------------------------------
93  my @orf_ids = $to_call->get_fids_for_type('orf');  my @orf_ids = $to_call->get_fids_for_type('orf');
94  if (not @orf_ids) {  if (not @orf_ids) {
95      $to_call->possible_orfs;      $to_call->possible_orfs();
96      @orf_ids = $to_call->get_fids_for_type('orf');      @orf_ids = $to_call->get_fids_for_type('orf');
97  }  }
98    
# Line 93  Line 104 
104      }      }
105  }  }
106    
107    
108  my @peg_ids = ();  my @peg_ids = ();
109  my %genomes_hit;  my %genomes_hit;
110  my %weight_of_hits;  my %weight_of_hits;
# Line 115  Line 127 
127          my $fid;          my $fid;
128          if (! $old)          if (! $old)
129          {          {
130                my $annot = [ qq(RAST),
131                              qq($func\nCalled by "$self" using FIGfam $fam_id.)
132                              ];
133              my $orf = &NewGenome::ORF::new('NewGenome::ORF', $to_call, $orf_id);              my $orf = &NewGenome::ORF::new('NewGenome::ORF', $to_call, $orf_id);
134              $fid = $orf->promote_to_peg($sims, $func);              $fid      = $orf->promote_to_peg($sims, $func, $annot);
135    
136                if ($fid) {
137                    print CALLED_BY "$fid\t$self\n";
138                    print FOUNDFAMS "$fid\t$fam_id\t$func\n";
139                }
140                else {
141                    die "Could not promote $orf_id";
142          }          }
         else  
         {  
             $fid = $orf_id;  
143          }          }
144    
145          if ($fid) {          if ($fid) {
146              push @peg_ids, $fid;              push @peg_ids, $fid;
147    
             print FOUNDFAMS "$fid\t$fam_id\t$func\n";  
   
148              for ($i=0; ($i < $N) && ($i < @$sims); ++$i) {              for ($i=0; ($i < $N) && ($i < @$sims); ++$i) {
149                  ++$genomes_hit{&FIG::genome_of($sims->[$i]->id2)};                  ++$genomes_hit{&FIG::genome_of($sims->[$i]->id2)};
150                    next unless $sims->[$i]->ln2;
151                  $weight_of_hits{&FIG::genome_of($sims->[$i]->id2)} +=                  $weight_of_hits{&FIG::genome_of($sims->[$i]->id2)} +=
152                      ($sims->[$i]->bsc / $sims->[$i]->ln2);                      ($sims->[$i]->bsc / $sims->[$i]->ln2);
153              }              }
# Line 153  Line 171 
171  for ($i=0; ($i < $N) && ($i < @best); ++$i) {  for ($i=0; ($i < $N) && ($i < @best); ++$i) {
172      print "$best[$i]\t$genomes_hit{$best[$i]}\t$weight_of_hits{$best[$i]}\n";      print "$best[$i]\t$genomes_hit{$best[$i]}\t$weight_of_hits{$best[$i]}\n";
173  }  }
174    
175    $to_call->export_features();
176    
177    close(CALLED_BY);
178  close(FOUNDFAMS);  close(FOUNDFAMS);
 $to_call->export_features;  
179    
180  exit(0);  exit(0);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3