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

Diff of /Sprout/Sprout.pm

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

revision 1.102, Thu Dec 6 14:56:23 2007 UTC revision 1.104, Wed Jan 23 00:56:31 2008 UTC
# Line 84  Line 84 
84  I<fig> with a password of I<admin>. The database load files are in the directory  I<fig> with a password of I<admin>. The database load files are in the directory
85  F</usr/fig/SproutData>.  F</usr/fig/SproutData>.
86    
87      my $sprout = Sprout->new('Sprout', { userData =>; 'fig/admin', dataDir => '/usr/fig/SproutData' });      my $sprout = Sprout->new('Sprout', { userData => 'fig/admin', dataDir => '/usr/fig/SproutData' });
88    
89  =cut  =cut
90    
# Line 267  Line 267 
267              Trace("No load file found for $tableName in $dataDir.") if T(0);              Trace("No load file found for $tableName in $dataDir.") if T(0);
268          } else {          } else {
269              # Attempt to load this table.              # Attempt to load this table.
270              my $result = $self->LoadTable($fileName, $tableName, $truncateFlag);              my $result = $self->LoadTable($fileName, $tableName, truncate => $truncateFlag);
271              # Accumulate the resulting statistics.              # Accumulate the resulting statistics.
272              $retVal->Accumulate($result);              $retVal->Accumulate($result);
273          }          }
# Line 3625  Line 3625 
3625          # Get the super-group name.          # Get the super-group name.
3626          my $realGroupID;          my $realGroupID;
3627          if ($groupID =~ /([A-Z]\w+)/) {          if ($groupID =~ /([A-Z]\w+)/) {
             my $sortOfGroup = $1;  
3628              if (! defined($superTable{$1})) {              if (! defined($superTable{$1})) {
3629                  Confess("Super-group name not found for group $groupID.");                  Confess("Super-group name not found for group $groupID.");
3630              } else {              } else {
3631                  $realGroupID = $superTable{$1}->{superGroup};                  $realGroupID = $1;
3632              }              }
3633          } else {          } else {
3634              Confess("Invalid group name $groupID.");              Confess("Invalid group name $groupID.");
# Line 3670  Line 3669 
3669      # Check for the group file data.      # Check for the group file data.
3670      my %superTable = $self->CheckGroupFile();      my %superTable = $self->CheckGroupFile();
3671      # Compute the real group name.      # Compute the real group name.
     my ($realGroup, $pageLink);  
3672      if ($group =~ /([A-Z]\w+)/) {      if ($group =~ /([A-Z]\w+)/) {
3673          my $sortOfGroup = $1;          my $realGroup = $1;
3674          if (! defined($superTable{$1})) {          if (! defined($superTable{$1})) {
3675              Confess("No sort-of group found for \"$group\".");              Confess("No super-group found for \"$group\".");
3676          } else {          } else {
3677              $pageLink = $superTable{$1}->{page};              $retVal = "../content/$superTable{$1}->{page}";
3678          }          }
3679      } else {      } else {
3680          Confess("\"group\" is not a valid group name.");          Confess("\"group\" is not a valid group name.");
3681      }      }
     # Return the page name.  
     $retVal = "../content/" . $pageLink;  
3682      # Return the result.      # Return the result.
3683      return $retVal;      return $retVal;
3684  }  }
# Line 3725  Line 3721 
3721    
3722  Get the group file hash. The group file hash describes the relationship  Get the group file hash. The group file hash describes the relationship
3723  between a group and the super-group to which it belongs for purposes of  between a group and the super-group to which it belongs for purposes of
3724  display. The super-group name is computed from the sort-of group name,  display. The super-group name is computed from the first capitalized word
3725  which is the first capitalized word in the actual group name. For each  in the actual group name. For each super-group, the group file contains
3726  sort-of group, the group file contains the super-group name, the group  the page name and a list of the species expected to be in the group.
3727  genus, the list of applicable species (if any), and the name of the NMPDR  Each species is specified by a genus and a species name. A species name
3728  display page for the super-group.  of C<0> implies an entire genus.
3729    
3730  This method returns a hash from sort-of group names to hash reference. Each  This method returns a hash from super-group names to a hash reference. Each
3731  resulting hash reference contains the following fields.  resulting hash reference contains the following fields.
3732    
3733  =over 4  =over 4
3734    
 =item superGroup  
   
 Super-group name.  
   
3735  =item page  =item page
3736    
3737  The super-group's web page in the NMPDR.  The super-group's web page in the NMPDR.
3738    
3739  =item genus  =item contents
3740    
3741  The genus of the sort-of group.  A list of 2-tuples, each containing a genus name followed by a species name
3742    (or 0, indicating all species). This list indicates which organisms belong
3743  =item species  in the super-group.
   
 A reference to a list of the species for the sort-of group.  
3744    
3745  =back  =back
3746    
# Line 3767  Line 3757 
3757          my @groupLines = Tracer::GetFile("$FIG_Config::sproutData/groups.tbl");          my @groupLines = Tracer::GetFile("$FIG_Config::sproutData/groups.tbl");
3758          # Loop through the list of sort-of groups.          # Loop through the list of sort-of groups.
3759          for my $groupLine (@groupLines) {          for my $groupLine (@groupLines) {
3760              my ($mainName, $name, $page, $genus, $species) = split(/\t/, $groupLine);              my ($name, $page, @contents) = split /\t/, $groupLine;
3761              $groupHash{$name} = { page => $page,              $groupHash{$name} = { page => $page,
3762                                 genus => $genus,                                    contents => [ map { [ split /\s*,\s*/, $_ ] } @contents ]
3763                                 species => [ split(/\s*,\s*/, $species) ],                                  };
                                superGroup => $mainName };  
3764          }          }
3765          # Save the hash.          # Save the hash.
3766          $self->{groupHash} = \%groupHash;          $self->{groupHash} = \%groupHash;

Legend:
Removed from v.1.102  
changed lines
  Added in v.1.104

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3