[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.14, Sat Feb 26 19:05:32 2011 UTC revision 1.19, Sat Oct 1 10:35:02 2011 UTC
# Line 61  Line 61 
61      # Create the table list.      # Create the table list.
62      my @tables = qw(Compound Reaction EcNumber Model Media IsTriggeredBy      my @tables = qw(Compound Reaction EcNumber Model Media IsTriggeredBy
63                      IsCategorizedInto IsConsistentWith IsModeledBy Involves                      IsCategorizedInto IsConsistentWith IsModeledBy Involves
64                      IsRequiredBy);                      IsRequiredBy Complex IsSetOf IsExemplarOf);
65      # Create the BaseSaplingLoader object.      # Create the BaseSaplingLoader object.
66      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);
67      # Create the reaction tracking hash.      # Create the reaction tracking hash.
# Line 104  Line 104 
104    
105  =cut  =cut
106    
107    # hash of ubiquitous compounds.
108    use constant UBIQUITOUS => {
109        cpd00001 => 'OH-',
110        cpd00002 => 'ATP',
111        cpd00003 => 'Nicotinamideadeninedinucleotide',
112        cpd00004 => 'Nicotinamideadeninedinucleotide-reduced',
113        cpd00005 => 'Nicotinamideadeninedinucleotidephosphate-reduced',
114        cpd00006 => 'Nicotinamideadeninedinucleotidephosphate',
115        cpd00007 => 'Oxygen',
116        cpd00008 => 'ADP',
117        cpd00009 => 'Orthophosphoric acid',
118        cpd00010 => 'CoenzymeA',
119        cpd00011 => 'Carbon dioxide',
120        cpd00012 => 'PPi',
121        cpd00018 => 'AMP',
122        cpd00020 => 'Pyruvic Acid',
123        cpd00022 => 'Acetyl-CoA',
124        cpd00025 => 'Hydrogen peroxide',
125        cpd00067 => 'H+',
126        cpd00971 => 'Sodium',
127        cpd15352 => '2-Demethylmenaquinone',
128        cpd15353 => '2-Demethylmenaquinol',
129        cpd15499 => 'Menaquinol',
130        cpd15500 => 'Menaquinone',
131        cpd15560 => 'Ubiquinone-8',
132        cpd15561 => 'Ubiquinol-8',
133    };
134    
135  sub LoadModelFiles {  sub LoadModelFiles {
136      # Get the parameters.      # Get the parameters.
137      my ($self) = @_;      my ($self) = @_;
138        # Get the sapling database.
139        my $erdb = $self->db();
140      # Get the model dump file directory.      # Get the model dump file directory.
141      my $dir = $self->db()->LoadDirectory() . "/models";      my $dir = $erdb->LoadDirectory() . "/models";
142      # First we read the compounds.      # First we read the compounds.
143      my $ih = $self->CheckFile("$dir/CompoundName.txt", qw(CompoundID Name));      my $ih = $self->CheckFile("$dir/CompoundName.txt", qw(CompoundID Name));
144      while (! eof $ih) {      while (! eof $ih) {
145          # Get the next compound.          # Get the next compound.
146          my ($id, $label) = $self->ReadLine($ih);          my ($id, $label) = $self->ReadLine($ih);
147          # Create a compound record for it.          # Create a compound record for it.
148          $self->PutE(Compound => $id, label => $label);          $self->PutE(Compound => $id, label => $label, ubiquitous => (UBIQUITOUS->{$id} ? 1 : 0));
149      }      }
150      # Next, the compound-reactions relationship. We create the reactions here, too.      # Next, the compound-reactions relationship. We create the reactions here, too.
151      $ih = $self->CheckFile("$dir/CompoundReaction.txt", qw(CompoundID ReactionID      $ih = $self->CheckFile("$dir/CompoundReaction.txt", qw(CompoundID ReactionID
152                             Stoichiometry));                             Stoichiometry Cofactor));
153      while (! eof $ih) {      while (! eof $ih) {
154          # Get the next link.          # Get the next link.
155          my ($compound, $reaction, $stoich) = $self->ReadLine($ih);          my ($compound, $reaction, $stoich, $cofactor) = $self->ReadLine($ih);
156          # Insure the reaction exists.          # Insure the reaction exists.
157          $self->CreateReaction($reaction);          $self->CreateReaction($reaction);
158          # Check for product or substrate.          # Check for product or substrate.
# Line 135  Line 165 
165          }          }
166          # Connect the reaction to the compound.          # Connect the reaction to the compound.
167          $self->PutR(Involves => $reaction, $compound, product => $product,          $self->PutR(Involves => $reaction, $compound, product => $product,
168                      stoichiometry => $stoich);                      stoichiometry => $stoich, cofactor => $cofactor);
169      }      }
170      # Now we connect the reactions to roles.      # Now we connect the reactions to roles.
171      $ih = $self->CheckFile("$dir/ReactionRole.txt", qw(ReactionID Role));      $ih = $self->CheckFile("$dir/ReactionRole.txt", qw(ReactionID Role));
# Line 149  Line 179 
179          $self->PutR(IsTriggeredBy => $reaction, $role);          $self->PutR(IsTriggeredBy => $reaction, $role);
180      }      }
181      # Now we create the models.      # Now we create the models.
182      $ih = $self->CheckFile("$dir/ModelGenome.txt", qw(ModelID GenomeID));      $ih = $self->CheckFile("$dir/ModelGenome.txt", qw(ModelID Name GenomeID));
183      while (! eof $ih) {      while (! eof $ih) {
184          # Get the next model.          # Get the next model.
185          my ($model, $genome) = $self->ReadLine($ih);          my ($model, $name, $genome) = $self->ReadLine($ih);
186          # Create the model.          # Create the model.
187          $self->PutE(Model => $model);          $self->PutE(Model => $model);
188          # Connect it to the genome. Again, the genomes are created elsewhere.          # Connect it to the genome. Again, the genomes are created elsewhere.
# Line 171  Line 201 
201              $self->PutR(IsRequiredBy => $reaction, $model);              $self->PutR(IsRequiredBy => $reaction, $model);
202          }          }
203      }      }
204        # Finally, the exemplars are stored in the coupling directory.
205        my $couplingDir = $erdb->LoadDirectory() . '/FamilyData';
206        $self->LoadFromFile(IsExemplarOf => "$couplingDir/IsExemplarOf.dtx",
207                            qw(from_link to_link));
208  }  }
209    
210  =head3 StartFile  =head3 CheckFile
211    
212      my $ih = $sl->CheckFile($fileName, @fieldNames);      my $ih = $sl->CheckFile($fileName, @fieldNames);
213    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.19

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3