[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.22, Wed Nov 5 15:25:06 2008 UTC revision 1.23, Wed Nov 12 18:19:12 2008 UTC
# Line 315  Line 315 
315      foreach my $path (@$assembly_paths)      foreach my $path (@$assembly_paths)
316      {      {
317          my $genome = shift @$path;          my $genome = shift @$path;
318          my $paths_dir = get_model_directory($genome) . "/" . join "/" , @$path;          my $paths_dir = get_scenario_directory($genome) . "/" . join "/" , @$path;
319    
320          my $drxn = "$path->[-3]/$path->[-2]/$path->[-1]_R";          my $drxn = "$path->[-3]/$path->[-2]/$path->[-1]_R";
321    
# Line 2748  Line 2748 
2748  sub run_scenario  sub run_scenario
2749  {  {
2750      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;      my($genome,$superset,$subsystem,$scenario,$find_first) = @_;
2751      my $scenario_dir = get_model_directory($genome) . "/Scenarios/$superset/$subsystem/$scenario";      my $scenario_dir = get_scenario_directory($genome) . "/PathInfo/$superset/$subsystem/$scenario";
2752    
2753      system("rm", "-rf", $scenario_dir);      system("rm", "-rf", $scenario_dir);
2754      &FIG::verify_dir($scenario_dir);      &FIG::verify_dir($scenario_dir);
# Line 2762  Line 2762 
2762  {  {
2763      my($genome,$superset,$ss_name,$scenario_name,$dont_copy) = @_;      my($genome,$superset,$ss_name,$scenario_name,$dont_copy) = @_;
2764      my @genome_paths;      my @genome_paths;
2765      my $scenario_dir_all = get_model_directory('All') . "/Scenarios/$superset/$ss_name/$scenario_name";      my $scenario_dir_all = get_scenario_directory('All') . "/PathInfo/$superset/$ss_name/$scenario_name";
2766      my $subsystem = $fig->get_subsystem($ss_name);      my $subsystem = $fig->get_subsystem($ss_name);
2767      my @additional_reactions = $subsystem->get_hope_additional_reactions($scenario_name);      my @additional_reactions = $subsystem->get_hope_additional_reactions($scenario_name);
2768      my %additional_reactions;      my %additional_reactions;
# Line 2821  Line 2821 
2821    
2822      # 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
2823      # are in the appropriate All subdirectory      # are in the appropriate All subdirectory
2824      my $scenario_dir_genome = get_model_directory($genome). "/Scenarios/$superset/$ss_name/$scenario_name";      my $scenario_dir_genome = get_scenario_directory($genome). "/PathInfo/$superset/$ss_name/$scenario_name";
2825    
2826      opendir (DIR_GENOME,$scenario_dir_genome) or return \@genome_paths;      opendir (DIR_GENOME,$scenario_dir_genome) or return \@genome_paths;
2827      @sub_dirs  = readdir DIR_GENOME;      @sub_dirs  = readdir DIR_GENOME;
# Line 3060  Line 3060 
3060    
3061      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;      my @ss_scenarios = $subsystem_obj->get_hope_scenario_names;
3062    
3063      my $dir = get_model_directory($genome) . "/Scenarios/$superset/$subsystem";      my $dir = get_scenario_directory($genome) . "/PathInfo/$superset/$subsystem";
3064      system("rm", "-rf",  $dir);      system("rm", "-rf",  $dir);
3065      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3066    
# Line 3127  Line 3127 
3127      my @subsystems = @{$superset_to_ss{$superset_name}};      my @subsystems = @{$superset_to_ss{$superset_name}};
3128    
3129    
3130      my $dir = get_model_directory($genome) . "/Scenarios/$superset_name";      my $dir = get_scenario_directory($genome) . "/PathInfo/$superset_name";
3131      system("rm", "-rf", $dir);      system("rm", "-rf", $dir);
3132      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3133    
# Line 3174  Line 3174 
3174      my($genome,$find_first) = @_;      my($genome,$find_first) = @_;
3175      &load_superset_file;      &load_superset_file;
3176    
3177      my $dir = get_model_directory($genome) . "/Scenarios/";      my $dir = get_scenario_directory($genome) . "/PathInfo";
3178      system("rm", "-rf", $dir);      system("rm", "-rf", $dir);
3179      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3180    
# Line 3280  Line 3280 
3280          {          {
3281              #read in the input/output compounds and mark main's correctly              #read in the input/output compounds and mark main's correctly
3282              my $genome = shift @$scenario;              my $genome = shift @$scenario;
3283              my $path = get_model_directory($genome) . "/" . join "/" , @$scenario;              my $path = get_scenario_directory($genome) . "/" . join "/" , @$scenario;
3284    
3285              open(M_IN,"$path/inputs_main");              open(M_IN,"$path/inputs_main");
3286              while(<M_IN>)              while(<M_IN>)
# Line 3319  Line 3319 
3319      print STDERR $paths , "\n" , @$paths, "\n";      print STDERR $paths , "\n" , @$paths, "\n";
3320      print STDERR $genome . "\n";      print STDERR $genome . "\n";
3321      print STDERR $write_name . "\n";      print STDERR $write_name . "\n";
3322      my $dir = get_model_directory($genome) . "/Assemblies/$write_name";      my $dir = get_scenario_directory($genome) . "/Assemblies/$write_name";
3323      system("rm", "-rf", $dir);      system("rm", "-rf", $dir);
3324      &FIG::verify_dir($dir);      &FIG::verify_dir($dir);
3325      write_scenario(internal_assembly($paths,[],[],$one_path),$dir);      write_scenario(internal_assembly($paths,[],[],$one_path),$dir);
# Line 3346  Line 3346 
3346          my @parts = split "/", $path;          my @parts = split "/", $path;
3347          shift @parts; # get ride of the first blank entry from /$genome          shift @parts; # get ride of the first blank entry from /$genome
3348          my $length =$length - scalar @parts;          my $length =$length - scalar @parts;
3349            my $genome = shift @parts;
3350          $path = join "/" , @parts;          $path = join "/" , @parts;
3351          print "Length : $length Path: $path\n" if $debug;          print STDERR "Length : $length Path: $path\n" if $debug;
3352          my @temp = @{expand_recursive($path, $length)};          my @temp = @{expand_recursive($genome, $path, $length)};
3353          push @final_paths , @temp if scalar @temp > 0;          push @final_paths , @temp if scalar @temp > 0;
3354      }      }
3355    
# Line 3358  Line 3359 
3359    
3360  sub expand_recursive  sub expand_recursive
3361  {  {
3362      my ($path,$count) = @_;      my ($genome,$path,$count) = @_;
3363      my @sub_dirs;      my @sub_dirs;
3364      if($path =~ m\Assemblies$\ || $path =~ m\Analysis$\)      if($path =~ m\Assemblies$\ || $path =~ m\Analysis$\ || $path =~ m\Curation$\)
3365      {      {
3366          return [];          return [];
3367      }      }
3368      if($count !=0)      if($count !=0)
3369      {      {
3370          #read this path, and pull out all the sub-directories.          #read this path, and pull out all the sub-directories.
3371          my $model_dir = get_model_directory() . "/$path/";          my $model_dir = get_scenario_directory($genome) . "/$path/";
3372    
3373          print STDERR "reading directory $model_dir\n" if $debug;          print STDERR "reading directory $model_dir\n" if $debug;
3374          opendir (DIR, $model_dir) or die("$model_dir");          opendir (DIR, $model_dir) or die("$model_dir");
# Line 3388  Line 3389 
3389      {      {
3390          next if $sub_path =~ /^\.$/ || $sub_path =~ /^\.\.$/;          next if $sub_path =~ /^\.$/ || $sub_path =~ /^\.\.$/;
3391          print STDERR "Calling on $sub_path , $count \n" if $debug;          print STDERR "Calling on $sub_path , $count \n" if $debug;
3392          push @to_return , @{expand_recursive("$path/$sub_path",$count)};          push @to_return , @{expand_recursive($genome, "$path/$sub_path",$count)};
3393      }      }
3394      print STDERR "Returning" ,@to_return if $debug;      print STDERR "Returning" ,@to_return if $debug;
3395      return \@to_return;      return \@to_return;
# Line 3435  Line 3436 
3436    
3437      #setup the filesystem to store the scenario/paths      #setup the filesystem to store the scenario/paths
3438      my $superset = $ss_to_superset{$ssa};      my $superset = $ss_to_superset{$ssa};
3439      my $base_dir = get_model_directory($genome) . "/Scenarios/$superset/$ssa/$sc_name/";      my $base_dir = get_scenario_directory($genome) . "/PathInfo/$superset/$ssa/$sc_name/";
3440      system("rm", "-rf", $base_dir);      system("rm", "-rf", $base_dir);
3441      &FIG::verify_dir($base_dir);      &FIG::verify_dir($base_dir);
3442    
# Line 3509  Line 3510 
3510      chomp $genome;      chomp $genome;
3511      chomp $name;      chomp $name;
3512      #setup the filesystem to store the assembly      #setup the filesystem to store the assembly
3513      my $base_dir = get_model_directory($genome) . "/Assemblies/$name";      my $base_dir = get_scenario_directory($genome) . "/Assemblies/$name";
3514      system("rm", "-rf", $base_dir);      system("rm", "-rf", $base_dir);
3515      &FIG::verify_dir($base_dir);      &FIG::verify_dir($base_dir);
3516    
# Line 3714  Line 3715 
3715  sub analyze_scenario_connections  sub analyze_scenario_connections
3716  {  {
3717      my ($genome_id) = @_;      my ($genome_id) = @_;
3718      my $model_dir = get_model_directory($genome_id);      my $scenario_dir = get_scenario_directory($genome_id);
3719      my $scenario_dir = $model_dir  . "/Scenarios";      my $pathinfo_dir = $scenario_dir  . "/PathInfo";
3720    
3721      #      #
3722      # Mac and Linux don't have the same find options for following symlinks.      # Mac and Linux don't have the same find options for following symlinks.
# Line 3724  Line 3725 
3725      my @paths;      my @paths;
3726      if ($uname =~ /^Darwin/)      if ($uname =~ /^Darwin/)
3727      {      {
3728          @paths = `find -L $scenario_dir -type d -name "path_*"`;          @paths = `find -L $pathinfo_dir -type d -name "path_*"`;
3729      }      }
3730      else      else
3731      {      {
3732          @paths = `find $scenario_dir -follow -type d -name "path_*"`;          @paths = `find $pathinfo_dir -follow -type d -name "path_*"`;
3733      }      }
3734    
3735      my %inputs;      my %inputs;
# Line 3741  Line 3742 
3742    
3743          print STDERR "Processing $dir\n";          print STDERR "Processing $dir\n";
3744    
3745          if ($dir =~ (/$genome_id\/Scenarios\/(.*)\/(.*)\/(.*)\//)){          if ($dir =~ (/\/PathInfo\/(.*)\/(.*)\/(.*)\//)){
3746              $cat = $1;              $cat = $1;
3747              $subsys = $2;              $subsys = $2;
3748              $scenario = $3;              $scenario = $3;
# Line 3774  Line 3775 
3775          close M_OUTPUTS;          close M_OUTPUTS;
3776      }      }
3777    
3778      my $analysis_dir = $model_dir . "/Analysis";      my $analysis_dir = $scenario_dir . "/Analysis";
     #Commented out. was deleting model data from run_model_generation  
     #rmtree $analysis_dir;  
3779      mkdir $analysis_dir;      mkdir $analysis_dir;
3780    
3781      open (IN_CONN, ">$analysis_dir/inputs_to_scenarios");      open (IN_CONN, ">$analysis_dir/inputs_to_scenarios");
# Line 4283  Line 4282 
4282    
4283      # assume that the hope_supersets.txt has been loaded      # assume that the hope_supersets.txt has been loaded
4284      my $superset = $ss_to_superset{$ss_name};      my $superset = $ss_to_superset{$ss_name};
4285      my $pathdir_org = get_model_directory($genome_id);      my $pathdir_org = get_scenario_directory($genome_id);
4286      my $file_path = "$pathdir_org/Curation/Scenarios/$superset/$ss_name/included_reactions_for_org";      my $file_path = "$pathdir_org/Curation/PathInfo/$superset/$ss_name/included_reactions_for_org";
4287      my $subsystem = $fig->get_subsystem($ss_name);      my $subsystem = $fig->get_subsystem($ss_name);
4288    
4289      my %reactions_for_genome = $subsystem->get_hope_reactions_for_genome($genome_id);      my %reactions_for_genome = $subsystem->get_hope_reactions_for_genome($genome_id);
# Line 4299  Line 4298 
4298      return %reactions_for_genome;      return %reactions_for_genome;
4299  }  }
4300    
4301  sub get_model_directory  sub get_scenario_directory
4302  {  {
4303      my ($genome) = @_;      my ($genome) = @_;
4304      # want to match "All" and "All.bk", etc.      # want to match "All" and "All.bk", etc.
4305      return $genome =~ "^All" ? $FIG_Config::global."/Models/$genome" : $fig->model_directory($genome);      return $genome =~ "^All" ? $FIG_Config::global."/Models/$genome/Scenarios" : $fig->scenario_directory($genome);
4306    
4307  }  }
4308    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3