[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.11, Tue May 29 19:37:12 2007 UTC revision 1.12, Wed May 30 14:18:03 2007 UTC
# Line 52  Line 52 
52  my %all_inputs;  my %all_inputs;
53  my %all_outputs;  my %all_outputs;
54    
55  #this variable is used to set the loop count for single scenario and then assembly runs, 100/100 by default.  #this variable is used to set the loop count for single scenario and then assembly runs, 100/25 by default.
56  my $loop_max = 100;  my $loop_max = 100;
57  my $loop_max_assembly = 25;  my $loop_max_assembly = 25;
58    
# Line 2691  Line 2691 
2691  sub run_scenario  sub run_scenario
2692  {  {
2693      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;
2694      my $scenario_dir = $fig->scenario_directory($genome) . "/$superset/$subsystem/$scenario";      my $scenario_dir = $fig->scenario_directory($genome) . "/Scenarios/$superset/$subsystem/$scenario";
2695    
2696      system("rm", "-rf", $scenario_dir);      system("rm", "-rf", $scenario_dir);
2697    
# Line 2706  Line 2706 
2706  {  {
2707      my($genome,$superset,$ss_name,$scenario_name) = @_;      my($genome,$superset,$ss_name,$scenario_name) = @_;
2708      my @genome_paths;      my @genome_paths;
2709      my $scenario_dir_all = $fig->scenario_directory('All') . "/$superset/$ss_name/$scenario_name";      my $scenario_dir_all = $fig->scenario_directory('All') . "/Scenarios/$superset/$ss_name/$scenario_name";
2710      my $subsystem = $fig->get_subsystem($ss_name);      my $subsystem = $fig->get_subsystem($ss_name);
2711      my @additional_reactions = @{$subsystem->get_hope_additional_reactions($scenario_name)};      my @additional_reactions = @{$subsystem->get_hope_additional_reactions($scenario_name)};
2712      my %additional_reactions;      my %additional_reactions;
# Line 2764  Line 2764 
2764    
2765      # now check all paths found for this particular organism, and make sure they      # now check all paths found for this particular organism, and make sure they
2766      # are in the appropriate All subdirectory      # are in the appropriate All subdirectory
2767      my $scenario_dir_genome = $fig->scenario_directory($genome). "/$superset/$ss_name/$scenario_name";      my $scenario_dir_genome = $fig->scenario_directory($genome). "/Scenarios/$superset/$ss_name/$scenario_name";
2768    
2769      opendir (DIR_GENOME,$scenario_dir_genome) or die("$scenario_dir_genome");      opendir (DIR_GENOME,$scenario_dir_genome) or die("$scenario_dir_genome");
2770      @sub_dirs  = readdir DIR_GENOME; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..      @sub_dirs  = readdir DIR_GENOME; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..
# Line 2989  Line 2989 
2989    
2990      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;
2991    
2992      my $dir = $fig->scenario_directory($genome) . "/$superset/$subsystem";      my $dir = $fig->scenario_directory($genome) . "/Scenarios/$superset/$subsystem";
2993      system("rm", "-rf",  $dir);      system("rm", "-rf",  $dir);
2994      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
2995    
# Line 3057  Line 3057 
3057      my @subsystems = @{$superset_to_ss{$superset_name}};      my @subsystems = @{$superset_to_ss{$superset_name}};
3058    
3059    
3060      my $dir = $fig->scenario_directory($genome) . "/$superset_name";      my $dir = $fig->scenario_directory($genome) . "/Scenarios/$superset_name";
3061      system("rm", "-rf", $dir);      system("rm", "-rf", $dir);
3062      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3063    
# Line 3174  Line 3174 
3174      clear_arrays();      clear_arrays();
3175    
3176      #This gets us an array of arrays, each subarray holds      #This gets us an array of arrays, each subarray holds
3177      # [0] = genome   [1] = superset   [2] = subsystem   [3] = scenario   [4] = path      # [0] = genome   [1] = Scenarios [2] = superset   [3] = subsystem   [4] = scenario   [5] = path
3178      # OR [0] = genome [1] = assembly [2] = path_name      # OR [0] = genome [1] = assembly [2] = path_name
3179      my @assembly_scenarios = @{parse_assembly_scenarios($paths)};      my @assembly_scenarios = @{parse_assembly_scenarios($paths)};
3180    
# Line 3192  Line 3192 
3192      #load all the kegg information for each 'scenario' from the paths we have selected      #load all the kegg information for each 'scenario' from the paths we have selected
3193      foreach my $scenario (@assembly_scenarios)      foreach my $scenario (@assembly_scenarios)
3194      {      {
3195          if(scalar @$scenario > 4) #this is a normal scenario path          if(scalar @$scenario > 5) #this is a normal scenario path
3196          {          {
3197              print STDERR "Checking $scenario->[2] $scenario->[3] $scenario->[4] \n" if $debug;              print STDERR "Checking $scenario->[3] $scenario->[4] $scenario->[5] \n" if $debug;
3198              process_init($scenario->[2],$scenario->[3],$scenario->[0],1);              process_init($scenario->[3],$scenario->[4],$scenario->[0],1);
3199          }          }
3200          else #This is a assembly path          else #This is a assembly path
3201          {          {
# Line 3239  Line 3239 
3239      print STDERR $paths , "\n" , @$paths, "\n";      print STDERR $paths , "\n" , @$paths, "\n";
3240      print STDERR $genome . "\n";      print STDERR $genome . "\n";
3241      print STDERR $write_name . "\n";      print STDERR $write_name . "\n";
3242      my $dir = $fig->scenario_directory($genome) . "/assembly/$write_name";      my $dir = $fig->scenario_directory($genome) . "/Assemblies/$write_name";
3243      system("rm", "-rf", $dir);      system("rm", "-rf", $dir);
3244      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3245      write_scenario(internal_assembly($paths,[],[],$one_path),$dir);      write_scenario(internal_assembly($paths,[],[],$one_path),$dir);
# Line 3257  Line 3257 
3257          {          {
3258              next;              next;
3259          }          }
3260          my $length = 5;          my $length = 6;
3261          if($path =~ /assembly/)          if($path =~ /Assemblies/)
3262          {          {
3263              $length = 4;              $length = 4;
3264          }          }
# Line 3280  Line 3280 
3280  {  {
3281      my ($path,$count) = @_;      my ($path,$count) = @_;
3282      my @sub_dirs;      my @sub_dirs;
3283      if($path =~ m\assembly$\ || $path =~ m\analysis$\)      if($path =~ m\Assemblies$\ || $path =~ m\Analysis$\)
3284      {      {
3285          return [];          return [];
3286      }      }
# Line 3354  Line 3354 
3354    
3355      #setup the filesystem to store the scenario/paths      #setup the filesystem to store the scenario/paths
3356      my $superset = $ss_to_superset{$ssa};      my $superset = $ss_to_superset{$ssa};
3357      my $base_dir = $fig->scenario_directory($genome) . "/$superset/$ssa/$sc_name/";      my $base_dir = $fig->scenario_directory($genome) . "/Scenarios/$superset/$ssa/$sc_name/";
3358      system("rm", "-rf", $base_dir);      system("rm", "-rf", $base_dir);
3359      &FIG::verify_dir($base_dir);      &FIG::verify_dir($base_dir);
3360    
# Line 3428  Line 3428 
3428      chomp $genome;      chomp $genome;
3429      chomp $name;      chomp $name;
3430      #setup the filesystem to store the assembly      #setup the filesystem to store the assembly
3431      my $base_dir = $fig->scenario_directory($genome). "/assembly/$name";      my $base_dir = $fig->scenario_directory($genome). "/Assemblies/$name";
3432      system("rm", "-rf", $base_dir);      system("rm", "-rf", $base_dir);
3433      &FIG::verify_dir($base_dir);      &FIG::verify_dir($base_dir);
3434    
# Line 3437  Line 3437 
3437      clear_arrays();      clear_arrays();
3438    
3439      #This gets us an array of arrays, each subarray holds      #This gets us an array of arrays, each subarray holds
3440      # [0] = genome   [1] = superset   [2] = subsystem   [3] = scenario   [4] = path      # [0] = genome [1] = Scenarios  [2] = superset   [3] = subsystem   [4] = scenario   [5] = path
3441      my @assembly_scenarios = @{parse_assembly_scenarios($file_paths)};      my @assembly_scenarios = @{parse_assembly_scenarios($file_paths)};
3442    
3443      #load all the kegg information for each 'scenario' from the paths we have selected      #load all the kegg information for each 'scenario' from the paths we have selected
3444      foreach my $scenario (@assembly_scenarios)      foreach my $scenario (@assembly_scenarios)
3445      {      {
3446          print STDERR "Checking $scenario->[2] $scenario->[3] $scenario->[4] \n" if $debug;          print STDERR "Checking $scenario->[3] $scenario->[4] $scenario->[5] \n" if $debug;
3447          process_init($scenario->[2],$scenario->[3],$scenario->[0],1);          process_init($scenario->[3],$scenario->[4],$scenario->[0],1);
3448      }      }
3449      #assume all path inputs and outputs are main      #assume all path inputs and outputs are main
3450      map { $all_compounds_to_main{$_} = 1 } keys %all_inputs;      map { $all_compounds_to_main{$_} = 1 } keys %all_inputs;
# Line 3633  Line 3633 
3633  sub analyze_scenario_connections  sub analyze_scenario_connections
3634  {  {
3635      my ($genome_id) = @_;      my ($genome_id) = @_;
3636      my @paths = @{model::parse_assembly_scenarios(["/$genome_id/"])};      my $scenario_dir = $fig->scenario_directory($genome_id)."/Scenarios";
3637        my @paths = `find -L $scenario_dir -type d -name "path_*"`;
3638    
3639      my %inputs;      my %inputs;
3640      my %outputs;      my %outputs;
3641    
3642      foreach my $path (@paths)      foreach my $dir (@paths)
3643      {      {
3644          my $dir = $fig->scenario_directory() . "/" . join "/" , @$path;          chomp $dir;
3645          my ($cat, $subsys, $scenario);          my ($cat, $subsys, $scenario);
3646    
3647          if ($dir =~ (/$genome_id\/(.*)\/(.*)\/(.*)\//)){          print STDERR "Processing $dir\n";
3648    
3649            if ($dir =~ (/$genome_id\/Scenarios\/(.*)\/(.*)\/(.*)\//)){
3650              $cat = $1;              $cat = $1;
3651              $subsys = $2;              $subsys = $2;
3652              $scenario = $3;              $scenario = $3;
# Line 3674  Line 3677 
3677              $outputs{$cpd}->{$info} = 1 if $main eq "1";              $outputs{$cpd}->{$info} = 1 if $main eq "1";
3678          }          }
3679          close M_OUTPUTS;          close M_OUTPUTS;
3680        }
3681    
3682          my $analysis_dir = $fig->scenario_directory($genome_id) . "/analysis";      my $analysis_dir = $fig->scenario_directory($genome_id) . "/Analysis";
3683          rmtree $analysis_dir;          rmtree $analysis_dir;
3684          mkdir $analysis_dir;          mkdir $analysis_dir;
3685    
# Line 3693  Line 3697 
3697          }          }
3698          close OUT_CONN;          close OUT_CONN;
3699      }      }
 }  
3700    
3701  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3