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

Diff of /Sprout/ModelSaplingLoader.pm

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

revision 1.4, Tue Jun 30 19:53:01 2009 UTC revision 1.8, Mon Feb 1 20:14:28 2010 UTC
# Line 59  Line 59 
59      # Get the parameters.      # Get the parameters.
60      my ($class, $erdb, $options) = @_;      my ($class, $erdb, $options) = @_;
61      # Create the table list.      # Create the table list.
62      my @tables = sort qw(StructuralCue IsFoundIn Compound HasAliasOf AliasType HasReactionAliasOf Reaction Involves IsTriggeredBy RoleSet IsCombinationOf IsCategorizedInto EcNumber IsConsistentWith IsStimulatedBy  FeatureSet IsSetOf IsRequiredBy Model Encompasses IsModeledBy);      my @tables = sort qw(StructuralCue IsFoundIn Compound HasAliasOf AliasType HasReactionAliasOf Reaction Involves IsTriggeredBy RoleSet IsCombinationOf IsCategorizedInto EcNumber IsConsistentWith IsStimulatedBy  FeatureSet IsSetOf IsRequiredBy Model IsModeledBy); # Encompasses);
63      # Create the BaseSaplingLoader object.      # Create the BaseSaplingLoader object.
64      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);
65      # Return it.      # Return it.
# Line 145  Line 145 
145      my ($self,$model) = @_;      my ($self,$model) = @_;
146    
147      #First getting the compound table which has a list of all compounds in the database as well as alot of compound information      #First getting the compound table which has a list of all compounds in the database as well as alot of compound information
148      my $CompoundTable = $model->GetDBTable("COMPOUNDS");      my $CompoundTable = $model->database()->GetDBTable("COMPOUNDS");
149    
150      #Adding the universal AliasType that will always exist      #Adding the universal AliasType that will always exist
151      $self->PutE(AliasType => "NAME", source => "NONE");      $self->PutE(AliasType => "NAME", source => "NONE");
# Line 230  Line 230 
230  sub LoadReactions {  sub LoadReactions {
231      my ($self,$model) = @_;      my ($self,$model) = @_;
232      #First getting the reaction table which has a list of all reactions in the database as well as alot of reaction information      #First getting the reaction table which has a list of all reactions in the database as well as alot of reaction information
233      my $ReactionTable = $model->GetDBTable("REACTIONS");      my $ReactionTable = $model->database()->GetDBTable("REACTIONS");
234    
235      #Cycling through the compound list and adding each individual compound entity      #Cycling through the compound list and adding each individual compound entity
236      my $Count = 0;      my $Count = 0;
# Line 299  Line 299 
299              #Adding relationship between EC number and reactions              #Adding relationship between EC number and reactions
300              if (defined($Object->{"ENZYME"})) {              if (defined($Object->{"ENZYME"})) {
301                  foreach my $Enzyme (@{$Object->{"ENZYME"}}) {                  foreach my $Enzyme (@{$Object->{"ENZYME"}}) {
302                     $self->PutE(EcNumber => $Enzyme, obselete => 0, replacedby => "NONE");                     if ($Enzyme =~ /,/) {
303                        #TODO:Invalid enzyme
304                       } else {
305                        $Enzyme =~ s/\s//g;
306                        $self->PutE(EcNumber => $Enzyme, obsolete => 0, replacedby => "NONE");
307                     $self->PutR(IsCategorizedInto => $LoadingArray[0],$Enzyme,source => "KEGG");                     $self->PutR(IsCategorizedInto => $LoadingArray[0],$Enzyme,source => "KEGG");
308                  }                  }
309              }              }
310                }
311              #Adding the relationship between reaction and alias type              #Adding the relationship between reaction and alias type
312              if (defined($Object->{"NAME"})) {              if (defined($Object->{"NAME"})) {
313                  foreach my $Name (@{$Object->{"NAME"}}) {                  foreach my $Name (@{$Object->{"NAME"}}) {
# Line 332  Line 337 
337  sub LoadRoleSets {  sub LoadRoleSets {
338      my ($self,$model) = @_;      my ($self,$model) = @_;
339      my $sapling =$self->db();      my $sapling =$self->db();
340      my $RoleMappings = $model->GetDBTable("CURATED ROLE MAPPINGS");      my $RoleMappings = $model->database()->GetDBTable("CURATED ROLE MAPPINGS");
341      my $NewSet;      my $NewSet;
342      my $SetHash;      my $SetHash;
343      my $LastComplex = -1;      my $LastComplex = -1;
# Line 400  Line 405 
405      my $sapling = $self->db();      my $sapling = $self->db();
406      ## TRS: Get hash of valid genome IDs.      ## TRS: Get hash of valid genome IDs.
407      my $genomeHash = $sapling->GenomeHash();      my $genomeHash = $sapling->GenomeHash();
408      my $ModelList = $model->GetDBTable("MODEL LIST");      my $ModelList = $model->database()->GetDBTable("MODEL LIST");
409      my $ModelStats = $model->GetDBTable("MODEL STATS");      my $ModelStats = $model->database()->GetDBTable("MODEL STATS");
410      for (my $i=0; $i < $ModelStats->size(); $i++) {      for (my $i=0; $i < $ModelStats->size(); $i++) {
411          my $Row = $ModelStats->get_row($i);          my $Row = $ModelStats->get_row($i);
412          if (defined($Row) && defined($Row->{"Model ID"}->[0])) {          if (defined($Row) && defined($Row->{"Model ID"}->[0])) {
# Line 494  Line 499 
499                  #If the model is not obsolete, we add the relationships between model and reaction and featureset                  #If the model is not obsolete, we add the relationships between model and reaction and featureset
500                  if ($LoadingArray[25] == 0) {                  if ($LoadingArray[25] == 0) {
501                      #Loading the model from file                      #Loading the model from file
502                      my $ModelTable = $model->GetDBModel($LoadingArray[0]);                      my $ModelTable = $model->database()->GetDBModel($LoadingArray[0]);
503                        if (! defined $ModelTable) {
504                            $self->Add(missingModelTable => 1);
505                        } else {
506                      for (my $j=0; $j < $ModelTable->size(); $j++) {                      for (my $j=0; $j < $ModelTable->size(); $j++) {
507                          my $RxnRow = $ModelTable->get_row($j);                          my $RxnRow = $ModelTable->get_row($j);
508                          if (defined($RxnRow) && defined($RxnRow->{"LOAD"}->[0])) {                          if (defined($RxnRow) && defined($RxnRow->{"LOAD"}->[0])) {
# Line 533  Line 541 
541                                          #Adding the relationship between the reaction and roleset                                          #Adding the relationship between the reaction and roleset
542                                          $self->PutR(IsStimulatedBy => $RxnRow->{"LOAD"}->[0],$DigestedKey);                                          $self->PutR(IsStimulatedBy => $RxnRow->{"LOAD"}->[0],$DigestedKey);
543                                          #Adding the relationship between the model and featureset                                          #Adding the relationship between the model and featureset
544                                          $self->PutR(Encompasses => $LoadingArray[0],$DigestedKey);                                              #$self->PutR(Encompasses => $LoadingArray[0],$DigestedKey);
545                                          #Adding the relationship between FeatureSet and feature                                          #Adding the relationship between FeatureSet and feature
546                                          my @PegArray = split(/\+/,$FeatureSet);                                          my @PegArray = split(/\+/,$FeatureSet);
547                                          foreach my $Feature (@PegArray) {                                          foreach my $Feature (@PegArray) {
# Line 548  Line 556 
556                              $self->PutR(IsRequiredBy => $RxnRow->{"LOAD"}->[0],$LoadingArray[0], direction => $SubLoadingArray[0], compartment => $SubLoadingArray[1], confidence => $SubLoadingArray[3], class => $SubLoadingArray[4], notes => $SubLoadingArray[5], dependency => $SubLoadingArray[6]);                              $self->PutR(IsRequiredBy => $RxnRow->{"LOAD"}->[0],$LoadingArray[0], direction => $SubLoadingArray[0], compartment => $SubLoadingArray[1], confidence => $SubLoadingArray[3], class => $SubLoadingArray[4], notes => $SubLoadingArray[5], dependency => $SubLoadingArray[6]);
557                          }                          }
558                      }                      }
559                        }
560                      #Clearing the model data from memmory                      #Clearing the model data from memmory
561                      undef $ModelTable;                      undef $ModelTable;
562                      $model->ClearDBModel($LoadingArray[0],"DELETE");                      $model->ClearDBModel($LoadingArray[0],"DELETE");

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.8

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3