[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.106, Wed Feb 6 23:21:02 2008 UTC revision 1.121, Wed Oct 15 11:46:22 2008 UTC
# Line 14  Line 14 
14      use BasicLocation;      use BasicLocation;
15      use CustomAttributes;      use CustomAttributes;
16      use RemoteCustomAttributes;      use RemoteCustomAttributes;
17        use CGI;
18        use WikiTools;
19        use BioWords;
20      use base qw(ERDB);      use base qw(ERDB);
21    
22  =head1 Sprout Database Manipulation Object  =head1 Sprout Database Manipulation Object
# Line 54  Line 57 
57    
58  =item dbName  =item dbName
59    
60  Name of the database.  Name of the database. If omitted, the default Sprout database name is used.
61    
62  =item options  =item options
63    
# Line 93  Line 96 
96  sub new {  sub new {
97      # Get the parameters.      # Get the parameters.
98      my ($class, $dbName, $options) = @_;      my ($class, $dbName, $options) = @_;
99        # Default the database name if it is missing.
100        if (! defined $dbName) {
101            $dbName = $FIG_Config::sproutDB;
102        } elsif (ref $dbName eq 'HASH') {
103            $options = $dbName;
104            $dbName = $FIG_Config::sproutDB;
105        }
106      # Compute the DBD directory.      # Compute the DBD directory.
107      my $dbd_dir = (defined($FIG_Config::dbd_dir) ? $FIG_Config::dbd_dir :      my $dbd_dir = (defined($FIG_Config::dbd_dir) ? $FIG_Config::dbd_dir :
108                                                    $FIG_Config::fig );                                                    $FIG_Config::fig );
# Line 105  Line 115 
115                                                          # data file directory                                                          # data file directory
116                         xmlFileName  => "$dbd_dir/SproutDBD.xml",                         xmlFileName  => "$dbd_dir/SproutDBD.xml",
117                                                          # database definition file name                                                          # database definition file name
118                         userData     => "$FIG_Config::dbuser/$FIG_Config::dbpass",                         userData     => "$FIG_Config::sproutUser/$FIG_Config::sproutPass",
119                                                          # user name and password                                                          # user name and password
120                         port         => $FIG_Config::dbport,                         port         => $FIG_Config::sproutPort,
121                                                          # database connection port                                                          # database connection port
122                         sock         => $FIG_Config::dbsock,                         sock         => $FIG_Config::sproutSock,
123                         host         => $FIG_Config::sprout_host,                         host         => $FIG_Config::sprout_host,
124                         maxSegmentLength => 4500,        # maximum feature segment length                         maxSegmentLength => 4500,        # maximum feature segment length
125                         maxSequenceLength => 8000,       # maximum contig sequence length                         maxSequenceLength => 8000,       # maximum contig sequence length
# Line 137  Line 147 
147      $retVal->{groupHash} = undef;      $retVal->{groupHash} = undef;
148      # Set up space for the genome hash. We use this to identify NMPDR genomes.      # Set up space for the genome hash. We use this to identify NMPDR genomes.
149      $retVal->{genomeHash} = undef;      $retVal->{genomeHash} = undef;
150      # Connect to the attributes.      # Remember the data directory name.
151        $retVal->{dataDir} = $dataDir;
152        # Return it.
153        return $retVal;
154    }
155    
156    =head3 ca
157    
158        my $ca = $sprout->ca():;
159    
160    Return the [[CustomAttributesPm]] object for retrieving object
161    properties.
162    
163    =cut
164    
165    sub ca {
166        # Get the parameters.
167        my ($self) = @_;
168        # Do we already have an attribute object?
169        my $retVal = $self->{_ca};
170        if (! defined $retVal) {
171            # No, create one. How we do it depends on the configuration.
172      if ($FIG_Config::attrURL) {      if ($FIG_Config::attrURL) {
173          Trace("Remote attribute server $FIG_Config::attrURL chosen.") if T(3);          Trace("Remote attribute server $FIG_Config::attrURL chosen.") if T(3);
174          $retVal->{_ca} = RemoteCustomAttributes->new($FIG_Config::attrURL);              $retVal = RemoteCustomAttributes->new($FIG_Config::attrURL);
175      } elsif ($FIG_Config::attrDbName) {      } elsif ($FIG_Config::attrDbName) {
176          Trace("Local attribute database $FIG_Config::attrDbName chosen.") if T(3);          Trace("Local attribute database $FIG_Config::attrDbName chosen.") if T(3);
177          my $user = ($FIG_Config::arch eq 'win' ? 'self' : scalar(getpwent()));          my $user = ($FIG_Config::arch eq 'win' ? 'self' : scalar(getpwent()));
178          $retVal->{_ca} = CustomAttributes->new(user => $user);              $retVal = CustomAttributes->new(user => $user);
179      }      }
180      # Return it.          # Save it for next time.
181            $self->{_ca} = $retVal;
182        }
183        # Return the result.
184      return $retVal;      return $retVal;
185  }  }
186    
187  =head3 RealCoreGenomes  =head3 CoreGenomes
188    
189        my @genomes = $sprout->CoreGenomes($scope);
190    
191      my @genomes = $sprout->RealCoreGenomes();  Return the IDs of NMPDR genomes in the specified scope.
192    
193  Return the IDs of the original core NMPDR genomes. These are the ones  =over 4
194  in the major groups indicated in the C<@realCoreGroups> member of the  
195  B<FIG_Config> file.  =item scope
196    
197    Scope of the desired genomes. C<core> covers the original core genomes,
198    C<nmpdr> covers all genomes in NMPDR groups, and C<all> covers all
199    genomes in the system.
200    
201    =item RETURN
202    
203    Returns a list of the IDs for the genomes in the specified scope.
204    
205    =back
206    
207  =cut  =cut
208    
209  sub RealCoreGenomes {  sub CoreGenomes {
210      # Get the parameters.      # Get the parameters.
211      my ($self) = @_;      my ($self, $scope) = @_;
212      # Declare the return variable.      # Declare the return variable.
213      my @retVal = ();      my @retVal = ();
214      # Get the hash of all the genome groups.      # If we want all genomes, then this is easy.
215        if ($scope eq 'all') {
216            @retVal = $self->Genomes();
217        } else {
218            # Here we're dealing with groups. Get the hash of all the
219            # genome groups.
220      my %groups = $self->GetGroups();      my %groups = $self->GetGroups();
221      # Loop through the groups, keeping the ones that belong to real core          # Loop through the groups, keeping the ones that we want.
     # organisms.  
222      for my $group (keys %groups) {      for my $group (keys %groups) {
223          if (grep { $group =~ /$_/ } @FIG_Config::realCoreGroups) {              # Decide if we want to keep this group.
224                my $keepGroup = 0;
225                if ($scope eq 'nmpdr') {
226                    # NMPDR mode: keep all groups.
227                    $keepGroup = 1;
228                } elsif ($scope eq 'core') {
229                    # CORE mode. Only keep real core groups.
230                    if (grep { $group =~ /$_/ } @{$FIG_Config::realCoreGroups}) {
231                        $keepGroup = 1;
232                    }
233                }
234                # Add this group if we're keeping it.
235                if ($keepGroup) {
236              push @retVal, @{$groups{$group}};              push @retVal, @{$groups{$group}};
237          }          }
238      }      }
239        }
240      # Return the result.      # Return the result.
241      return @retVal;      return @retVal;
242  }  }
243    
244    =head3 SuperGroup
245    
246        my $superGroup = $sprout->SuperGroup($groupName);
247    
248    Return the name of the super-group containing the specified NMPDR genome
249    group. If no appropriate super-group can be found, an error will be
250    thrown.
251    
252    =over 4
253    
254    =item groupName
255    
256    Name of the group whose super-group is desired.
257    
258    =item RETURN
259    
260    Returns the name of the super-group containing the incoming group.
261    
262    =back
263    
264    =cut
265    
266    sub SuperGroup {
267        # Get the parameters.
268        my ($self, $groupName) = @_;
269        # Declare the return variable.
270        my $retVal;
271        # Get the group hash.
272        my %groupHash = $self->CheckGroupFile();
273        # Find the super-group genus.
274        $groupName =~ /([A-Z]\w+)/;
275        my $nameThing = $1;
276        # See if it's directly in the group hash.
277        if (exists $groupHash{$nameThing}) {
278            # Yes, then it's our result.
279            $retVal = $nameThing;
280        } else {
281            # No, so we have to search.
282            for my $superGroup (keys %groupHash) {
283                # Get this super-group's item list.
284                my $list = $groupHash{$superGroup}->{contents};
285                # Search it.
286                if (grep { $_->[0] eq $nameThing } @{$list}) {
287                    $retVal = $superGroup;
288                }
289            }
290            # Make sure we found something.
291            if (! $retVal) {
292                Confess("No super-group found for \"$groupName\".");
293            }
294        }
295        # Return the result.
296        return $retVal;
297    }
298    
299  =head3 MaxSegment  =head3 MaxSegment
300    
301      my $length = $sprout->MaxSegment();      my $length = $sprout->MaxSegment();
# Line 381  Line 499 
499      return $retVal;      return $retVal;
500  }  }
501    
502  =head3 GeneMenu  =head3 GenomeMenu
503    
504      my $selectHtml = $sprout->GeneMenu(\%attributes, $filterString, \@params, $selected);      my $html = $sprout->GenomeMenu(%options);
505    
506  Return an HTML select menu of genomes. Each genome will be an option in the menu,  Generate a genome selection control with the specified name and options.
507  and will be displayed by name with the ID and a contig count attached. The selection  This control is almost but not quite the same as the genome control in the
508  value will be the genome ID. The genomes will be sorted by genus/species name.  B<SearchHelper> class. Eventually, the two will be combined.
509    
510  =over 4  =over 4
511    
512  =item attributes  =item options
513    
514    Optional parameters for the control (see below).
515    
516    =item RETURN
517    
518  Reference to a hash mapping attributes to values for the SELECT tag generated.  Returns the HTML for a genome selection control on a form (sometimes called a popup menu).
519    
520  =item filterString  =back
521    
522    The valid options are as follows.
523    
524  A filter string for use in selecting the genomes. The filter string must conform  =over 4
 to the rules for the C<< ERDB->Get >> method.  
