[Bio] / FigKernelPackages / Subsystem.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/Subsystem.pm

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

revision 1.4, Thu May 27 19:27:53 2004 UTC revision 1.5, Tue Jun 1 20:22:03 2004 UTC
# Line 174  Line 174 
174      return undef;      return undef;
175  }  }
176    
177    #
178    # Synchronize the database index for this subsystem to the
179    # subsystem data.
180    #
181    # We assume the table already exists.
182    #
183    # W
184    #
185    
186    sub db_sync
187    {
188        my($self, $skip_delete) = @_;
189    
190        my $rdbH = $self->{fig}->db_handle();
191    
192        if (!$skip_delete)
193        {
194            $rdbH->SQL("DELETE FROM subsystem_index where subsystem = '$self->{name}'")
195        }
196    
197        #
198        # We run thru all the cells, writing an entry in the database for the peg/subsystem/role.
199        #
200    
201        for my $role ($self->get_roles())
202        {
203            my $ridx = $self->get_role_index($role);
204            my $col = $self->get_col($ridx);
205            for my $cell (@$col)
206            {
207                if ($cell)
208                {
209                    for my $peg (@$cell)
210                    {
211                        $rdbH->SQL("INSERT INTO subsystem_index values('$peg', '$self->{name}', '$role')");
212                    }
213                }
214            }
215        }
216    }
217    
218  sub load  sub load
219  {  {
220      my($self) = @_;      my($self) = @_;
# Line 268  Line 309 
309  {  {
310      my($self, @roles) = @_;      my($self, @roles) = @_;
311    
312        $self->{abbr} = {};
313        $self->{role_index} = {};
314        $self->{roles} = [];
315        $self->{role_abbrs} = [];
316    
317      my $i = 1;      my $i = 1;
318      for my $role (@roles)      for my $role (@roles)
319      {      {
# Line 315  Line 361 
361      $self->{col_active_subset} = $active_subsetC;      $self->{col_active_subset} = $active_subsetC;
362    
363      $self->{col_subsets} = [];      $self->{col_subsets} = [];
364        $self->{col_subset_members} = {};
365    
366      for my $subset (@subsetsC)      for my $subset (@subsetsC)
367      {      {
368          my($name, @members) = split(/\s+/, $subset);          my($name, @members) = split(/\s+/, $subset);
# Line 361  Line 409 
409      my($self, $fh) = @_;      my($self, $fh) = @_;
410      my(%seen);      my(%seen);
411    
412        $self->{spreadsheet} = [];
413        $self->{spreadshhet_inv} = [];
414        $self->{genome} = [];
415        $self->{genome_index} = {};
416        $self->{variant_code} = [];
417    
418      my $i = 1;      my $i = 1;
419      while (<$fh>)      while (<$fh>)
420      {      {
# Line 454  Line 508 
508  {  {
509      my($self, $row, $col) = @_;      my($self, $row, $col) = @_;
510    
511      return $self->{spreadsheet}->[$row]->[$col];      print "Getting cell\n";
512        my $cell = $self->{spreadsheet}->[$row]->[$col];
513        print "Got cell $cell\n";
514        return $cell;
515  }  }
516    
517  sub get_genome_index  sub get_genome_index
# Line 471  Line 528 
528      return $self->{genome}->[$gidx];      return $self->{genome}->[$gidx];
529  }  }
530    
531    sub get_role_index
532    {
533        my($self, $role) = @_;
534    
535        return $self->{role_index}->{$role};
536    }
537    
538  sub get_role  sub get_role
539  {  {
540      my($self, $ridx) = @_;      my($self, $ridx) = @_;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3