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

Diff of /FigKernelScripts/FFB2_compare_tests.pl

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

revision 1.1, Thu Apr 1 19:28:40 2010 UTC revision 1.2, Wed Jun 23 21:16:51 2010 UTC
# Line 100  Line 100 
100      $results->{prev_version} = $ff_rel_1;      $results->{prev_version} = $ff_rel_1;
101      $results->{this_data} = $f2;      $results->{this_data} = $f2;
102      $results->{prev_data} = $f1;      $results->{prev_data} = $f1;
103        $results->{num_calls_lost} = 0;
104        $results->{num_calls_gained} = 0;
105        $results->{num_calls_same} = 0;
106        $results->{num_calls_diff} = 0;
107    
108      #      #
109      # Read first run.      # Read first run.
# Line 169  Line 173 
173    
174      close(F);      close(F);
175    
176        #
177        # Compute differences in metabolic reconstructions.
178        # They are in
179        #
180        my $meta_old = $f1;
181        $meta_old =~ s/\.out$/.reconstruction/;
182        my $meta_new = $f2;
183        $meta_new =~ s/\.out$/.reconstruction/;
184    
185        my ($in_rec_old, $ss_old) = &count_lines($meta_old);
186        my ($in_rec_new, $ss_new) = &count_lines($meta_new);
187    
188        $results->{prev_ss_in_reconstruction} = $ss_old;
189        $results->{this_ss_in_reconstruction} = $ss_new;
190        $results->{ss_in_reconstruction_gained} = int($ss_new - $ss_old);
191    
192        $results->{prev_pegs_in_reconstruction} = $in_rec_old;
193        $results->{this_pegs_in_reconstruction} = $in_rec_new;
194        $results->{pegs_in_reconstruction_gained} = int($in_rec_new - $in_rec_old);
195    
196      open(OUT, ">", "$out_dir/$k.$genome") or die "Cannot write $out_dir/$k.$genome: $!";      open(OUT, ">", "$out_dir/$k.$genome") or die "Cannot write $out_dir/$k.$genome: $!";
197      print OUT Dump($results);      print OUT Dump($results);
198      close(OUT);      close(OUT);
199  }  }
200    
201    sub count_lines
202    {
203        my($f) = @_;
204        if (!open(F, "<", $f))
205        {
206            return (0, 0);
207        }
208        my $n = 0;
209        my %ss;
210        while (<F>)
211        {
212            chomp;
213            my($id, $fn, $subsys) = split(/\t/);
214            $ss{$subsys}++;
215            $n++;
216        }
217        close(F);
218        return $n, int(keys %ss);
219    }
220    
221  sub validate  sub validate
222  {  {

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3