525    
526  =item params  =item name
527    
528  Reference to a list of values to be substituted in for the parameter marks in  Name to give this control for use in passing it to the form. The default is C<myGenomeControl>.
529  the filter string.  Terrible things will happen if you have two controls with the same name on the same page.
530    
531  =item selected (optional)  =item filter
532    
533  ID of the genome to be initially selected.  If specified, a filter for the list of genomes to display. The filter should be in the form of a
534    list reference. The first element of the list should be the filter string, and the remaining elements
535    the filter parameters.
536    
537  =item fast (optional)  =item multiSelect
538    
539  If specified and TRUE, the contig counts will be omitted to improve performance.  If TRUE, then the user can select multiple genomes. If FALSE, the user can only select one genome.
540    
541  =item RETURN  =item size
542    
543  Returns an HTML select menu with the specified genomes as selectable options.  Number of rows to display in the control. The default is C<10>
544    
545    =item id
546    
547    ID to give this control. The default is the value of the C<name> option. Nothing will work correctly
548    unless this ID is unique.
549    
550    =item selected
551    
552    A comma-delimited list of selected genomes, or a reference to a list of selected genomes. The
553    default is none.
554    
555    =item class
556    
557    If specified, a style class to assign to the genome control.
558    
559  =back  =back
560    
561  =cut  =cut
562    
563  sub GeneMenu {  sub GenomeMenu {
564      # Get the parameters.      # Get the parameters.
565      my ($self, $attributes, $filterString, $params, $selected, $fast) = @_;      my ($self, %options) = @_;
566      my $slowMode = ! $fast;      # Get the control's name and ID.
567      # Default to nothing selected. This prevents an execution warning if "$selected"      my $menuName = $options{name} || $options{id} || 'myGenomeControl';
568      # is undefined.      my $menuID = $options{id} || $menuName;
569      $selected = "" unless defined $selected;      Trace("Genome menu name = $menuName with ID $menuID.") if T(3);
570      Trace("Gene Menu called with slow mode \"$slowMode\" and selection \"$selected\".") if T(3);      # Compute the IDs for the status display.
571      # Start the menu.      my $divID = "${menuID}_status";
572      my $retVal = "<select " .      my $urlID = "${menuID}_url";
573          join(" ", map { "$_=\"$attributes->{$_}\"" } keys %{$attributes}) .      # Compute the code to show selected genomes in the status area.
574          ">\n";      my $showSelect = "showSelected('$menuID', '$divID', '$urlID', 1000)";
575      # Get the genomes.      # Check for single-select or multi-select.
576      my @genomes = $self->GetAll(['Genome'], $filterString, $params, ['Genome(id)',      my $multiSelect = $options{multiSelect} || 0;
577                                                                       'Genome(genus)',      # Get the style data.
578                                                                       'Genome(species)',      my $class = $options{class} || '';
579                                                                       'Genome(unique-characterization)']);      # Get the list of pre-selected items.
580      # Sort them by name.      my $selections = $options{selected} || [];
581      my @sorted = sort { lc("$a->[1] $a->[2]") cmp lc("$b->[1] $b->[2]") } @genomes;      if (ref $selections ne 'ARRAY') {
582      # Loop through the genomes, creating the option tags.          $selections = [ split /\s*,\s*/, $selections ];
583      for my $genomeData (@sorted) {      }
584          # Get the data for this genome.      my %selected = map { $_ => 1 } @{$selections};
585          my ($genomeID, $genus, $species, $strain) = @{$genomeData};      # Extract the filter information. The default is no filtering. It can be passed as a tab-delimited
586          # Get the contig count.      # string or a list reference.
587          my $contigInfo = "";      my $filterParms = $options{filter} || "";
588          if ($slowMode) {      if (! ref $filterParms) {
589              my $count = $self->ContigCount($genomeID);          $filterParms = [split /\t|\\t/, $filterParms];
590              my $counting = ($count == 1 ? "contig" : "contigs");      }
591              $contigInfo = "[$count $counting]";      my $filterString = shift @{$filterParms};
592          }      # Get a list of all the genomes in group order. In fact, we only need them ordered
593          # Find out if we're selected.      # by name (genus,species,strain), but putting primary-group in front enables us to
594          my $selectOption = ($selected eq $genomeID ? " selected" : "");      # take advantage of an existing index.
595          # Build the option tag.      my @genomeList = $self->GetAll(['Genome'], "$filterString ORDER BY Genome(primary-group), Genome(genus), Genome(species), Genome(unique-characterization)",
596          $retVal .= "<option value=\"$genomeID\"$selectOption>$genus $species $strain ($genomeID)$contigInfo</option>\n";                                     $filterParms,
597                                       [qw(Genome(primary-group) Genome(id) Genome(genus) Genome(species) Genome(unique-characterization) Genome(taxonomy) Genome(contigs))]);
598        # Create a hash to organize the genomes by group. Each group will contain a list of
599        # 2-tuples, the first element being the genome ID and the second being the genome
600        # name.
601        my %gHash = ();
602        for my $genome (@genomeList) {
603            # Get the genome data.
604            my ($group, $genomeID, $genus, $species, $strain, $taxonomy, $contigs) = @{$genome};
605            # Compute its name. This is the genus, species, strain (if any), and the contig count.
606            my $name = "$genus $species ";
607            $name .= "$strain " if $strain;
608            my $contigCount = ($contigs == 1 ? "" : ", $contigs contigs");
609            # Now we get the domain. The domain tells us the display style of the organism.
610            my ($domain) = split /\s*;\s*/, $taxonomy, 2;
611            # Now compute the display group. This is normally the primary group, but if the
612            # organism is supporting, we blank it out.
613            my $displayGroup = ($group eq $FIG_Config::otherGroup ? "" : $group);
614            # Push the genome into the group's list. Note that we use the real group
615            # name for the hash key here, not the display group name.
616            push @{$gHash{$group}}, [$genomeID, $name, $contigCount, $domain];
617        }
618        # We are almost ready to unroll the menu out of the group hash. The final step is to separate
619        # the supporting genomes by domain. First, we extract the NMPDR groups and sort them. They
620        # are sorted by the first capitalized word. Groups with "other" are sorted after groups
621        # that aren't "other". At some point, we will want to make this less complicated.
622        my %sortGroups = map { $_ =~ /(other)?(.*)([A-Z].+)/; "$3$1$2" => $_ }
623                             grep { $_ ne $FIG_Config::otherGroup } keys %gHash;
624        my @groups = map { $sortGroups{$_} } sort keys %sortGroups;
625        # Remember the number of NMPDR groups.
626        my $nmpdrGroupCount = scalar @groups;
627        # Loop through the supporting genomes, classifying them by domain. We'll also keep a list
628        # of the domains found.
629        my @otherGenomes = @{$gHash{$FIG_Config::otherGroup}};
630        my @domains = ();
631        for my $genomeData (@otherGenomes) {
632            my ($genomeID, $name, $contigCount, $domain) = @{$genomeData};
633            if (exists $gHash{$domain}) {
634                push @{$gHash{$domain}}, $genomeData;
635            } else {
636                $gHash{$domain} = [$genomeData];
637                push @domains, $domain;
638            }
639        }
640        # Add the domain groups at the end of the main group list. The main group list will now
641        # contain all the categories we need to display the genomes.
642        push @groups, sort @domains;
643        # Delete the supporting group.
644        delete $gHash{$FIG_Config::otherGroup};
645        # Now it gets complicated. We need a way to mark all the NMPDR genomes. We take advantage
646        # of the fact they come first in the list. We'll accumulate a count of the NMPDR genomes
647        # and use that to make the selections.
648        my $nmpdrCount = 0;
649        # Create the type counters.
650        my $groupCount = 1;
651        # Get the number of rows to display.
652        my $rows = $options{size} || 10;
653        # If we're multi-row, create an onChange event.
654        my $onChangeTag = ( $rows > 1 ? " onChange=\"$showSelect;\" onFocus=\"$showSelect;\"" : "" );
655        # Set up the multiple-select flag.
656        my $multipleTag = ($multiSelect ? " multiple" : "" );
657        # Set up the style class.
658        my $classTag = ($class ? " class=\"$class\"" : "" );
659        # Create the SELECT tag and stuff it into the output array.
660        my @lines = ("<SELECT name=\"$menuName\" id=\"$menuID\" $onChangeTag$multipleTag$classTag size=\"$rows\">");
661        # Loop through the groups.
662        for my $group (@groups) {
663            # Get the genomes in the group.
664            for my $genome (@{$gHash{$group}}) {
665                # If this is an NMPDR organism, we add an extra style and count it.
666                my $nmpdrStyle = "";
667                if ($nmpdrGroupCount > 0) {
668                    $nmpdrCount++;
669                    $nmpdrStyle = " Core";
670                }
671                # Get the organism ID, name, contig count, and domain.
672                my ($genomeID, $name, $contigCount, $domain) = @{$genome};
673                # See if we're pre-selected.
674                my $selectTag = ($selected{$genomeID} ? " SELECTED" : "");
675                # Compute the display name.
676                my $nameString = "$name ($genomeID$contigCount)";
677                # Generate the option tag.
678                my $optionTag = "<OPTION class=\"$domain$nmpdrStyle\" title=\"$group\" value=\"$genomeID\"$selectTag>$nameString</OPTION>";
679                push @lines, "    $optionTag";
680            }
681            # Record this group in the nmpdrGroup count. When that gets to 0, we've finished the NMPDR
682            # groups.
683            $nmpdrGroupCount--;
684      }      }
685      # Close the SELECT tag.      # Close the SELECT tag.
686      $retVal .= "</select>\n";      push @lines, "</SELECT>";
687        if ($rows > 1) {
688            # We're in a non-compact mode, so we need to add some selection helpers. First is
689            # the search box. This allows the user to type text and change which genomes are
690            # displayed. For multiple-select mode, we include a button that selects the displayed
691            # genes. For single-select mode, we use a plain label instead.
692            my $searchThingName = "${menuID}_SearchThing";
693            my $searchThingLabel = ($multiSelect ? "<INPUT type=\"button\" name=\"MacroSearch\" class=\"button\" value=\"Select genomes containing\" onClick=\"selectShowing('$menuID', '$searchThingName'); $showSelect;\" />"
694                                                 : "Show genomes containing");
695            push @lines, "<br />$searchThingLabel&nbsp;" .
696                         "<INPUT type=\"text\" id=\"$searchThingName\" name=\"$searchThingName\" size=\"30\" onKeyup=\"showTyped('$menuID', '$searchThingName');\" />" .
697                         Hint("GenomeControl", "Type here to filter the genomes displayed.") . "<br />";
698            # For multi-select mode, we also have buttons to set and clear selections.
699            if ($multiSelect) {
700                push @lines, "<INPUT type=\"button\" name=\"ClearAll\" class=\"bigButton\"  value=\"Clear All\" onClick=\"clearAll(getElementById('$menuID')); $showSelect\" />";
701                push @lines, "<INPUT type=\"button\" name=\"SelectAll\" class=\"bigButton\" value=\"Select All\" onClick=\"selectAll(getElementById('$menuID')); $showSelect\" />";
702                push @lines, "<INPUT type=\"button\" name=\"NMPDROnly\" class=\"bigButton\"  value=\"Select NMPDR\" onClick=\"selectSome(getElementById('$menuID'), $nmpdrCount, true); $showSelect;\" />";
703            }
704            # Add a hidden field we can use to generate organism page hyperlinks.
705            push @lines, "<INPUT type=\"hidden\" id=\"$urlID\" value=\"$FIG_Config::cgi_url/wiki/rest.cgi/NmpdrPlugin/SeedViewer?page=Organism;organism=\" />";
706            # Add the status display. This tells the user what's selected no matter where the list is scrolled.
707            push @lines, "<DIV id=\"$divID\" class=\"Panel\"></DIV>";
708        }
709        # Assemble all the lines into a string.
710        my $retVal = join("\n", @lines, "");
711        # Return the result.
712        return $retVal;
713    }
714    
715    
716    =head3 Stem
717    
718        my $stem = $sprout->Stem($word);
719    
720    Return the stem of the specified word, or C<undef> if the word is not
721    stemmable. Note that even if the word is stemmable, the stem may be
722    the same as the original word.
723    
724    =over 4
725    
726    =item word
727    
728    Word to convert into a stem.
729    
730    =item RETURN
731    
732    Returns a stem of the word (which may be the word itself), or C<undef> if
733    the word is not stemmable.
734    
735    =back
736    
737    =cut
738    
739    sub Stem {
740        # Get the parameters.
741        my ($self, $word) = @_;
742        # Get the stemmer object.
743        my $stemmer = $self->{stemmer};
744        if (! defined $stemmer) {
745            # We don't have one pre-built, so we build and save it now.
746            $stemmer = BioWords->new(exceptions => "$FIG_Config::sproutData/Exceptions.txt",
747                                     stops => "$FIG_Config::sproutData/StopWords.txt",
748                                     cache => 0);
749            $self->{stemmer} = $stemmer;
750        }
751        # Try to stem the word.
752        my $retVal = $stemmer->Process($word);
753      # Return the result.      # Return the result.
754      return $retVal;      return $retVal;
755  }  }
756    
757    
758  =head3 Build  =head3 Build
759    
760      $sprout->Build();      $sprout->Build();
# Line 599  Line 892 
892  =item RETURN  =item RETURN
893    
894  Returns a list of the feature's contig segments. The locations are returned as a list in a list  Returns a list of the feature's contig segments. The locations are returned as a list in a list
895  context and as a comma-delimited string in a scalar context.  context and as a comma-delimited string in a scalar context. An empty list means the feature
896    wasn't found.
897    
898  =back  =back
899    
# Line 608  Line 902 
902  sub FeatureLocation {  sub FeatureLocation {
903      # Get the parameters.      # Get the parameters.
904      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
905        # Declare the return variable.
906        my @retVal = ();
907      # Get the feature record.      # Get the feature record.
908      my $object = $self->GetEntity('Feature', $featureID);      my $object = $self->GetEntity('Feature', $featureID);
909      Confess("Feature $featureID not found.") if ! defined($object);      # Only proceed if we found it.
910        if (defined $object) {
911      # Get the location string.      # Get the location string.
912      my $locString = $object->PrimaryValue('Feature(location-string)');      my $locString = $object->PrimaryValue('Feature(location-string)');
913      # Create the return list.      # Create the return list.
914      my @retVal = split /\s*,\s*/, $locString;          @retVal = split /\s*,\s*/, $locString;
915        }
916      # Return the list in the format indicated by the context.      # Return the list in the format indicated by the context.
917      return (wantarray ? @retVal : join(',', @retVal));      return (wantarray ? @retVal : join(',', @retVal));
918  }  }
# Line 1346  Line 1644 
1644  the specified user and FIG are considered trusted. If the user ID is omitted, only FIG  the specified user and FIG are considered trusted. If the user ID is omitted, only FIG
1645  is trusted.  is trusted.
1646    
1647  If the feature is B<not> identified by a FIG ID, then the functional assignment  If the feature is B<not> identified by a FIG ID, then we search the aliases for it.
1648  information is taken from the B<ExternalAliasFunc> table. If the table does  If no matching alias is found, we return an undefined value.
 not contain an entry for the feature, an undefined value is returned.  
