[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.1, Fri Jun 1 02:14:30 2007 UTC revision 1.2, Fri Jun 1 04:19:16 2007 UTC
# Line 23  Line 23 
23  my $fig = new FIG;  my $fig = new FIG;
24    
25  use FigFams;  use FigFams;
26  my $figfams = new FigFams;  my $figfams = new FigFams($fig);
27    
28  use ToCall;  use ToCall;
29  use NewGenome;  use NewGenome;
# Line 84  Line 84 
84    
85  my (%seq_of, %len_of, $orf_len);  my (%seq_of, %len_of, $orf_len);
86  for my $fid (@orf_ids) {  for my $fid (@orf_ids) {
87      if ($orf_len = $to_call->get_feature_length($fid) > 900) {      if (($orf_len = $to_call->get_feature_length($fid)) > 900) {
88          $len_of{$fid} = $orf_len;          $len_of{$fid} = $orf_len;
89          $seq_of{$fid} = $to_call->get_feature_sequence($fid);          $seq_of{$fid} = $to_call->get_feature_sequence($fid);
90      }      }
# Line 94  Line 94 
94  my %genomes_hit;  my %genomes_hit;
95  my %weight_of_hits;  my %weight_of_hits;
96  foreach my $orf_id (sort { $len_of{$b} <=> $len_of{$a} } keys %len_of) {  foreach my $orf_id (sort { $len_of{$b} <=> $len_of{$a} } keys %len_of) {
     my ($fam, $sims) = $figfams->place_in_family($seq_of{$orf_id});  
     if (@$sims >= $N) {  
   
         my $fid = $to_call->promote_to_peg($orf_id);  
         push @peg_ids, $fid;  
97    
98        print STDERR "\nChecking $orf_id ($len_of{$orf_id})\n" if $ENV{VERBOSE};
99        my ($fam, $sims) = $figfams->place_in_family($seq_of{$orf_id});
100        if (not defined($fam)) {
101            print STDERR "\tCould not place in family --- skipping\n" if $ENV{VERBOSE};
102            next;
103        }
104        else {
105          my $fam_id = $fam->family_id();          my $fam_id = $fam->family_id();
106          my $func   = $fam->family_function();          my $func   = $fam->family_function();
107            print STDERR "\tplaced in $fam_id ("
108                , (scalar @$sims)
109                , " sims)\t$func\n"
110                if $ENV{VERBOSE};
111    
112            my $orf = &NewGenome::ORF::new('NewGenome::ORF', $to_call, $orf_id);
113            my $fid = $orf->promote_to_peg($sims, $func);
114            if ($fid) {
115                push @peg_ids, $fid;
116    
117          print FOUNDFAMS "$fid\t$fam_id\t$func\n";          print FOUNDFAMS "$fid\t$fam_id\t$func\n";
118    
119          for ($i=0; ($i < $N) && ($i < @$sims); ++$i) {          for ($i=0; ($i < $N) && ($i < @$sims); ++$i) {
120              ++$genomes_hit{&FIG::genome_of($sims->[$i]->id2)};              ++$genomes_hit{&FIG::genome_of($sims->[$i]->id2)};
121              $weight_of_hits{&FIG::genome_of($sims->[$i]->id2)} += $sims->[$i]->bsc;                  $weight_of_hits{&FIG::genome_of($sims->[$i]->id2)} +=
122                        ($sims->[$i]->bsc / $len_of{$orf_id});
123                }
124            }
125            else {
126                die "Could not promote $orf_id";
127          }          }
128      }      }
129    
130      last if (@peg_ids >= $N);      last if (@peg_ids >= $N);
131  }  }
132    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3