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

Diff of /Sprout/SubsystemSaplingLoader.pm

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

revision 1.5, Thu May 28 18:08:56 2009 UTC revision 1.6, Thu Jun 4 18:21:46 2009 UTC
# Line 60  Line 60 
60      # Create the table list.      # Create the table list.
61      my @tables = sort qw(Subsystem IsClassFor SubsystemClass IsSuperclassOf Includes      my @tables = sort qw(Subsystem IsClassFor SubsystemClass IsSuperclassOf Includes
62                           Describes Role Variant IsRoleOf IsImplementedBy MachineRole                           Describes Role Variant IsRoleOf IsImplementedBy MachineRole
63                           IsMachineOf MolecularMachine IsContainedIn Uses);                           IsMachineOf MolecularMachine IsContainedIn Uses VariantRole);
64      # Create the BaseSaplingLoader object.      # Create the BaseSaplingLoader object.
65      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);      my $retVal = BaseSaplingLoader::new($class, $erdb, $options, @tables);
66      # Return it.      # Return it.
# Line 181  Line 181 
181              my $hypothetical = ($role =~ /hypothetical/i ? 1 : 0);              my $hypothetical = ($role =~ /hypothetical/i ? 1 : 0);
182              # Create its entity.              # Create its entity.
183              $self->PutE(Role => $role, hypothetical => $hypothetical);              $self->PutE(Role => $role, hypothetical => $hypothetical);
184                # Check to see if it is main or auxiliary.
185                my $auxFlag = ($fig->is_aux_role_in_subsystem($subsystem, $role) ? 1 : 0);
186              # Connect it to the subsystem.              # Connect it to the subsystem.
187              $self->PutR(Includes => $subsystem, $role,              $self->PutR(Includes => $subsystem, $role,
188                          abbreviation => $ssData->get_abbr_for_role($role),                          abbreviation => $ssData->get_abbr_for_role($role),
189                          sequence => $col++)                          sequence => $col++, auxiliary => $auxFlag);
190          }          }
191          # Next come the variants. Variant data is sparse in the SEED. We          # Next come the variants. Variant data is sparse in the SEED. We
192          # start by getting all the known variant codes.          # start by getting all the known variant codes.
# Line 199  Line 201 
201              my $realVariantID = BaseSaplingLoader::Starless($variant);              my $realVariantID = BaseSaplingLoader::Starless($variant);
202              $variants{$realVariantID} = $variantHash->{$variant};              $variants{$realVariantID} = $variantHash->{$variant};
203          }          }
204            # Next we need to compute the role rules. For each genome in the subsystem,
205            # we compute its variant code and a list of its roles. These are put
206            # into the following two-dimensional hash. Each inner hash maps a role
207            # rule list to 1. The keys of the inner hash become the role rules.
208            my %roleRuleHash = map { $_ => {} } keys %variants;
209            # Loop through the list of genomes.
210            my @genomes = $ssData->get_genomes();
211            for (my $i = 0; $i < scalar(@genomes); $i++) {
212                # Get this genome's variant code.
213                my $variantCode = BaseSaplingLoader::Starless($ssData->get_variant_code($i));
214                # Get its roles.
215                my @roles = $ssData->get_roles_for_genome($genomes[$i]);
216                # Convert them to a role rule.
217                my $rule = join(" ", sort map { $ssData->get_abbr_for_role($_) } @roles);
218                # Put the role in the hash.
219                $roleRuleHash{$variantCode}{$rule} = 1;
220            }
221          # Create the variants.          # Create the variants.
222          for my $variant (keys %variants) {          for my $variant (keys %variants) {
223              # The variant key is the subsystem ID plus the variant code.              # The variant key is the subsystem ID plus the variant code.
224              my $variantID = "$subsystem:$variant";              my $variantID = "$subsystem:$variant";
225              # At this time, the role rule is not available, so we only have              # The comment is easily computed from the variant data.
226              # the comment.              $self->PutE(Variant => $variantID, comment => $variants{$variant});
227              $self->PutE(Variant => $variantID, comment => $variants{$variant},              # Now output the role rules.
228                          role_rule => '');              for my $rule (keys %{$roleRuleHash{$variant}}) {
229                    $self->PutE(VariantRole => $variantID, role_rule => $rule);
230                }
231              # Link the subsystem to the variant.              # Link the subsystem to the variant.
232              $self->PutR(Describes => $subsystem, $variantID);              $self->PutR(Describes => $subsystem, $variantID);
233          }          }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3