1649    
1650  =over 4  =over 4
1651    
# Line 1374  Line 1671 
1671      my ($self, $featureID, $userID) = @_;      my ($self, $featureID, $userID) = @_;
1672      # Declare the return value.      # Declare the return value.
1673      my $retVal;      my $retVal;
1674      # Determine the ID type.      # Find a FIG ID for this feature.
1675      if ($featureID =~ m/^fig\|/) {      my ($fid) = $self->FeaturesByAlias($featureID);
1676        # Only proceed if we have an ID.
1677        if ($fid) {
1678          # Here we have a FIG feature ID.          # Here we have a FIG feature ID.
1679          if (!$userID) {          if (!$userID) {
1680              # Use the primary assignment.              # Use the primary assignment.
1681              ($retVal) = $self->GetEntityValues('Feature', $featureID, ['Feature(assignment)']);              ($retVal) = $self->GetEntityValues('Feature', $fid, ['Feature(assignment)']);
1682          } else {          } else {
1683              # We must build the list of trusted users.              # We must build the list of trusted users.
1684              my %trusteeTable = ();              my %trusteeTable = ();
# Line 1405  Line 1704 
1704              # Build a query for all of the feature's annotations, sorted by date.              # Build a query for all of the feature's annotations, sorted by date.
1705              my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],              my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
1706                                     "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",                                     "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",
1707                                     [$featureID]);                                     [$fid]);
1708              my $timeSelected = 0;              my $timeSelected = 0;
1709              # Loop until we run out of annotations.              # Loop until we run out of annotations.
1710              while (my $annotation = $query->Fetch()) {              while (my $annotation = $query->Fetch()) {
# Line 1425  Line 1724 
1724                  }                  }
1725              }              }
1726          }          }
     } else {  
         # Here we have a non-FIG feature ID. In this case the user ID does not  
         # matter. We simply get the information from the External Alias Function  
         # table.  
         ($retVal) = $self->GetEntityValues('ExternalAliasFunc', $featureID, ['ExternalAliasFunc(func)']);  
1727      }      }
1728      # Return the assignment found.      # Return the assignment found.
1729      return $retVal;      return $retVal;
# Line 1448  Line 1742 
1742  annotation itself because it's a text field; however, this is not a big problem because  annotation itself because it's a text field; however, this is not a big problem because
1743  most features only have a small number of annotations.  most features only have a small number of annotations.
1744    
 If the feature is B<not> identified by a FIG ID, then the functional assignment  
 information is taken from the B<ExternalAliasFunc> table. If the table does  
 not contain an entry for the feature, an empty list is returned.  
   
