[Bio] / Sprout / ScenarioSaplingLoader.pm Repository:
ViewVC logotype

Diff of /Sprout/ScenarioSaplingLoader.pm

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

revision 1.5, Tue Jun 30 19:53:01 2009 UTC revision 1.6, Wed Jul 15 23:39:58 2009 UTC
# Line 123  Line 123 
123      # scenarios) to our reaction IDs.      # scenarios) to our reaction IDs.
124      my $figmodel = $self->{figModel};      my $figmodel = $self->{figModel};
125      # We run through the subsystems and roles, generating the scenarios.      # We run through the subsystems and roles, generating the scenarios.
126      # We'll need some hashes to prevent duplicates.      # We'll need a role hash to prevent duplicates.
127      my %roles = ();      my %roles = ();
128      my %scenarios = ();      # This counter is used to compute scenario IDs.
129        my $scenarios = 0;
130        # Now loop through the subsystems.
131      my @subsystems = sort keys %{$erdb->SubsystemHash()};      my @subsystems = sort keys %{$erdb->SubsystemHash()};
132      for my $subName (@subsystems) {      for my $subName (@subsystems) {
133          Trace("Processing $subName.") if T(3);          Trace("Processing $subName.") if T(3);
# Line 148  Line 150 
150          # Loop through the scenarios, creating scenario data.          # Loop through the scenarios, creating scenario data.
151          for my $scenarioName (@scenarioNames) {          for my $scenarioName (@scenarioNames) {
152              $self->Track(Scenarios => $scenarioName, 100);              $self->Track(Scenarios => $scenarioName, 100);
153                # Get this scenario's ID.
154                $scenarios++;
155                my $scenarioID = $scenarios;
156              # Link this scenario to this subsystem.              # Link this scenario to this subsystem.
157              $self->PutR(IsSubInstanceOf => $subName, $scenarioName);              $self->PutR(IsSubInstanceOf => $subName, $scenarioID);
             # If this scenario is new, we need to create it.  
             if (! $scenarios{$scenarioName}) {  
                 Trace("Creating scenario $scenarioName.") if T(3);  
                 $scenarios{$scenarioName} = 1;  
158                  # Create the scenario itself.                  # Create the scenario itself.
159                  $self->PutE(Scenario => $scenarioName);              Trace("Creating scenario $scenarioID: $scenarioName.") if T(3);
160                $self->PutE(Scenario => $scenarioID, common_name => $scenarioName);
161                  # Attach the input compounds.                  # Attach the input compounds.
162                  for my $input ($sub->get_hope_input_compounds($scenarioName)) {                  for my $input ($sub->get_hope_input_compounds($scenarioName)) {
163                      # Resolve the compound ID.                      # Resolve the compound ID.
164                      my $inputID = $figmodel->id_of_compound($input);                      my $inputID = $figmodel->id_of_compound($input);
165                      # Write the relationship record.                      # Write the relationship record.
166                      $self->PutR(IsTerminusFor => $inputID, $scenarioName,                  $self->PutR(IsTerminusFor => $inputID, $scenarioID,
167                                  group_number => 0);                                  group_number => 0);
                 }  
168                  # Now we need to set up the output compounds. They come in two                  # Now we need to set up the output compounds. They come in two
169                  # groups, which we mark 1 and 2.                  # groups, which we mark 1 and 2.
170                  my $outputGroupID = 1;                  my $outputGroupID = 1;
# Line 174  Line 175 
175                          # Resolve the compound ID.                          # Resolve the compound ID.
176                          my $compoundID = $figmodel->id_of_compound($compound);                          my $compoundID = $figmodel->id_of_compound($compound);
177                          # Write the relationship record.                          # Write the relationship record.
178                          $self->PutR(IsTerminusFor => $compoundID, $scenarioName,                          $self->PutR(IsTerminusFor => $compoundID, $scenarioID,
179                                      group_number => $outputGroupID);                                      group_number => $outputGroupID);
180                      }                      }
181                      # # Increment the group number.                      # # Increment the group number.
# Line 187  Line 188 
188                      # Resolve the reaction ID.                      # Resolve the reaction ID.
189                      my $reactionID = $figmodel->id_of_reaction($reaction);                      my $reactionID = $figmodel->id_of_reaction($reaction);
190                      # Write the relationship record.                      # Write the relationship record.
191                      $self->PutR(HasParticipant => $scenarioName, $reactionID,                      $self->PutR(HasParticipant => $scenarioID, $reactionID,
192                                  type => 1);                                  type => 1);
193                  }                  }
194                  # Next is the list of reactions not in the scenario. We get the list                  # Next is the list of reactions not in the scenario. We get the list
# Line 199  Line 200 
200                      # Resolve the reaction ID.                      # Resolve the reaction ID.
201                      my $reactionID = $figmodel->id_of_reaction($reaction);                      my $reactionID = $figmodel->id_of_reaction($reaction);
202                      # Write the relationship record.                      # Write the relationship record.
203                      $self->PutR(HasParticipant => $scenarioName, $reactionID,                      $self->PutR(HasParticipant => $scenarioID, $reactionID,
204                                  type => ($notReactions{$reaction} || 0));                                  type => ($notReactions{$reaction} || 0));
205                  }                  }
206                  # Link the maps.                  # Link the maps.
207                  my @maps = $sub->get_hope_map_ids($scenarioName);                  my @maps = $sub->get_hope_map_ids($scenarioName);
208                  for my $map (@maps) {                  for my $map (@maps) {
209                      $self->PutR(Overlaps => $scenarioName, "map$map");                      $self->PutR(Overlaps => $scenarioID, "map$map");
210                  }                  }
211              }              }
212          }          }

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3