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

Diff of /Sprout/SproutLoad.pm

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

revision 1.20, Wed Nov 2 21:54:40 2005 UTC revision 1.21, Sat Nov 12 03:42:48 2005 UTC
# Line 615  Line 615 
615      GenomeSubset      GenomeSubset
616      HasGenomeSubset      HasGenomeSubset
617      Catalyzes      Catalyzes
618        Diagram
619        RoleOccursIn
620    
621  =over 4  =over 4
622    
# Line 640  Line 642 
642      my $subsysCount = @subsysIDs;      my $subsysCount = @subsysIDs;
643      my $genomeCount = (keys %{$genomeHash});      my $genomeCount = (keys %{$genomeHash});
644      my $featureCount = $genomeCount * 4000;      my $featureCount = $genomeCount * 4000;
645        # Get the map list.
646        my @maps = $fig->all_maps;
647        my $mapCount = @maps;
648      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
649        my $loadDiagram = $self->_TableLoader('Diagram', $mapCount);
650        my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn', $featureCount * 6);
651      my $loadSubsystem = $self->_TableLoader('Subsystem', $subsysCount);      my $loadSubsystem = $self->_TableLoader('Subsystem', $subsysCount);
652      my $loadRole = $self->_TableLoader('Role', $featureCount * 6);      my $loadRole = $self->_TableLoader('Role', $featureCount * 6);
653      my $loadRoleEC = $self->_TableLoader('RoleEC', $featureCount * 6);      my $loadRoleEC = $self->_TableLoader('RoleEC', $featureCount * 6);
# Line 658  Line 665 
665      my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes', $featureCount * $genomeCount);      my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes', $featureCount * $genomeCount);
666      my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset', $subsysCount * 50);      my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset', $subsysCount * 50);
667      my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset', $subsysCount * 50);      my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset', $subsysCount * 50);
668        # Create load objects for each of the tables we're loading.
669      Trace("Beginning subsystem data load.") if T(2);      Trace("Beginning subsystem data load.") if T(2);
670      # This hash will contain the role for each EC. When we're done, this      # This hash will contain the role for each EC. When we're done, this
671      # information will be used to generate the Catalyzes table.      # information will be used to generate the Catalyzes table.
# Line 794  Line 802 
802              }              }
803          }          }
804      }      }
805        # Now we loop through the diagrams. We need to create the diagram records
806        # and link each diagram to its roles. Note that only roles which occur
807        # in subsystems (and therefore appear in the %ecToRoles hash) are
808        # included.
809        for my $map (@maps) {
810            Trace("Loading diagram $map.") if T(3);
811            # Get the diagram's descriptive name.
812            my $name = $fig->map_name($map);
813            $loadDiagram->Put($map, $name);
814            # Now we need to link all the map's roles to it.
815            # A hash is used to prevent duplicates.
816            my %roleHash = ();
817            for my $role ($fig->map_to_ecs($map)) {
818                if (exists $ecToRoles{$role} && ! $roleHash{$role}) {
819                    $loadRoleOccursIn->Put($ecToRoles{$role}, $map);
820                    $roleHash{$role} = 1;
821                }
822            }
823        }
824      # Before we leave, we must create the Catalyzes table. We start with the reactions,      # Before we leave, we must create the Catalyzes table. We start with the reactions,
825      # then use the "ecToRoles" table to convert EC numbers to role IDs.      # then use the "ecToRoles" table to convert EC numbers to role IDs.
826      my @reactions = $fig->all_reactions();      my @reactions = $fig->all_reactions();
# Line 812  Line 839 
839      return $retVal;      return $retVal;
840  }  }
841    
 =head3 LoadDiagramData  
   
 C<< my $stats = $spl->LoadDiagramData(); >>  
   
 Load the diagram data from FIG into Sprout.  
   
 Diagrams are used to organize functional roles. The diagram shows the  
 connections between chemicals that interact with a subsystem.  
   
 The following relations are loaded by this method.  
   
     Diagram  
     RoleOccursIn  
   
 =over 4  
   
 =item RETURNS  
   
 Returns a statistics object for the loads.  
   
 =back  
   
 =cut  
 #: Return Type $%;  
 sub LoadDiagramData {  
     # Get this object instance.  
     my ($self) = @_;  
     # Get the FIG object.  
     my $fig = $self->{fig};  
     # Get the map list.  
     my @maps = $fig->all_maps;  
     my $mapCount = @maps;  
     my $genomeCount = (keys %{$self->{genomes}});  
     my $featureCount = $genomeCount * 4000;  
     # Create load objects for each of the tables we're loading.  
     my $loadDiagram = $self->_TableLoader('Diagram', $mapCount);  
     my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn', $featureCount * 6);  
     Trace("Beginning diagram data load.") if T(2);  
     # Loop through the diagrams.  
     for my $map ($fig->all_maps) {  
         Trace("Loading diagram $map.") if T(3);  
         # Get the diagram's descriptive name.  
         my $name = $fig->map_name($map);  
         $loadDiagram->Put($map, $name);  
         # Now we need to link all the map's roles to it.  
         # A hash is used to prevent duplicates.  
         my %roleHash = ();  
         for my $role ($fig->map_to_ecs($map)) {  
             if (! $roleHash{$role}) {  
                 $loadRoleOccursIn->Put($role, $map);  
                 $roleHash{$role} = 1;  
             }  
         }  
     }  
     # Finish the load.  
     my $retVal = $self->_FinishAll();  
     return $retVal;  
 }  
   
842  =head3 LoadPropertyData  =head3 LoadPropertyData
843    
844  C<< my $stats = $spl->LoadPropertyData(); >>  C<< my $stats = $spl->LoadPropertyData(); >>

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3