[Bio] / FigKernelPackages / model.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/model.pm

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

revision 1.17, Fri Nov 2 19:12:58 2007 UTC revision 1.18, Mon Mar 31 19:17:09 2008 UTC
# Line 128  Line 128 
128    
129  sub process_init  sub process_init
130  {  {
131      my ($ss_name,$scenario_name,$genome,$assembly) = @_;      my ($ss_name,$scenario_name,$genome,$assembly,$additional_reactions_for_org) = @_;
132      my (%sc_inputs, %sc_outputs);      my (%sc_inputs, %sc_outputs);
133    
134      if ($genome eq "")      if ($genome eq "")
# Line 154  Line 154 
154      {      {
155          my %reactions_for_genome = $subsystem->get_hope_reactions_for_genome($genome);          my %reactions_for_genome = $subsystem->get_hope_reactions_for_genome($genome);
156          map { $ss_reactions{$_} = 1 } keys %reactions_for_genome if defined %reactions_for_genome;          map { $ss_reactions{$_} = 1 } keys %reactions_for_genome if defined %reactions_for_genome;
157            map { $ss_reactions{$_} = 1 } @$additional_reactions_for_org if defined $additional_reactions_for_org;
158      }      }
159    
160      map { $sc_inputs{$_} = 1 } @{$scenario_data->{inputs}};      map { $sc_inputs{$_} = 1 } @{$scenario_data->{inputs}};
# Line 2705  Line 2706 
2706    
2707  sub load_scenario  sub load_scenario
2708  {  {
2709      my ($genome,$ssa,$scenario) = @_;      my ($genome,$ssa,$scenario,$additional_reactions_for_org) = @_;
2710    
2711      #load up the arrays with the info we need      #load up the arrays with the info we need
2712      process_init($ssa,$scenario,$genome,0);      process_init($ssa,$scenario,$genome,0,$additional_reactions_for_org);
2713    
2714      #assume all path inputs and outputs are main      #assume all path inputs and outputs are main
2715      map { $all_compounds_to_main{$_} = 1 } keys %all_inputs;      map { $all_compounds_to_main{$_} = 1 } keys %all_inputs;
# Line 2718  Line 2719 
2719    
2720  sub internal_scenario  sub internal_scenario
2721  {  {
2722      my ($genome,$ssa,$scenario,$find_first) = @_;      my ($genome,$ssa,$scenario,$find_first,$additional_reactions_for_org) = @_;
2723    
2724      print STDERR "\nIn internal_scenario with '$genome', '$ssa', '$scenario', '$find_first'\n" if $debug;      print STDERR "\nIn internal_scenario with '$genome', '$ssa', '$scenario', '$find_first'\n" if $debug;
2725    
2726      load_scenario($genome,$ssa,$scenario);      load_scenario($genome,$ssa,$scenario,$additional_reactions_for_org);
2727    
2728      return execute_paths([],$find_first,[],[]);      return execute_paths([],$find_first,[],[]);
2729  }  }
2730    
2731  sub run_scenario  sub run_scenario
2732  {  {
2733      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;      my($genome,$superset,$subsystem,$scenario,$find_first,$additional_reactions_for_org) = @_;
2734      my $scenario_dir = $fig->model_directory($genome) . "/Scenarios/$superset/$subsystem/$scenario";      my $scenario_dir = $fig->model_directory($genome) . "/Scenarios/$superset/$subsystem/$scenario";
2735    
2736      system("rm", "-rf", $scenario_dir);      system("rm", "-rf", $scenario_dir);
   
2737      &FIG::verify_dir($scenario_dir);      &FIG::verify_dir($scenario_dir);
2738    
2739      #make sure the arrays are empty to start out      #make sure the arrays are empty to start out
2740      &clear_arrays;      &clear_arrays;
2741      write_scenario(internal_scenario($genome,$subsystem,$scenario,$find_first),$scenario_dir);      write_scenario(internal_scenario($genome,$subsystem,$scenario,$find_first,$additional_reactions_for_org),$scenario_dir);
2742  }  }
2743    
2744  sub compare_scenario  sub compare_scenario
# Line 2770  Line 2770 
2770      # first find paths in the All directory that should be valid for the genome      # first find paths in the All directory that should be valid for the genome
2771      # based on the reactions associated with it in the subsystems      # based on the reactions associated with it in the subsystems
2772      opendir (DIR_ALL,$scenario_dir_all) or return [];      opendir (DIR_ALL,$scenario_dir_all) or return [];
2773      my @sub_dirs  = readdir DIR_ALL; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..      my @sub_dirs  = readdir DIR_ALL;
2774      close DIR_ALL;      close DIR_ALL;
2775    
2776      my %paths_all;      my %paths_all;
2777    
2778      for my $path (@sub_dirs)      for my $path (@sub_dirs)
2779      {      {
2780            next if $path !~ /path/; # skip . and ..
2781          my $match = 1;          my $match = 1;
2782          open (PATH, "$scenario_dir_all/$path/path_info");          open (PATH, "$scenario_dir_all/$path/path_info");
2783          my @reactions = <PATH>;          my @reactions = <PATH>;
# Line 2806  Line 2807 
2807      my $scenario_dir_genome = $fig->model_directory($genome). "/Scenarios/$superset/$ss_name/$scenario_name";      my $scenario_dir_genome = $fig->model_directory($genome). "/Scenarios/$superset/$ss_name/$scenario_name";
2808    
2809      opendir (DIR_GENOME,$scenario_dir_genome) or return \@genome_paths;      opendir (DIR_GENOME,$scenario_dir_genome) or return \@genome_paths;
2810      @sub_dirs  = readdir DIR_GENOME; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..      @sub_dirs  = readdir DIR_GENOME;
2811      close DIR_GENOME;      close DIR_GENOME;
2812    
2813      my $path_counter = scalar keys %paths_all;      my $path_counter = scalar keys %paths_all;
2814    
2815      for my $path (@sub_dirs)      for my $path (@sub_dirs)
2816      {      {
2817            next if $path !~ /path/; # skip . and ..
2818          my $match = 1;          my $match = 1;
2819          open (PATH, "$scenario_dir_genome/$path/path_info");          open (PATH, "$scenario_dir_genome/$path/path_info");
2820          my @reactions = <PATH>;          my @reactions = <PATH>;
# Line 3343  Line 3345 
3345          print STDERR "reading directory $model_dir\n" if $debug;          print STDERR "reading directory $model_dir\n" if $debug;
3346          opendir (DIR, $model_dir) or die("$model_dir");          opendir (DIR, $model_dir) or die("$model_dir");
3347          print STDERR "reading directory $model_dir\n" if $debug;          print STDERR "reading directory $model_dir\n" if $debug;
3348          @sub_dirs  = readdir DIR; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..          @sub_dirs  = readdir DIR;
3349          close DIR;          close DIR;
3350          print STDERR "Found: " if $debug;          print STDERR "Found: " if $debug;
3351          print STDERR @sub_dirs , "," if $debug;          print STDERR @sub_dirs , "," if $debug;
# Line 3357  Line 3359 
3359      my @to_return;      my @to_return;
3360      foreach my $sub_path (@sub_dirs)      foreach my $sub_path (@sub_dirs)
3361      {      {
3362            next if $sub_path =~ /^\.$/ || $sub_path =~ /^\.\.$/;
3363          print STDERR "Calling on $sub_path , $count \n" if $debug;          print STDERR "Calling on $sub_path , $count \n" if $debug;
3364          push @to_return , @{expand_recursive("$path/$sub_path",$count)};          push @to_return , @{expand_recursive("$path/$sub_path",$count)};
3365      }      }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3