[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.9, Sat Mar 27 15:19:26 2010 UTC revision 1.10, Wed Apr 28 14:04:49 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 IsModeledBy); # Encompasses);      my @tables = sort qw(StructuralCue IsFoundIn Compound HasAliasOf AliasType
63                             HasReactionAliasOf Reaction Involves IsTriggeredBy
64                             RoleSet IsCombinationOf IsCategorizedInto EcNumber
65                             IsConsistentWith IsStimulatedBy  FeatureSet IsSetOf
66                             IsRequiredBy Model IsModeledBy ModelUser); # Encompasses);
67      # Create the BaseSaplingLoader object.      # Create the BaseSaplingLoader object.
68      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);
69      # Return it.      # Return it.
# Line 405  Line 409 
409      my $sapling = $self->db();      my $sapling = $self->db();
410      ## TRS: Get hash of valid genome IDs.      ## TRS: Get hash of valid genome IDs.
411      my $genomeHash = $sapling->GenomeHash();      my $genomeHash = $sapling->GenomeHash();
412      my $ModelList = $model->database()->GetDBTable("MODEL LIST");      my $ModelList = $model->database()->GetDBTable("MODELS");
413      my $ModelStats = $model->database()->GetDBTable("MODEL STATS");      my $ModelStats = $model->database()->GetDBTable("MODEL STATS");
414      for (my $i=0; $i < $ModelStats->size(); $i++) {      for (my $i=0; $i < $ModelList->size(); $i++) {
415          my $Row = $ModelStats->get_row($i);          my $ListRow = $ModelList->get_row($i);
416            my $Row = $ModelStats->get_row_by_key($ListRow->{id}->[0], "Model ID");
417          if (defined($Row) && defined($Row->{"Model ID"}->[0])) {          if (defined($Row) && defined($Row->{"Model ID"}->[0])) {
418              my @LoadingArray = ($Row->{"Model ID"}->[0],"","",0,0,0,"",0,0,0,0,0,0,0,0,0,0,0,0,"","",0,0,"",0,0);              my @LoadingArray = ($Row->{"Model ID"}->[0],"","",0,0,0,"",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"",0,0,"master",0,-1,"");
419              if (defined($Row->{"Genome ID"}->[0]) && $genomeHash->{$Row->{"Genome ID"}->[0]}) {              if (defined($Row->{"Genome ID"}->[0]) && $genomeHash->{$Row->{"Genome ID"}->[0]}) {
420                  if (defined($Row->{"Organism name"}->[0])) {                  if (defined($Row->{"Organism name"}->[0])) {
421                      $LoadingArray[1] = $Row->{"Organism name"}->[0];                      $LoadingArray[1] = $Row->{"Organism name"}->[0];
# Line 467  Line 472 
472                      $LoadingArray[18] = $Row->{"Gap filling minimal objective"}->[0];                      $LoadingArray[18] = $Row->{"Gap filling minimal objective"}->[0];
473                  }                  }
474                  if (defined($Row->{"Build date"}->[0])) {                  if (defined($Row->{"Build date"}->[0])) {
475                      $LoadingArray[19] = $Row->{"Build date"}->[0];                      $LoadingArray[19] = FixDate($Row->{"Build date"}->[0]);
476                  }                  }
477                  if (defined($Row->{"Gap fill date"}->[0])) {                  if (defined($Row->{"Gap fill date"}->[0])) {
478                      $LoadingArray[20] = $Row->{"Gap fill date"}->[0];                      $LoadingArray[20] = FixDate($Row->{"Gap fill date"}->[0]);
479                  }                  }
480                  if (defined($Row->{"Version"}->[0])) {                  if (defined($Row->{"Version"}->[0])) {
481                      $LoadingArray[21] = $Row->{"Version"}->[0];                      $LoadingArray[21] = $Row->{"Version"}->[0];
# Line 478  Line 483 
483                  if (defined($Row->{"Gap fill version"}->[0])) {                  if (defined($Row->{"Gap fill version"}->[0])) {
484                      $LoadingArray[22] = $Row->{"Gap fill version"}->[0];                      $LoadingArray[22] = $Row->{"Gap fill version"}->[0];
485                  }                  }
486                    $LoadingArray[26] = $ListRow->{"owner"}->[0];
487                    $LoadingArray[27] = $ListRow->{"date"}->[0];
488                    $LoadingArray[28] = $ListRow->{"status"}->[0];
489                    $LoadingArray[29] = $ListRow->{"message"}->[0];
490                  if ($Row->{"Model ID"}->[0] =~ m/Core\d+\.\d+V\d+\.\d+/) {                  if ($Row->{"Model ID"}->[0] =~ m/Core\d+\.\d+V\d+\.\d+/) {
491                      $LoadingArray[25] = 1;                      $LoadingArray[25] = 1;
492                  } elsif (defined($ModelList->get_row_by_key($Row->{"Model ID"}->[0],"MODEL ID"))) {                  } elsif (defined($ModelList->get_row_by_key($Row->{"Model ID"}->[0],"MODEL ID"))) {
# Line 488  Line 497 
497                          $LoadingArray[24] = $ModelList->get_row_by_key($Row->{"Model ID"}->[0],"MODEL ID")->{"JOB ID"}->[0];                          $LoadingArray[24] = $ModelList->get_row_by_key($Row->{"Model ID"}->[0],"MODEL ID")->{"JOB ID"}->[0];
498                      }                      }
499                  }                  }
500                  for my $j (3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,21,22,24,25) {                  for my $j (3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,21,22,24,25,27,28) {
501                      $LoadingArray[$j] = 0 if ($LoadingArray[$j] =~ /[a-z]/i);                      $LoadingArray[$j] = 0 if ($LoadingArray[$j] =~ /[a-z]/i);
502                  }                  }
503                  $self->PutE(Model => $LoadingArray[0], organismName => $LoadingArray[1], source => $LoadingArray[2], totalGenes => $LoadingArray[3], gramPositiveGenes => $LoadingArray[4],gramNegativeGenes => $LoadingArray[5], class => $LoadingArray[6], genesWithFunction => $LoadingArray[7], genesWithReactions => $LoadingArray[8], subsystemGenes => $LoadingArray[9], subsystemGenesWithReactions => $LoadingArray[10], nonsubsystemGenes => $LoadingArray[11], nonsubsystemGenesWithReactions => $LoadingArray[12], numberOfReactions => $LoadingArray[13], numberOfTransporters => $LoadingArray[14], gapFillingReactions => $LoadingArray[15], gapFillingTime => $LoadingArray[16], gapFillingObjective => $LoadingArray[17], gapFillingMinimalObjective => $LoadingArray[18], buildDate => $LoadingArray[19], gapFillDate => $LoadingArray[20], version => $LoadingArray[21], gapFillVersion => $LoadingArray[22], directory => $LoadingArray[23], jobid => $LoadingArray[24], obsolete => $LoadingArray[25]);                  $self->PutE(Model => $LoadingArray[0], organismName => $LoadingArray[1], source => $LoadingArray[2], totalGenes => $LoadingArray[3], gramPositiveGenes => $LoadingArray[4],gramNegativeGenes => $LoadingArray[5], class => $LoadingArray[6], genesWithFunction => $LoadingArray[7], genesWithReactions => $LoadingArray[8], subsystemGenes => $LoadingArray[9], subsystemGenesWithReactions => $LoadingArray[10], nonsubsystemGenes => $LoadingArray[11], nonsubsystemGenesWithReactions => $LoadingArray[12], numberOfReactions => $LoadingArray[13], numberOfTransporters => $LoadingArray[14], gapFillingReactions => $LoadingArray[15], gapFillingTime => $LoadingArray[16], gapFillingObjective => $LoadingArray[17], gapFillingMinimalObjective => $LoadingArray[18], buildDate => $LoadingArray[19], gapFillDate => $LoadingArray[20], version => $LoadingArray[21], gapFillVersion => $LoadingArray[22], directory => $LoadingArray[23], jobid => $LoadingArray[24], obsolete => $LoadingArray[25], owner => $LoadingArray[26], modificationTime => $LoadingArray[27], status => $LoadingArray[28], message => $LoadingArray[29]);
504                    # Get the list of users.
505                    my $userList = $ListRow->{"users"};
506                    if (defined $userList) {
507                        for my $user (@$userList) {
508                            $self->PutE(ModelUser => $LoadingArray[0], users => $user);
509                        }
510                    }
511                  #Adding the relationship between model and genome                  #Adding the relationship between model and genome
512                  if (defined($Row->{"Genome ID"}->[0])) {                  if (defined($Row->{"Genome ID"}->[0])) {
513                      $self->PutR(IsModeledBy => $Row->{"Genome ID"}->[0],$LoadingArray[0]);                      $self->PutR(IsModeledBy => $Row->{"Genome ID"}->[0],$LoadingArray[0]);
# Line 566  Line 582 
582      }      }
583  }  }
584    
585    sub FixDate {
586        my ($date) = @_;
587        my $retVal = ($date eq 'NA' ? 0 : $date);
588        return $retVal;
589    }
590    
591  1;  1;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3