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

Diff of /FigKernelScripts/make_MPS_model.pl

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

revision 1.2, Fri Jul 20 15:05:09 2007 UTC revision 1.7, Wed Nov 12 18:29:31 2008 UTC
# Line 25  Line 25 
25      $fig = new FIGV;      $fig = new FIGV;
26  }  }
27  chomp $genome_id;  chomp $genome_id;
28  Scenario::set_fig($fig);  Scenario::set_fig($fig,$genome_id);
29  print STDERR "Creating SBML model for genome $genome_id\n" if($debug);  print STDERR "Creating SBML model for genome $genome_id\n" if($debug);
30  print STDERR "\tStage 1 - Loading Scenarios, model inputs and biomass\n" if($debug);  print STDERR "\tStage 1 - Loading Scenarios, model inputs and biomass\n" if($debug);
31  my @scenarios = @{Scenario->get_genome_scenarios($genome_id,1)};  my @scenarios = @{Scenario->get_genome_scenarios($genome_id,1)};
32  my $filebase = $fig->model_directory($genome_id)."/Analysis/";  my $filebase = $fig->scenario_directory($genome_id)."/Analysis/";
33    
34  my %input_cpds;  my %input_cpds;
35  open(INPUTS,$filebase."inputs.txt")  open(INPUTS,$filebase."inputs.txt")
# Line 43  Line 43 
43  }  }
44  close(INPUTS);  close(INPUTS);
45  #we are going to load up the cofactor compounds into inputs as well  #we are going to load up the cofactor compounds into inputs as well
46  open(COFACT,$filebase."cofactors.txt")  open(COFACT,$filebase."secondary_compounds.txt")
47      or die("Failed to open ".$filebase."cofactors.txt");      or die("Failed to open ".$filebase."secondary_compounds.txt");
48  while(<COFACT>)  while(<COFACT>)
49  {  {
50      chomp;      chomp;
# Line 66  Line 66 
66  }  }
67  close(BIOMASS);  close(BIOMASS);
68    
69    #$biomass_cpds{"C00002"} = 1;
70    
71  open(IN,$filebase."scenarios_valid.txt");  open(IN,$filebase."scenarios_valid.txt");
72  my @lines = <IN>;  my @lines = <IN>;
73  chomp @lines;  chomp @lines;
# Line 117  Line 119 
119           } keys %products;           } keys %products;
120      }      }
121  }  }
122    #the ATP Synthase hack reaction
123    $core_metabolites{"C00009"} = 1;
124    $core_metabolites{"C00001"} = 1;
125    $core_metabolites{"C00008"} = 1;
126    $core_metabolites{"C00002"} = 1;
127    $reaction_reversible{"ATPSYN"} = 0;
128    $reaction_to_substrates{"ATPSYN"} = {};
129    $reaction_to_products{"ATPSYN"} = {};
130    $reaction_to_substrates{"ATPSYN"}->{"C00008"} = 1;
131    $reaction_to_substrates{"ATPSYN"}->{"C00009"} = 1;
132    $reaction_to_products{"ATPSYN"}->{"C00001"} = 1;
133    $reaction_to_products{"ATPSYN"}->{"C00002"} = 1;
134    #end hack
135    
136  open(OUT,">".$filebase.$genome_id.".mps");  open(OUT,">".$filebase.$genome_id.".mps");
137    
138  print OUT "NAME          test\n";  print OUT "NAME          test\n";
# Line 150  Line 166 
166      {      {
167          print OUT " G  $id\n"; #regular cellular          print OUT " G  $id\n"; #regular cellular
168          push @all_cpds, $id;          push @all_cpds, $id;
169            $id = substr($id,1);
170            print OUT " G  E$id\n"; #extra cellular
171            push @all_cpds, "E".$id;
172      }      }
173  }  }
174    
# Line 177  Line 196 
196  #scenario reactions  #scenario reactions
197  foreach my $rid (sort keys %reaction_to_substrates)  foreach my $rid (sort keys %reaction_to_substrates)
198  {  {
199    
200      foreach (sort keys %{$reaction_to_substrates{$rid}})      foreach (sort keys %{$reaction_to_substrates{$rid}})
201      {      {
202            if(!defined $reaction_to_products{$rid}->{$_})
203            {
204          print OUT "    $rid    $_             -$reaction_to_substrates{$rid}->{$_}\n";          print OUT "    $rid    $_             -$reaction_to_substrates{$rid}->{$_}\n";
205      }      }
206        }
207      foreach (sort keys %{$reaction_to_products{$rid}})      foreach (sort keys %{$reaction_to_products{$rid}})
208      {      {
209            if(!defined $reaction_to_substrates{$rid}->{$_})
210            {
211          print OUT "    $rid    $_              $reaction_to_products{$rid}->{$_}\n";          print OUT "    $rid    $_              $reaction_to_products{$rid}->{$_}\n";
212      }      }
213        }
214      push @all_rids, $rid;      push @all_rids, $rid;
215      if($reaction_reversible{$rid})      if($reaction_reversible{$rid})
216      {      {
# Line 250  Line 276 
276          next;          next;
277      }      }
278      my $temp  = substr($cid,1);      my $temp  = substr($cid,1);
279      if(!$input_cpds{$cid} && !$output_cpds{$cid} && !$biomass_cpds{$cid})      if(!$input_cpds{$cid} && !$output_cpds{$cid})
280      {      {
281          print OUT "    T$temp    E$temp              1\n";          print OUT "    T$temp    E$temp              1\n";
282          print OUT "    T$temp    C$temp             -1\n";          print OUT "    T$temp    C$temp             -1\n";
283      }      }
284      elsif(!$output_cpds{$cid} && !$biomass_cpds{$cid})      if(!$output_cpds{$cid})
285      {      {
286          print OUT "    S$temp    E$temp             -1\n";          print OUT "    S$temp    E$temp             -1\n";
287      }      }
# Line 296  Line 322 
322      print OUT " UP RBOUND    T$cid            1000\n";      print OUT " UP RBOUND    T$cid            1000\n";
323      print OUT " UP RBOUND    S$cid            1000\n";      print OUT " UP RBOUND    S$cid            1000\n";
324  }  }
 #sink reactions here eh.  
325    
326    
327  print OUT "ENDATA\n";  print OUT "ENDATA\n";

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3