1745  =over 4  =over 4
1746    
1747  =item featureID  =item featureID
# Line 1472  Line 1762 
1762      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
1763      # Declare the return value.      # Declare the return value.
1764      my @retVal = ();      my @retVal = ();
1765      # Determine the ID type.      # Convert to a FIG ID.
1766      if ($featureID =~ m/^fig\|/) {      my ($fid) = $self->FeaturesByAlias($featureID);
1767        # Only proceed if we found one.
1768        if ($fid) {
1769          # Here we have a FIG feature ID. We must build the list of trusted          # Here we have a FIG feature ID. We must build the list of trusted
1770          # users.          # users.
1771          my %trusteeTable = ();          my %trusteeTable = ();
1772          # Build a query for all of the feature's annotations, sorted by date.          # Build a query for all of the feature's annotations, sorted by date.
1773          my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],          my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
1774                                 "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",                                 "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",
1775                                 [$featureID]);                                 [$fid]);
1776          my $timeSelected = 0;          my $timeSelected = 0;
1777          # Loop until we run out of annotations.          # Loop until we run out of annotations.
1778          while (my $annotation = $query->Fetch()) {          while (my $annotation = $query->Fetch()) {
# Line 1495  Line 1787 
1787                  push @retVal, [$actualUser, $function];                  push @retVal, [$actualUser, $function];
1788              }              }
1789          }          }
     } else {  
         # Here we have a non-FIG feature ID. In this case the user ID does not  
         # matter. We simply get the information from the External Alias Function  
         # table.  
         my @assignments = $self->GetEntityValues('ExternalAliasFunc', $featureID,  
                                                  ['ExternalAliasFunc(func)']);  
         push @retVal, map { ['master', $_] } @assignments;  
1790      }      }
1791      # Return the assignments found.      # Return the assignments found.
1792      return @retVal;      return @retVal;
# Line 1689  Line 1974 
1974      if ($featureID =~ /^fig\|(\d+\.\d+)/) {      if ($featureID =~ /^fig\|(\d+\.\d+)/) {
1975          $retVal = $1;          $retVal = $1;
1976      } else {      } else {
1977          Confess("Invalid feature ID $featureID.");          # Find the feature by alias.
1978            my ($realFeatureID) = $self->FeaturesByAlias($featureID);
1979            if ($realFeatureID && $realFeatureID =~ /^fig\|(\d+\.\d+)/) {
1980                $retVal = $1;
1981            }
1982      }      }
1983      # Return the value found.      # Return the value found.
1984      return $retVal;      return $retVal;
# Line 2529  Line 2818 
2818      return @retVal;      return @retVal;
2819  }  }
2820    
 =head3 GetProperties  
   
     my @list = $sprout->GetProperties($fid, $key, $value, $url);  
   
 Return a list of the properties with the specified characteristics.  
   
 Properties are the Sprout analog of the FIG attributes. The call is  
 passed directly to the CustomAttributes or RemoteCustomAttributes object  
 contained in this object.  
   
 This method returns a series of tuples that match the specified criteria. Each tuple  
 will contain an object ID, a key, and one or more values. The parameters to this  
 method therefore correspond structurally to the values expected in each tuple. In  
 addition, you can ask for a generic search by suffixing a percent sign (C<%>) to any  
 of the parameters. So, for example,  
   
     my @attributeList = $sprout->GetProperties('fig|100226.1.peg.1004', 'structure%', 1, 2);  
   
 would return something like  
   
     ['fig}100226.1.peg.1004', 'structure', 1, 2]  
     ['fig}100226.1.peg.1004', 'structure1', 1, 2]  
     ['fig}100226.1.peg.1004', 'structure2', 1, 2]  
     ['fig}100226.1.peg.1004', 'structureA', 1, 2]  
   
 Use of C<undef> in any position acts as a wild card (all values). You can also specify  
 a list reference in the ID column. Thus,  
   
     my @attributeList = $sprout->GetProperties(['100226.1', 'fig|100226.1.%'], 'PUBMED');  
   
 would get the PUBMED attribute data for Streptomyces coelicolor A3(2) and all its  
 features.  
   
 In addition to values in multiple sections, a single attribute key can have multiple  
 values, so even  
   
     my @attributeList = $sprout->GetProperties($peg, 'virulent');  
   
 which has no wildcard in the key or the object ID, may return multiple tuples.  
   
 =over 4  
   
 =item objectID  
   
 ID of object whose attributes are desired. If the attributes are desired for multiple  
 objects, this parameter can be specified as a list reference. If the attributes are  
 desired for all objects, specify C<undef> or an empty string. Finally, you can specify  
 attributes for a range of object IDs by putting a percent sign (C<%>) at the end.  
   
 =item key  
   
 Attribute key name. A value of C<undef> or an empty string will match all  
 attribute keys. If the values are desired for multiple keys, this parameter can be  
 specified as a list reference. Finally, you can specify attributes for a range of  
 keys by putting a percent sign (C<%>) at the end.  
   
 =item values  
   
 List of the desired attribute values, section by section. If C<undef>  
 or an empty string is specified, all values in that section will match. A  
 generic match can be requested by placing a percent sign (C<%>) at the end.  
 In that case, all values that match up to and not including the percent sign  
 will match. You may also specify a regular expression enclosed  
 in slashes. All values that match the regular expression will be returned. For  
 performance reasons, only values have this extra capability.  
   
 =item RETURN  
   
 Returns a list of tuples. The first element in the tuple is an object ID, the  
 second is an attribute key, and the remaining elements are the sections of  
 the attribute value. All of the tuples will match the criteria set forth in  
 the parameter list.  
   
 =back  
   
 =cut  
   
 sub GetProperties {  
     # Get the parameters.  
     my ($self, @parms) = @_;  
     # Declare the return variable.  
     my @retVal = $self->{_ca}->GetAttributes(@parms);  
     # Return the result.  
     return @retVal;  
 }  
   
