[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.9, Wed May 23 22:21:47 2007 UTC revision 1.10, Tue May 29 19:16:26 2007 UTC
# Line 300  Line 300 
300    
301      foreach my $path (@$assembly_paths)      foreach my $path (@$assembly_paths)
302      {      {
303          my $paths_dir = "$FIG_Config::var/Models/" . join "/" , @$path;          my $paths_dir = $fig->scenario_directory() . "/" . join "/" , @$path;
304    
305          my $drxn = "$path->[-3]/$path->[-2]/$path->[-1]_R";          my $drxn = "$path->[-3]/$path->[-2]/$path->[-1]_R";
306    
# Line 2623  Line 2623 
2623  sub clear_dir_for_genome  sub clear_dir_for_genome
2624  {  {
2625      my ($genome) = @_;      my ($genome) = @_;
2626      rmtree("$FIG_Config::var/Models/$genome");      rmtree($fig->scenario_directory($genome));
2627  }  }
2628    
2629  sub load_superset_file  sub load_superset_file
# Line 2680  Line 2680 
2680  sub run_scenario  sub run_scenario
2681  {  {
2682      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;
2683      my $scenario_dir = "$FIG_Config::var/Models/$genome/$superset/$subsystem/$scenario";      my $scenario_dir = $fig->scenario_directory($genome) . "/$superset/$subsystem/$scenario";
2684    
2685      system("rm", "-rf", $scenario_dir);      system("rm", "-rf", $scenario_dir);
2686    
2687      mkdir "$FIG_Config::var/Models/$genome/";      &FIG::verify_dir($scenario_dir);
     mkdir "$FIG_Config::var/Models/$genome/$superset";  
     mkdir "$FIG_Config::var/Models/$genome/$superset/$subsystem";  
     mkdir $scenario_dir;  
2688    
2689      #make sure the arrays are empty to start out      #make sure the arrays are empty to start out
2690      &clear_arrays;      &clear_arrays;
# Line 2698  Line 2695 
2695  {  {
2696      my($genome,$superset,$ss_name,$scenario_name) = @_;      my($genome,$superset,$ss_name,$scenario_name) = @_;
2697      my @genome_paths;      my @genome_paths;
2698      my $scenario_dir_all = "$FIG_Config::var/Models/All/$superset/$ss_name/$scenario_name";      my $scenario_dir_all = $fig->scenario_directory('All') . "/$superset/$ss_name/$scenario_name";
2699      my $subsystem = $fig->get_subsystem($ss_name);      my $subsystem = $fig->get_subsystem($ss_name);
2700      my @additional_reactions = @{$subsystem->get_hope_additional_reactions($scenario_name)};      my @additional_reactions = @{$subsystem->get_hope_additional_reactions($scenario_name)};
2701      my %additional_reactions;      my %additional_reactions;
# Line 2756  Line 2753 
2753    
2754      # 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
2755      # are in the appropriate All subdirectory      # are in the appropriate All subdirectory
2756      my $scenario_dir_genome = "$FIG_Config::var/Models/$genome/$superset/$ss_name/$scenario_name";      my $scenario_dir_genome = $fig->scenario_directory($genome). "/$superset/$ss_name/$scenario_name";
2757    
2758      opendir (DIR_GENOME,$scenario_dir_genome) or die("$scenario_dir_genome");      opendir (DIR_GENOME,$scenario_dir_genome) or die("$scenario_dir_genome");
2759      @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 2972  Line 2969 
2969      my ($genome,$superset,$subsystem,$find_first) = @_;      my ($genome,$superset,$subsystem,$find_first) = @_;
2970    
2971      my $subsystem_obj = $fig->get_subsystem($subsystem);      my $subsystem_obj = $fig->get_subsystem($subsystem);
2972    
2973        if (!$subsystem_obj)
2974        {
2975            warn "Cannot open subsystem $subsystem\n";
2976            return;
2977        }
2978    
2979      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;
2980    
2981      system("rm", "-rf",  "$FIG_Config::var/Models/$genome/$superset/$subsystem");      my $dir = $fig->scenario_directory($genome) . "/$superset/$subsystem";
2982      mkdir "$FIG_Config::var/Models/$genome/";      system("rm", "-rf",  $dir);
2983      mkdir "$FIG_Config::var/Models/$genome/$superset";      &FIG::verify_dir($dir);
     mkdir "$FIG_Config::var/Models/$genome/$superset/$subsystem";  
2984    
2985      foreach my $name (@ss_scenarios)      foreach my $name (@ss_scenarios)
2986      {      {
# Line 3034  Line 3037 
3037    
3038      my @subsystems = @{$superset_to_ss{$superset_name}};      my @subsystems = @{$superset_to_ss{$superset_name}};
3039    
3040      `rm -rf $FIG_Config::var/Models/$genome/$superset_name`;  
3041      mkdir "$FIG_Config::var/Models/$genome/";      my $dir = $fig->scenario_directory($genome) . "/$superset_name";
3042      mkdir "$FIG_Config::var/Models/$genome/$superset_name";      system("rm", "-rf", $dir);
3043        &FIG::verify_dir($dir);
3044    
3045      foreach my $ss_name (@subsystems)      foreach my $ss_name (@subsystems)
3046      {      {
# Line 3177  Line 3181 
3181          else #This is a assembly path          else #This is a assembly path
3182          {          {
3183              #read in the input/output compounds and mark main's correctly              #read in the input/output compounds and mark main's correctly
3184              my $path = "$FIG_Config::var/Models/" . join "/" , @$scenario;              my $path = $fig->scenario_directory() . "/" . join "/" , @$scenario;
3185    
3186              open(M_IN,"$path/inputs_main");              open(M_IN,"$path/inputs_main");
3187              while(<M_IN>)              while(<M_IN>)
# Line 3216  Line 3220 
3220      print STDERR $paths , "\n" , @$paths, "\n";      print STDERR $paths , "\n" , @$paths, "\n";
3221      print STDERR $genome . "\n";      print STDERR $genome . "\n";
3222      print STDERR $write_name . "\n";      print STDERR $write_name . "\n";
3223      `rm -rf $FIG_Config::var/Models/$genome/assembly/$write_name`;      my $dir = $fig->scenario_directory($genome) . "/assembly/$write_name";
3224      mkdir "$FIG_Config::var/Models/$genome/assembly";      system("rm", "-rf", $dir);
3225      mkdir "$FIG_Config::var/Models/$genome/assembly/$write_name";      &FIG::verify_dir($dir);
3226      write_scenario(internal_assembly($paths,[],[],$one_path),"$FIG_Config::var/Models/$genome/assembly/$write_name");      write_scenario(internal_assembly($paths,[],[],$one_path),$dir);
3227  }  }
3228    
3229  sub expand_paths  sub expand_paths
# Line 3264  Line 3268 
3268      if($count !=0)      if($count !=0)
3269      {      {
3270  #read this path, and pull out all the sub-directories.  #read this path, and pull out all the sub-directories.
3271          print STDERR "reading directory $FIG_Config::var/Models/$path/\n" if $debug;          my $model_dir = $fig->scenario_directory() . "/$path/";
3272          opendir (DIR,"$FIG_Config::var/Models/$path/") or die("$path");  
3273          print STDERR "reading directory $FIG_Config::var/Models/$path/\n" if $debug;          print STDERR "reading directory $model_dir\n" if $debug;
3274            opendir (DIR, $model_dir) or die("$path");
3275            print STDERR "reading directory $model_dir\n" if $debug;
3276          @sub_dirs  = readdir DIR; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..          @sub_dirs  = readdir DIR; shift @sub_dirs; shift @sub_dirs; # get rid of . and ..
3277          close DIR;          close DIR;
3278          print STDERR "Found: " if $debug;          print STDERR "Found: " if $debug;
# Line 3329  Line 3335 
3335    
3336      #setup the filesystem to store the scenario/paths      #setup the filesystem to store the scenario/paths
3337      my $superset = $ss_to_superset{$ssa};      my $superset = $ss_to_superset{$ssa};
3338      my $base_dir = "$FIG_Config::var/Models/$genome/$superset/$ssa/$sc_name/";      my $base_dir = $fig->scenario_directory($genome) . "/$superset/$ssa/$sc_name/";
3339      system("rm", "-rf", $base_dir);      system("rm", "-rf", $base_dir);
3340      mkdir "$FIG_Config::var/Models/$genome";      &FIG::verify_dir($base_dir);
     mkdir "$FIG_Config::var/Models/$genome/$superset";  
     mkdir "$FIG_Config::var/Models/$genome/$superset/$ssa/";  
     mkdir $base_dir;  
3341    
3342      #for the selected paths, lets gather their cpd from the checkbox and write      #for the selected paths, lets gather their cpd from the checkbox and write
3343      #the path that we need      #the path that we need
# Line 3406  Line 3409 
3409      chomp $genome;      chomp $genome;
3410      chomp $name;      chomp $name;
3411      #setup the filesystem to store the assembly      #setup the filesystem to store the assembly
3412      my $base_dir = "$FIG_Config::var/Models/$genome/assembly/$name";      my $base_dir = $fig->scenario_directory($genome). "/assembly/$name";
3413      `rm -rf $base_dir`;      system("rm", "-rf", $base_dir);
3414      mkdir "$FIG_Config::var/Models/$genome/assembly";      &FIG::verify_dir($base_dir);
3415      mkdir $base_dir;  
3416    
3417      ##Here we want to reload the cpd and rxn info so we can write it later      ##Here we want to reload the cpd and rxn info so we can write it later
3418      clear_arrays();      clear_arrays();
# Line 3618  Line 3621 
3621    
3622      foreach my $path (@paths)      foreach my $path (@paths)
3623      {      {
3624          my $dir = "$FIG_Config::var/Models/" . join "/" , @$path;          my $dir = $fig->scenario_directory() . "/" . join "/" , @$path;
3625          my ($cat, $subsys, $scenario);          my ($cat, $subsys, $scenario);
3626    
3627          if ($dir =~ (/$genome_id\/(.*)\/(.*)\/(.*)\//)){          if ($dir =~ (/$genome_id\/(.*)\/(.*)\/(.*)\//)){
# Line 3653  Line 3656 
3656          }          }
3657          close M_OUTPUTS;          close M_OUTPUTS;
3658    
3659          my $analysis_dir = "$FIG_Config::var/Models/$genome_id/analysis";          my $analysis_dir = $fig->scenario_directory($genome_id) . "/analysis";
3660          rmtree $analysis_dir;          rmtree $analysis_dir;
3661          mkdir $analysis_dir;          mkdir $analysis_dir;
3662    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3