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

Diff of /Sprout/SproutSubsys.pm

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

revision 1.17, Tue Sep 9 00:27:25 2008 UTC revision 1.18, Tue Sep 9 21:02:10 2008 UTC
# Line 84  Line 84 
84    
85  =head3 new  =head3 new
86    
87      my $sub = Subsystem->new($subName, $sprout);      my $sub = SproutSubsys->new($subName, $sprout);
88    
89  Load the subsystem.  Load the subsystem.
90    
# Line 118  Line 118 
118          Confess("Subsystem \"$subName\" not found in database.");          Confess("Subsystem \"$subName\" not found in database.");
119      } else {      } else {
120          # We've found it, so get the major data.          # We've found it, so get the major data.
121          my ($curator, $notes, $description) = $subsystemObject->Values(['Subsystem(curator)', 'Subsystem(notes)',          my ($curator, $notes, $description, $version) = $subsystemObject->Values(['Subsystem(curator)', 'Subsystem(notes)',
122                                                                          'Subsystem(description)']);                                                              'Subsystem(description)', 'Subsystem(version)']);
123          # Get the genome IDs and variant codes for the rows. The list returned          # Get the genome IDs and variant codes for the rows. The list returned
124          # by GetAll will be a list of 2-tuples, each consisting of a genome ID          # by GetAll will be a list of 2-tuples, each consisting of a genome ID
125          # and a subsystem variant code.          # and a subsystem variant code.
# Line 136  Line 136 
136          # 2-tuples will be ordered by the spreadsheet column number.          # 2-tuples will be ordered by the spreadsheet column number.
137          my @roles = $sprout->GetAll(['OccursInSubsystem'],          my @roles = $sprout->GetAll(['OccursInSubsystem'],
138                                      'OccursInSubsystem(to-link) = ? ORDER BY OccursInSubsystem(column-number)',                                      'OccursInSubsystem(to-link) = ? ORDER BY OccursInSubsystem(column-number)',
139                                      [$subName], ['OccursInSubsystem(from-link)', 'OccursInSubsystem(abbr)']);                                      [$subName], ['OccursInSubsystem(from-link)', 'OccursInSubsystem(abbr)',
140                                                     'OccursInSubsystem(auxiliary)']);
141          # Now we need to create the role ID directory and the reaction hash.          # Now we need to create the role ID directory and the reaction hash.
142          # The role ID directory maps role IDs and their abbreviations to column numbers.          # The role ID directory maps role IDs and their abbreviations to column numbers.
143          # The reaction hash maps a role ID to a list of the IDs for the reactions it          # The reaction hash maps a role ID to a list of the IDs for the reactions it
144          # catalyzes.          # catalyzes.
145          my %roleHash = ();          my %roleHash = ();
146          my %abbrHash = ();          my %abbrHash = ();
147            my %auxHash = ();
148          my %reactionHash = ();          my %reactionHash = ();
149          for ($idx = 0; $idx <= $#roles; $idx++) {          for ($idx = 0; $idx <= $#roles; $idx++) {
150              # Get the role ID and abbreviation for this column's role.              # Get the role ID, aux flag, and abbreviation for this column's role.
151              my ($roleID, $abbr) = @{$roles[$idx]};              my ($roleID, $abbr, $aux) = @{$roles[$idx]};
152              # Put them both in the role directory.              # Put the ID and abbreviation in the role directory.
153              $roleHash{$roleID} = $idx;              $roleHash{$roleID} = $idx;
154              $roleHash{$abbr} = $idx;              $roleHash{$abbr} = $idx;
155                # Put the aux flag in the aux hash.
156                $auxHash{$roleID} = $aux;
157              # Put the full name in the abbreviation directory.              # Put the full name in the abbreviation directory.
158              $abbrHash{$abbr} = $roleID;              $abbrHash{$abbr} = $roleID;
159              # Get this role's reactions.              # Get this role's reactions.
# Line 188  Line 192 
192                      colorHash => {},                      colorHash => {},
193                      # Map of abbreviations to role names.                      # Map of abbreviations to role names.
194                      abbrHash => \%abbrHash,                      abbrHash => \%abbrHash,
195                        # Map of auxiliary rols.
196                        auxHash => \%auxHash,
197                      # Map of role IDs to reactions.                      # Map of role IDs to reactions.
198                      reactionHash => \%reactionHash,                      reactionHash => \%reactionHash,
199                        # Version number.
200                        version => $version,
201                  };                  };
202          # Bless and return it.          # Bless and return it.
203          bless $retVal, $class;          bless $retVal, $class;
# Line 197  Line 205 
205      return $retVal;      return $retVal;
206  }  }
207    
208    =head3 is_aux_role
209    
210        my $flag = $sub->is_aux_role($roleID);
211    
212    Return TRUE if the specified role is auxiliary to this subsystem, FALSE
213    if it is essential to it.
214    
215    =over 4
216    
217    =item roleID
218    
219    ID of the relevant role.
220    
221    =item RETURN
222    
223    Returns TRUE if the specified role is auxiliary, else FALSE.
224    
225    =back
226    
227    =cut
228    
229    sub is_aux_role {
230        # Get the parameters.
231        my ($self, $roleID) = @_;
232        # Declare the return variable.
233        my $retVal = $self->{auxHash}->{$roleID};
234        # Return the result.
235        return $retVal;
236    }
237    
238    
239  =head3 get_row  =head3 get_row
240    
241      my $rowData = $sub->get_row($rowIndex);      my $rowData = $sub->get_row($rowIndex);
# Line 582  Line 621 
621  =cut  =cut
622    
623  sub get_hope_reactions_for_genome {  sub get_hope_reactions_for_genome {
624        ##TODO
625      my($self, $genome) = @_;      my($self, $genome) = @_;
626      my $index = $self->{genome_index}->{$genome};      my $index = $self->{genome_index}->{$genome};
627      if (defined $index) {      if (defined $index) {
# Line 666  Line 706 
706      return %{$retVal};      return %{$retVal};
707  }  }
708    
709    =head3 get_hope_reaction_notes
710    
711        my %roleHash = $sub->get_hope_reaction_notes();
712    
713    Return a hash mapping the roles of the subsystem to any existing notes
714    about the relevant reactions.
715    
716    =cut
717    
718    sub get_hope_reaction_notes {
719        # Get the parameters.
720        my ($self) = @_;
721        # Declare the return variable.
722        my %retVal;
723        ##TODO: Code
724        # Return the result.
725        return %retVal;
726    }
727    
728    =head3 get_hope_reaction_note
729    
730        my $note = $sub->get_hope_reaction_note($role);
731    
732    Return the text note about the curation of the scenario reactions
733    relating to this role.
734    
735    =over 4
736    
737    =item role
738    
739    ##TODO: role description
740    
741    =item RETURN
742    
743    ##TODO: return value description
744    
745    =back
746    
747    =cut
748    
749    sub get_hope_reaction_note {
750        # Get the parameters.
751        my ($self, $role) = @_;
752        # Declare the return variable.
753        my $retVal;
754        ##TODO: Code
755        # Return the result.
756        return $retVal;
757    }
758    
759  =head3 get_role_index  =head3 get_role_index
760    
761      my $idx = $sub->get_role_index($role);      my $idx = $sub->get_role_index($role);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3