2821  =head3 FeatureProperties  =head3 FeatureProperties
2822    
2823      my @properties = $sprout->FeatureProperties($featureID);      my @properties = $sprout->FeatureProperties($featureID);
# Line 2643  Line 2846 
2846      # Get the parameters.      # Get the parameters.
2847      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
2848      # Get the properties.      # Get the properties.
2849      my @attributes = $self->{_ca}->GetAttributes($featureID);      my @attributes = $self->ca->GetAttributes($featureID);
2850      # Strip the feature ID off each tuple.      # Strip the feature ID off each tuple.
2851      my @retVal = ();      my @retVal = ();
2852      for my $attributeRow (@attributes) {      for my $attributeRow (@attributes) {
# Line 2915  Line 3118 
3118  sub SubsystemList {  sub SubsystemList {
3119      # Get the parameters.      # Get the parameters.
3120      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
3121      # Get the list of names.      # Get the list of names. We do a join to the Subsystem table because we have missing subsystems in
3122      my @retVal = $self->GetFlat(['HasRoleInSubsystem'], "HasRoleInSubsystem(from-link) = ?",      # the Sprout database!
3123        my @retVal = $self->GetFlat(['HasRoleInSubsystem', 'Subsystem'], "HasRoleInSubsystem(from-link) = ?",
3124                                  [$featureID], 'HasRoleInSubsystem(to-link)');                                  [$featureID], 'HasRoleInSubsystem(to-link)');
3125      # Return the result, sorted.      # Return the result, sorted.
3126      return sort @retVal;      return sort @retVal;
# Line 2949  Line 3153 
3153      # Declare the return variable.      # Declare the return variable.
3154      my %retVal = ();      my %retVal = ();
3155      # Get a list of the genome features that participate in subsystems. For each      # Get a list of the genome features that participate in subsystems. For each
3156      # feature we get its spreadsheet cells and the corresponding roles.      # feature we get its subsystem ID and the corresponding roles.
3157      my @roleData = $self->GetAll(['HasFeature', 'ContainsFeature', 'IsRoleOf'],      my @roleData = $self->GetAll(['HasFeature', 'ContainsFeature', 'IsRoleOf', 'HasSSCell'],
3158                               "HasFeature(from-link) = ?", [$genomeID],                               "HasFeature(from-link) = ?", [$genomeID],
3159                               ['HasFeature(to-link)', 'IsRoleOf(to-link)', 'IsRoleOf(from-link)']);                                   ['HasFeature(to-link)', 'IsRoleOf(from-link)',  'HasSSCell(from-link)']);
3160      # Now we get a list of the spreadsheet cells and their associated subsystems. Subsystems      # Now we get a list of valid subsystems. These are the subsystems connected to the genome with
3161      # with an unknown variant code (-1) are skipped. Note the genome ID is at both ends of the      # a non-negative variant code.
3162      # list. We use it at the beginning to get all the spreadsheet cells for the genome and      my %subs = map { $_ => 1 } $self->GetFlat(['ParticipatesIn'],
3163      # again at the end to filter out participation in subsystems with a negative variant code.                                                  "ParticipatesIn(from-link) = ? AND ParticipatesIn(variant-code) >= 0",
3164      my @cellData = $self->GetAll(['IsGenomeOf', 'HasSSCell', 'ParticipatesIn'],                                                  [$genomeID], 'ParticipatesIn(to-link)');
3165                                   "IsGenomeOf(from-link) = ? AND ParticipatesIn(variant-code) >= 0 AND ParticipatesIn(from-link) = ?",      # We loop through @roleData to build the hash.
                                  [$genomeID, $genomeID], ['HasSSCell(to-link)', 'HasSSCell(from-link)']);  
     # Now "@roleData" lists the spreadsheet cell and role for each of the genome's features.  
     # "@cellData" lists the subsystem name for each of the genome's spreadsheet cells. We  
     # link these two lists together to create the result. First, we want a hash mapping  
     # spreadsheet cells to subsystem names.  
     my %subHash = map { $_->[0] => $_->[1] } @cellData;  
     # We loop through @cellData to build the hash.  
3166      for my $roleEntry (@roleData) {      for my $roleEntry (@roleData) {
3167          # Get the data for this feature and cell.          # Get the data for this feature and cell.
3168          my ($fid, $cellID, $role) = @{$roleEntry};          my ($fid, $role, $subsys) = @{$roleEntry};
3169          # Check for a subsystem name.          Trace("Subsystem for $fid is $subsys.") if T(4);
3170          my $subsys = $subHash{$cellID};          # Check the subsystem;
3171          if ($subsys) {          if ($subs{$subsys}) {
3172                Trace("Subsystem found.") if T(4);
3173              # Insure this feature has an entry in the return hash.              # Insure this feature has an entry in the return hash.
3174              if (! exists $retVal{$fid}) { $retVal{$fid} = []; }              if (! exists $retVal{$fid}) { $retVal{$fid} = []; }
3175              # Merge in this new data.              # Merge in this new data.
# Line 3649  Line 3847 
3847      my ($self, %groupHash) = @_;      my ($self, %groupHash) = @_;
3848      # Create the result hash.      # Create the result hash.
3849      my %retVal = ();      my %retVal = ();
     # Get the super-group table.  
     my %superTable = $self->CheckGroupFile();  
3850      # Copy over the genomes.      # Copy over the genomes.
3851      for my $groupID (keys %groupHash) {      for my $groupID (keys %groupHash) {
3852          # Get the super-group name.          # Get the super-group name.
3853          my $realGroupID;          my $realGroupID = $self->SuperGroup($groupID);
3854          if ($groupID =~ /([A-Z]\w+)/) {          # Append this group's genomes into the result hash
3855              if (! defined($superTable{$1})) {          # using the super-group name.
                 Confess("Super-group name not found for group $groupID.");  
             } else {  
                 $realGroupID = $1;  
             }  
         } else {  
             Confess("Invalid group name $groupID.");  
         }  
         # Append this group's genomes into the result hash.  
3856          push @{$retVal{$realGroupID}}, @{$groupHash{$groupID}};          push @{$retVal{$realGroupID}}, @{$groupHash{$groupID}};
3857      }      }
3858      # Return the result hash.      # Return the result hash.
# Line 3695  Line 3883 
3883  sub GroupPageName {  sub GroupPageName {
3884      # Get the parameters.      # Get the parameters.
3885      my ($self, $group) = @_;      my ($self, $group) = @_;
     # Declare the return variable.  
     my $retVal;  
3886      # Check for the group file data.      # Check for the group file data.
3887      my %superTable = $self->CheckGroupFile();      my %superTable = $self->CheckGroupFile();
3888      # Compute the real group name.      # Compute the real group name.
3889      if ($group =~ /([A-Z]\w+)/) {      my $realGroup = $self->SuperGroup($group);
3890          my $realGroup = $1;      # Get the associated page name.
3891          if (! defined($superTable{$1})) {      my $retVal = "../content/$superTable{$realGroup}->{page}";
             Confess("No super-group found for \"$group\".");  
         } else {  
             $retVal = "../content/$superTable{$1}->{page}";  
         }  
     } else {  
         Confess("\"group\" is not a valid group name.");  
     }  
3892      # Return the result.      # Return the result.
3893      return $retVal;      return $retVal;
3894  }  }
# Line 3743  Line 3922 
3922      # Get the parameters.      # Get the parameters.
3923      my ($self, $featureID, $key, @values) = @_;      my ($self, $featureID, $key, @values) = @_;
3924      # Add the property using the attached attributes object.      # Add the property using the attached attributes object.
3925      $self->{_ca}->AddAttribute($featureID, $key, @values);      $self->ca->AddAttribute($featureID, $key, @values);
3926  }  }
3927    
3928  =head3 CheckGroupFile  =head3 CheckGroupFile
# Line 3830  Line 4009 
4009  sub CleanKeywords {  sub CleanKeywords {
4010      # Get the parameters.      # Get the parameters.
4011      my ($self, $searchExpression) = @_;      my ($self, $searchExpression) = @_;
4012      # Perform the standard cleanup.      # Get the stemmer.
4013      my $retVal = $self->ERDB::CleanKeywords($searchExpression);      my $stemmer = $self->GetStemmer();
4014      # Fix the periods in EC and TC numbers.      # Convert the search expression using the stemmer.
4015      $retVal =~ s/(\d+|\-)\.(\d+|-)\.(\d+|-)\.(\d+|-)/$1_$2_$3_$4/g;      my $retVal = $stemmer->PrepareSearchExpression($searchExpression);
4016      # Fix non-trailing periods.      Trace("Cleaned keyword list for \"$searchExpression\" is \"$retVal\".") if T(3);
     $retVal =~ s/\.(\w)/_$1/g;  
     # Fix non-leading minus signs.  
     $retVal =~ s/(\w)[\-]/$1_/g;  
     # Fix the vertical bars and colons  
     $retVal =~ s/(\w)[|:](\w)/$1'$2/g;  
4017      # Return the result.      # Return the result.
4018      return $retVal;      return $retVal;
4019  }  }
4020    
4021    =head3 GetSourceObject
4022    
4023        my $source = $erdb->GetSourceObject();
4024    
4025    Return the object to be used in creating load files for this database.
4026    
4027    =cut
4028    
4029    sub GetSourceObject {
4030        # Get access to the FIG code.
4031        require FIG;
4032        # Return a FIG object.
4033        return FIG->new();
4034    }
4035    
4036    =head3 SectionList
4037    
4038        my @sections = $erdb->SectionList($source);
4039    
4040    Return a list of the names for the different data sections used when loading this database.
4041    The default is an empty string, in which case there is only one section representing the
4042    entire database.
4043    
4044    =over 4
4045    
4046    =item source
4047    
4048    Source object used to access the data from which the database is loaded. This is the
4049    same object returned by L</GetSourceObject>; however, we ask the caller to pass it
4050    in as a parameter so that we don't end up creating multiple copies of a potentially
4051    expensive data structure.
4052    
4053    =item RETURN
4054    
4055    Returns a list of section names.
4056    
4057    =back
4058    
4059    =cut
4060    
4061    sub SectionList {
4062        # Get the parameters.
4063        my ($self, $source) = @_;
4064        # Ask the BaseSproutLoader for a section list.
4065        require BaseSproutLoader;
4066        my @retVal = BaseSproutLoader::GetSectionList($self, $source);
4067        # Return the list.
4068        return @retVal;
4069    }
4070    
4071    =head3 Loader
4072    
4073        my $groupLoader = $erdb->Loader($groupName, $source, $options);
4074    
4075    Return an [[ERDBLoadGroupPm]] object for the specified load group. This method is used
4076    by [[ERDBGeneratorPl]] to create the load group objects. If you are not using
4077    [[ERDBGeneratorPl]], you don't need to override this method.
4078    
4079    =over 4
4080    
4081    =item groupName
4082    
4083    Name of the load group whose object is to be returned. The group name is
4084    guaranteed to be a single word with only the first letter capitalized.
4085    
4086    =item source
4087    
4088    The source object used to access the data from which the load file is derived. This
4089    is the same object returned by L</GetSourceObject>; however, we ask the caller to pass
4090    it in as a parameter so that we don't end up creating multiple copies of a potentially
4091    expensive data structure.
4092    
4093    =item options
4094    
4095    Reference to a hash of command-line options.
4096    
4097    =item RETURN
4098    
4099    Returns an [[ERDBLoadGroupPm]] object that can be used to process the specified load group
4100    for this database.
4101    
4102    =back
4103    
4104    =cut
4105    
4106    sub Loader {
4107        # Get the parameters.
4108        my ($self, $groupName, $source, $options) = @_;
4109        # Compute the loader name.
4110        my $loaderClass = "${groupName}SproutLoader";
4111        # Pull in its definition.
4112        require "$loaderClass.pm";
4113        # Create an object for it.
4114        my $retVal = eval("$loaderClass->new(\$self, \$source, \$options)");
4115        # Insure it worked.
4116        Confess("Could not create $loaderClass object: $@") if $@;
4117        # Return it to the caller.
4118        return $retVal;
4119    }
4120    
4121    =head3 LoadGroupList
4122    
4123        my @groups = $erdb->LoadGroupList();
4124    
4125    Returns a list of the names for this database's load groups. This method is used
4126    by [[ERDBGeneratorPl]] when the user wishes to load all table groups. The default
4127    is a single group called 'All' that loads everything.
4128    
4129    =cut
4130    
4131    sub LoadGroupList {
4132        # Return the list.
4133        return qw(Genome Subsystem Annotation Property Source Reaction Synonym Drug Feature);
4134    }
4135    
4136    =head3 LoadDirectory
4137    
4138        my $dirName = $erdb->LoadDirectory();
4139    
4140    Return the name of the directory in which load files are kept. The default is
4141    the FIG temporary directory, which is a really bad choice, but it's always there.
4142    
4143    =cut
4144    
4145    sub LoadDirectory {
4146        # Get the parameters.
4147        my ($self) = @_;
4148        # Return the directory name.
4149        return $self->{dataDir};
4150    }
4151    
4152  =head2 Internal Utility Methods  =head2 Internal Utility Methods
4153    
4154    =head3 GetStemmer
4155    
4156        my $stermmer = $sprout->GetStemmer();
4157    
4158    Return the stemmer object for this database.
4159    
4160    =cut
4161    
4162    sub GetStemmer {
4163        # Get the parameters.
4164        my ($self) = @_;
4165        # Declare the return variable.
4166        my $retVal = $self->{stemmer};
4167        if (! defined $retVal) {
4168            # We don't have one pre-built, so we build and save it now.
4169            $retVal = BioWords->new(exceptions => "$FIG_Config::sproutData/Exceptions.txt",
4170                                     stops => "$FIG_Config::sproutData/StopWords.txt",
4171                                     cache => 1);
4172            $self->{stemmer} = $retVal;
4173        }
4174        # Return the result.
4175        return $retVal;
4176    }
4177    
4178  =head3 ParseAssignment  =head3 ParseAssignment
4179    
4180  Parse annotation text to determine whether or not it is a functional assignment. If it is,  Parse annotation text to determine whether or not it is a functional assignment. If it is,
# Line 3969  Line 4298 
4298  }  }
4299    
4300    
4301    =head3 Hint
4302    
4303        my $htmlText = SearchHelper::Hint($wikiPage, $hintText);
4304    
4305    Return the HTML for a small question mark that displays the specified hint text when it is clicked.
4306    This HTML can be put in forms to provide a useful hinting mechanism.
4307    
4308    =over 4
4309    
4310    =item wikiPage
4311    
4312    Name of the wiki page to be popped up when the hint mark is clicked.
4313    
4314    =item hintText
4315    
4316    Text to display for the hint. It is raw html, but may not contain any double quotes.
4317    
4318    =item RETURN
4319    
4320    Returns the html for the hint facility. The resulting html shows a small button-like thing that
4321    uses the standard FIG popup technology.
4322    
4323    =back
4324    
4325    =cut
4326    
4327    sub Hint {
4328        # Get the parameters.
4329        my ($wikiPage, $hintText) = @_;
4330        # Escape the single quotes in the hint text.
4331        my $quotedText = $hintText;
4332        $quotedText =~ s/'/\\'/g;
4333        # Convert the wiki page name to a URL.
4334        my $wikiURL = join("", map { ucfirst $_ } split /\s+/, $wikiPage);
4335        $wikiURL = "$FIG_Config::cgi_url/wiki/view.cgi/FIG/$wikiURL";
4336        # Compute the mouseover script.
4337        my $mouseOver = "doTooltip(this, '$quotedText')";
4338        # Create the html.
4339        my $retVal = "&nbsp;<a href=\"$wikiURL\"><img src=\"$FIG_Config::cgi_url/Html/button-h.png\" class=\"helpicon\" onmouseover=\"$mouseOver\"/></a>";
4340        # Return it.
4341        return $retVal;
4342    }
4343    
4344  1;  1;

Legend:
Removed from v.1.106  
changed lines
  Added in v.1.121

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3