[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.34, Wed Sep 14 13:43:31 2005 UTC revision 1.58, Tue Jun 6 05:07:15 2006 UTC
# Line 1  Line 1 
1  package Sprout;  package Sprout;
2    
3        require Exporter;
4        use ERDB;
5        @ISA = qw(Exporter ERDB);
6      use Data::Dumper;      use Data::Dumper;
7      use strict;      use strict;
8      use Carp;      use Carp;
# Line 7  Line 10 
10      use XML::Simple;      use XML::Simple;
11      use DBQuery;      use DBQuery;
12      use DBObject;      use DBObject;
     use ERDB;  
13      use Tracer;      use Tracer;
14      use FIGRules;      use FIGRules;
15      use Stats;      use Stats;
# Line 32  Line 34 
34  query tasks. For example, L</genomes> lists the IDs of all the genomes in the database and  query tasks. For example, L</genomes> lists the IDs of all the genomes in the database and
35  L</dna_seq> returns the DNA sequence for a specified genome location.  L</dna_seq> returns the DNA sequence for a specified genome location.
36    
37    The Sprout object is a subclass of the ERDB object and inherits all its properties and methods.
38    
39  =cut  =cut
40    
41  #: Constructor SFXlate->new_sprout_only();  #: Constructor SFXlate->new_sprout_only();
# Line 62  Line 66 
66    
67  * B<xmlFileName> name of the XML file containing the database definition (default C<SproutDBD.xml>)  * B<xmlFileName> name of the XML file containing the database definition (default C<SproutDBD.xml>)
68    
69  * B<userData> user name and password, delimited by a slash (default C<root/>)  * B<userData> user name and password, delimited by a slash (default same as SEED)
70    
71  * B<port> connection port (default C<0>)  * B<port> connection port (default C<0>)
72    
73    * B<sock> connection socket (default same as SEED)
74    
75  * B<maxSegmentLength> maximum number of residues per feature segment, (default C<4500>)  * B<maxSegmentLength> maximum number of residues per feature segment, (default C<4500>)
76    
77  * B<maxSequenceLength> maximum number of residues per sequence, (default C<8000>)  * B<maxSequenceLength> maximum number of residues per sequence, (default C<8000>)
# Line 92  Line 98 
98                                                          # database type                                                          # database type
99                         dataDir      => $FIG_Config::sproutData,                         dataDir      => $FIG_Config::sproutData,
100                                                          # data file directory                                                          # data file directory
101                         xmlFileName  => "$FIG_Config::sproutData/SproutDBD.xml",                         xmlFileName  => "$FIG_Config::fig/SproutDBD.xml",
102                                                          # database definition file name                                                          # database definition file name
103                         userData     => "$FIG_Config::dbuser/$FIG_Config::dbpass",                         userData     => "$FIG_Config::dbuser/$FIG_Config::dbpass",
104                                                          # user name and password                                                          # user name and password
105                         port         => $FIG_Config::dbport,                         port         => $FIG_Config::dbport,
106                                                          # database connection port                                                          # database connection port
107                           sock         => $FIG_Config::dbsock,
108                         maxSegmentLength => 4500,        # maximum feature segment length                         maxSegmentLength => 4500,        # maximum feature segment length
109                         maxSequenceLength => 8000,       # maximum contig sequence length                         maxSequenceLength => 8000,       # maximum contig sequence length
110                         noDBOpen     => 0,               # 1 to suppress the database open                         noDBOpen     => 0,               # 1 to suppress the database open
# Line 111  Line 118 
118      my $dbh;      my $dbh;
119      if (! $optionTable->{noDBOpen}) {      if (! $optionTable->{noDBOpen}) {
120          $dbh = DBKernel->new($optionTable->{dbType}, $dbName, $userName,          $dbh = DBKernel->new($optionTable->{dbType}, $dbName, $userName,
121                                  $password, $optionTable->{port});                                  $password, $optionTable->{port}, undef, $optionTable->{sock});
122      }      }
123      # Create the ERDB object.      # Create the ERDB object.
124      my $xmlFileName = "$optionTable->{xmlFileName}";      my $xmlFileName = "$optionTable->{xmlFileName}";
125      my $erdb = ERDB->new($dbh, $xmlFileName);      my $retVal = ERDB::new($class, $dbh, $xmlFileName);
126      # Create this object.      # Add the option table and XML file name.
127      my $self = { _erdb => $erdb, _options => $optionTable, _xmlName => $xmlFileName };      $retVal->{_options} = $optionTable;
128      # Bless and return it.      $retVal->{_xmlName} = $xmlFileName;
129      bless $self;      # Return it.
130      return $self;      return $retVal;
131  }  }
132    
133  =head3 MaxSegment  =head3 MaxSegment
# Line 155  Line 162 
162      return $self->{_options}->{maxSequenceLength};      return $self->{_options}->{maxSequenceLength};
163  }  }
164    
 =head3 Get  
   
 C<< my $query = $sprout->Get(\@objectNames, $filterClause, \@parameterList); >>  
   
 This method allows a general query against the Sprout data using a specified filter clause.  
   
 The filter is a standard WHERE/ORDER BY clause with question marks as parameter markers and each  
 field name represented in the form B<I<objectName>(I<fieldName>)>. For example, the  
 following call requests all B<Genome> objects for the genus specified in the variable  
 $genus.  
   
 C<< $query = $sprout->Get(['Genome'], "Genome(genus) = ?", [$genus]); >>  
   
 The WHERE clause contains a single question mark, so there is a single additional  
 parameter representing the parameter value. It would also be possible to code  
   
 C<< $query = $sprout->Get(['Genome'], "Genome(genus) = \'$genus\'"); >>  
   
 however, this version of the call would generate a syntax error if there were any quote  
 characters inside the variable C<$genus>.  
   
 The use of the strange parenthesized notation for field names enables us to distinguish  
 hyphens contained within field names from minus signs that participate in the computation  
 of the WHERE clause. All of the methods that manipulate fields will use this same notation.  
   
 It is possible to specify multiple entity and relationship names in order to retrieve more than  
 one object's data at the same time, which allows highly complex joined queries. For example,  
   
 C<< $query = $sprout->Get(['Genome', 'ComesFrom', 'Source'], "Genome(genus) = ?", [$genus]); >>  
   
 This query returns all the genomes for a particular genus and allows access to the  
 sources from which they came. The join clauses to go from Genome to Source are generated  
 automatically.  
   
 Finally, the filter clause can contain sort information. To do this, simply put an C<ORDER BY>  
 clause at the end of the filter. Field references in the ORDER BY section follow the same rules  
 as they do in the filter itself; in other words, each one must be of the form B<I<objectName>(I<fieldName>)>.  
 For example, the following filter string gets all genomes for a particular genus and sorts  
 them by species name.  
   
 C<< $query = $sprout->Get(['Genome'], "Genome(genus) = ? ORDER BY Genome(species)", [$genus]); >>  
   
 It is also permissible to specify I<only> an ORDER BY clause. For example, the following invocation gets  
 all genomes ordered by genus and species.  
   
 C<< $query = $sprout->Get(['Genome'], "ORDER BY Genome(genus), Genome(species)"); >>  
   
 Odd things may happen if one of the ORDER BY fields is in a secondary relation. So, for example, an  
 attempt to order B<Feature>s by alias may (depending on the underlying database engine used) cause  
 a single feature to appear more than once.  
   
 If multiple names are specified, then the query processor will automatically determine a  
 join path between the entities and relationships. The algorithm used is very simplistic.  
 In particular, you can't specify any entity or relationship more than once, and if a  
 relationship is recursive, the path is determined by the order in which the entity  
 and the relationship appear. For example, consider a recursive relationship B<IsParentOf>  
 which relates B<People> objects to other B<People> objects. If the join path is  
 coded as C<['People', 'IsParentOf']>, then the people returned will be parents. If, however,  
 the join path is C<['IsParentOf', 'People']>, then the people returned will be children.  
   
 =over 4  
   
 =item objectNames  
   
 List containing the names of the entity and relationship objects to be retrieved.  
   
 =item filterClause  
   
 WHERE/ORDER BY clause (without the WHERE) to be used to filter and sort the query. The WHERE clause can  
 be parameterized with parameter markers (C<?>). Each field used must be specified in the standard form  
 B<I<objectName>(I<fieldName>)>. Any parameters specified in the filter clause should be added to the  
 parameter list as additional parameters. The fields in a filter clause can come from primary  
 entity relations, relationship relations, or secondary entity relations; however, all of the  
 entities and relationships involved must be included in the list of object names.  
   
 =item parameterList  
   
 List of the parameters to be substituted in for the parameters marks in the filter clause.  
   
 =item RETURN  
   
 Returns a B<DBQuery> that can be used to iterate through all of the results.  
   
 =back  
   
 =cut  
   
 sub Get {  
     # Get the parameters.  
     my ($self, $objectNames, $filterClause, $parameterList) = @_;  
     # We differ from the ERDB Get method in that the parameter list is passed in as a list reference  
     # rather than a list of parameters. The next step is to convert the parameters from a reference  
     # to a real list. We can only do this if the parameters have been specified.  
     my @parameters;  
     if ($parameterList) { @parameters = @{$parameterList}; }  
     return $self->{_erdb}->Get($objectNames, $filterClause, @parameters);  
 }  
   
 =head3 GetEntity  
   
 C<< my $entityObject = $sprout->GetEntity($entityType, $ID); >>  
   
 Return an object describing the entity instance with a specified ID.  
   
 =over 4  
   
 =item entityType  
   
 Entity type name.  
   
 =item ID  
   
 ID of the desired entity.  
   
 =item RETURN  
   
 Returns a B<DBObject> representing the desired entity instance, or an undefined value if no  
 instance is found with the specified key.  
   
 =back  
   
 =cut  
   
 sub GetEntity {  
     # Get the parameters.  
     my ($self, $entityType, $ID) = @_;  
     # Call the ERDB method.  
     return $self->{_erdb}->GetEntity($entityType, $ID);  
 }  
   
 =head3 GetEntityValues  
   
 C<< my @values = GetEntityValues($entityType, $ID, \@fields); >>  
   
 Return a list of values from a specified entity instance.  
   
 =over 4  
   
 =item entityType  
   
 Entity type name.  
   
 =item ID  
   
 ID of the desired entity.  
   
 =item fields  
   
 List of field names, each of the form I<objectName>C<(>I<fieldName>C<)>.  
   
 =item RETURN  
   
 Returns a flattened list of the values of the specified fields for the specified entity.  
   
 =back  
   
 =cut  
 #: Return Type @;  
 sub GetEntityValues {  
     # Get the parameters.  
     my ($self, $entityType, $ID, $fields) = @_;  
     # Call the ERDB method.  
     return $self->{_erdb}->GetEntityValues($entityType, $ID, $fields);  
 }  
   
 =head3 ShowMetaData  
   
 C<< $sprout->ShowMetaData($fileName); >>  
   
 This method outputs a description of the database to an HTML file in the data directory.  
   
 =over 4  
   
 =item fileName  
   
 Fully-qualified name to give to the output file.  
   
 =back  
   
 =cut  
   
 sub ShowMetaData {  
     # Get the parameters.  
     my ($self, $fileName) = @_;  
     # Compute the file name.  
     my $options = $self->{_options};  
     # Call the show method on the underlying ERDB object.  
     $self->{_erdb}->ShowMetaData($fileName);  
 }  
   
165  =head3 Load  =head3 Load
166    
167  C<< $sprout->Load($rebuild); >>;  C<< $sprout->Load($rebuild); >>;
# Line 379  Line 196 
196  sub Load {  sub Load {
197      # Get the parameters.      # Get the parameters.
198      my ($self, $rebuild) = @_;      my ($self, $rebuild) = @_;
     # Get the database object.  
     my $erdb = $self->{_erdb};  
199      # Load the tables from the data directory.      # Load the tables from the data directory.
200      my $retVal = $erdb->LoadTables($self->{_options}->{dataDir}, $rebuild);      my $retVal = $self->LoadTables($self->{_options}->{dataDir}, $rebuild);
201      # Return the statistics.      # Return the statistics.
202      return $retVal;      return $retVal;
203  }  }
204    
205  =head3 LoadUpdate  =head3 LoadUpdate
206    
207  C<< my %stats = $sprout->LoadUpdate($truncateFlag, \@tableList); >>  C<< my $stats = $sprout->LoadUpdate($truncateFlag, \@tableList); >>
208    
209  Load updates to one or more database tables. This method enables the client to make changes to one  Load updates to one or more database tables. This method enables the client to make changes to one
210  or two tables without reloading the whole database. For each table, there must be a corresponding  or two tables without reloading the whole database. For each table, there must be a corresponding
# Line 422  Line 237 
237  sub LoadUpdate {  sub LoadUpdate {
238      # Get the parameters.      # Get the parameters.
239      my ($self, $truncateFlag, $tableList) = @_;      my ($self, $truncateFlag, $tableList) = @_;
     # Get the database object.  
     my $erdb = $self->{_erdb};  
240      # Declare the return value.      # Declare the return value.
241      my $retVal = Stats->new();      my $retVal = Stats->new();
242      # Get the data directory.      # Get the data directory.
# Line 437  Line 250 
250              Trace("No load file found for $tableName in $dataDir.") if T(0);              Trace("No load file found for $tableName in $dataDir.") if T(0);
251          } else {          } else {
252              # Attempt to load this table.              # Attempt to load this table.
253              my $result = $erdb->LoadTable($fileName, $tableName, $truncateFlag);              my $result = $self->LoadTable($fileName, $tableName, $truncateFlag);
254              # Accumulate the resulting statistics.              # Accumulate the resulting statistics.
255              $retVal->Accumulate($result);              $retVal->Accumulate($result);
256          }          }
# Line 446  Line 259 
259      return $retVal;      return $retVal;
260  }  }
261    
262    =head3 GenomeCounts
263    
264    C<< my ($arch, $bact, $euk, $vir, $env, $unk) = $sprout->GenomeCounts($complete); >>
265    
266    Count the number of genomes in each domain. If I<$complete> is TRUE, only complete
267    genomes will be included in the counts.
268    
269    =over 4
270    
271    =item complete
272    
273    TRUE if only complete genomes are to be counted, FALSE if all genomes are to be
274    counted
275    
276    =item RETURN
277    
278    A six-element list containing the number of genomes in each of six categories--
279    Archaea, Bacteria, Eukaryota, Viral, Environmental, and Unknown, respectively.
280    
281    =back
282    
283    =cut
284    
285    sub GenomeCounts {
286        # Get the parameters.
287        my ($self, $complete) = @_;
288        # Set the filter based on the completeness flag.
289        my $filter = ($complete ? "Genome(complete) = 1" : "");
290        # Get all the genomes and the related taxonomy information.
291        my @genomes = $self->GetAll(['Genome'], $filter, [], ['Genome(id)', 'Genome(taxonomy)']);
292        # Clear the counters.
293        my ($arch, $bact, $euk, $vir, $env, $unk) = (0, 0, 0, 0, 0, 0);
294        # Loop through, counting the domains.
295        for my $genome (@genomes) {
296            if    ($genome->[1] =~ /^archaea/i)  { ++$arch }
297            elsif ($genome->[1] =~ /^bacter/i)   { ++$bact }
298            elsif ($genome->[1] =~ /^eukar/i)    { ++$euk }
299            elsif ($genome->[1] =~ /^vir/i)      { ++$vir }
300            elsif ($genome->[1] =~ /^env/i)      { ++$env }
301            else  { ++$unk }
302        }
303        # Return the counts.
304        return ($arch, $bact, $euk, $vir, $env, $unk);
305    }
306    
307  =head3 Build  =head3 Build
308    
309  C<< $sprout->Build(); >>  C<< $sprout->Build(); >>
# Line 460  Line 318 
318      # Get the parameters.      # Get the parameters.
319      my ($self) = @_;      my ($self) = @_;
320      # Create the tables.      # Create the tables.
321      $self->{_erdb}->CreateTables;      $self->CreateTables();
322  }  }
323    
324  =head3 Genomes  =head3 Genomes
# Line 610  Line 468 
468          if ($prevContig eq $contigID && $dir eq $prevDir) {          if ($prevContig eq $contigID && $dir eq $prevDir) {
469              # Here the new segment is in the same direction on the same contig. Insure the              # Here the new segment is in the same direction on the same contig. Insure the
470              # new segment's beginning is next to the old segment's end.              # new segment's beginning is next to the old segment's end.
471              if (($dir eq "-" && $beg == $prevBeg - $prevLen) ||              if ($dir eq "-" && $beg + $len == $prevBeg) {
472                  ($dir eq "+" && $beg == $prevBeg + $prevLen)) {                  # Here we're merging two backward blocks, so we keep the new begin point
473                  # Here we need to merge two segments. Adjust the beginning and length values                  # and adjust the length.
474                  # to include both segments.                  $len += $prevLen;
475                    # Pop the old segment off. The new one will replace it later.
476                    pop @retVal;
477                } elsif ($dir eq "+" && $beg == $prevBeg + $prevLen) {
478                    # Here we need to merge two forward blocks. Adjust the beginning and
479                    # length values to include both segments.
480                  $beg = $prevBeg;                  $beg = $prevBeg;
481                  $len += $prevLen;                  $len += $prevLen;
482                  # Pop the old segment off. The new one will replace it later.                  # Pop the old segment off. The new one will replace it later.
# Line 659  Line 522 
522      shift if UNIVERSAL::isa($_[0],__PACKAGE__);      shift if UNIVERSAL::isa($_[0],__PACKAGE__);
523      my ($location) = @_;      my ($location) = @_;
524      # Parse it into segments.      # Parse it into segments.
525      $location =~ /^(.*)_(\d*)([+-_])(\d*)$/;      $location =~ /^(.+)_(\d+)([+\-_])(\d+)$/;
526      my ($contigID, $start, $dir, $len) = ($1, $2, $3, $4);      my ($contigID, $start, $dir, $len) = ($1, $2, $3, $4);
527      # If the direction is an underscore, convert it to a + or -.      # If the direction is an underscore, convert it to a + or -.
528      if ($dir eq "_") {      if ($dir eq "_") {
# Line 735  Line 598 
598  should be of the form returned by L</featureLocation> when in a list context. In other words,  should be of the form returned by L</featureLocation> when in a list context. In other words,
599  each location is of the form I<contigID>C<_>I<begin>I<dir>I<end>.  each location is of the form I<contigID>C<_>I<begin>I<dir>I<end>.
600    
601    For example, the following would return the DNA sequence for contig C<83333.1:NC_000913>
602    between positions 1401 and 1532, inclusive.
603    
604        my $sequence = $sprout->DNASeq('83333.1:NC_000913_1401_1532');
605    
606  =over 4  =over 4
607    
608  =item locationList  =item locationList
609    
610  List of location specifiers, each in the form I<contigID>C<_>I<begin>I<dir>I<end> (see  List of location specifiers, each in the form I<contigID>C<_>I<begin>I<dir>I<len> or
611  L</FeatureLocation> for more about this format).  I<contigID>C<_>I<begin>C<_>I<end> (see L</FeatureLocation> for more about this format).
612    
613  =item RETURN  =item RETURN
614    
# Line 790  Line 658 
658              Trace("Sequence is from $startPosition to $stopPosition.") if T(SDNA => 4);              Trace("Sequence is from $startPosition to $stopPosition.") if T(SDNA => 4);
659              # Figure out the start point and length of the relevant section.              # Figure out the start point and length of the relevant section.
660              my $pos1 = ($start < $startPosition ? 0 : $start - $startPosition);              my $pos1 = ($start < $startPosition ? 0 : $start - $startPosition);
661              my $len1 = ($stopPosition <= $stop ? $stopPosition : $stop) - $startPosition - $pos1;              my $len1 = ($stopPosition < $stop ? $stopPosition : $stop) + 1 - $startPosition - $pos1;
662              Trace("Position is $pos1 for length $len1.") if T(SDNA => 4);              Trace("Position is $pos1 for length $len1.") if T(SDNA => 4);
663              # Add the relevant data to the location data.              # Add the relevant data to the location data.
664              $locationDNA .= substr($sequenceData, $pos1, $len1);              $locationDNA .= substr($sequenceData, $pos1, $len1);
# Line 869  Line 737 
737      # Set it from the sequence data, if any.      # Set it from the sequence data, if any.
738      if ($sequence) {      if ($sequence) {
739          my ($start, $len) = $sequence->Values(['IsMadeUpOf(start-position)', 'IsMadeUpOf(len)']);          my ($start, $len) = $sequence->Values(['IsMadeUpOf(start-position)', 'IsMadeUpOf(len)']);
740          $retVal = $start + $len;          $retVal = $start + $len - 1;
741        }
742        # Return the result.
743        return $retVal;
744    }
745    
746    =head3 ClusterPEGs
747    
748    C<< my $clusteredList = $sprout->ClusterPEGs($sub, \@pegs); >>
749    
750    Cluster the PEGs in a list according to the cluster coding scheme of the specified
751    subsystem. In order for this to work properly, the subsystem object must have
752    been used recently to retrieve the PEGs using the B<get_pegs_from_cell> method.
753    This causes the cluster numbers to be pulled into the subsystem's color hash.
754    If a PEG is not found in the color hash, it will not appear in the output
755    sequence.
756    
757    =over 4
758    
759    =item sub
760    
761    Sprout subsystem object for the relevant subsystem, from the L</get_subsystem>
762    method.
763    
764    =item pegs
765    
766    Reference to the list of PEGs to be clustered.
767    
768    =item RETURN
769    
770    Returns a list of the PEGs, grouped into smaller lists by cluster number.
771    
772    =back
773    
774    =cut
775    #: Return Type $@@;
776    sub ClusterPEGs {
777        # Get the parameters.
778        my ($self, $sub, $pegs) = @_;
779        # Declare the return variable.
780        my $retVal = [];
781        # Loop through the PEGs, creating arrays for each cluster.
782        for my $pegID (@{$pegs}) {
783            my $clusterNumber = $sub->get_cluster_number($pegID);
784            # Only proceed if the PEG is in a cluster.
785            if ($clusterNumber >= 0) {
786                # Push this PEG onto the sub-list for the specified cluster number.
787                push @{$retVal->[$clusterNumber]}, $pegID;
788            }
789      }      }
790      # Return the result.      # Return the result.
791      return $retVal;      return $retVal;
# Line 1019  Line 935 
935    
936  =head3 FeatureAnnotations  =head3 FeatureAnnotations
937    
938  C<< my @descriptors = $sprout->FeatureAnnotations($featureID); >>  C<< my @descriptors = $sprout->FeatureAnnotations($featureID, $rawFlag); >>
939    
940  Return the annotations of a feature.  Return the annotations of a feature.
941    
# Line 1029  Line 945 
945    
946  ID of the feature whose annotations are desired.  ID of the feature whose annotations are desired.
947    
948    =item rawFlag
949    
950    If TRUE, the annotation timestamps will be returned in raw form; otherwise, they
951    will be returned in human-readable form.
952    
953  =item RETURN  =item RETURN
954    
955  Returns a list of annotation descriptors. Each descriptor is a hash with the following fields.  Returns a list of annotation descriptors. Each descriptor is a hash with the following fields.
956    
957  * B<featureID> ID of the relevant feature.  * B<featureID> ID of the relevant feature.
958    
959  * B<timeStamp> time the annotation was made, in user-friendly format.  * B<timeStamp> time the annotation was made.
960    
961  * B<user> ID of the user who made the annotation  * B<user> ID of the user who made the annotation
962    
# Line 1047  Line 968 
968  #: Return Type @%;  #: Return Type @%;
969  sub FeatureAnnotations {  sub FeatureAnnotations {
970      # Get the parameters.      # Get the parameters.
971      my ($self, $featureID) = @_;      my ($self, $featureID, $rawFlag) = @_;
972      # Create a query to get the feature's annotations and the associated users.      # Create a query to get the feature's annotations and the associated users.
973      my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],      my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
974                             "IsTargetOfAnnotation(from-link) = ?", [$featureID]);                             "IsTargetOfAnnotation(from-link) = ?", [$featureID]);
# Line 1060  Line 981 
981              $annotation->Values(['IsTargetOfAnnotation(from-link)',              $annotation->Values(['IsTargetOfAnnotation(from-link)',
982                                   'Annotation(time)', 'MadeAnnotation(from-link)',                                   'Annotation(time)', 'MadeAnnotation(from-link)',
983                                   'Annotation(annotation)']);                                   'Annotation(annotation)']);
984            # Convert the time, if necessary.
985            if (! $rawFlag) {
986                $timeStamp = FriendlyTimestamp($timeStamp);
987            }
988          # Assemble them into a hash.          # Assemble them into a hash.
989          my $annotationHash = { featureID => $featureID,          my $annotationHash = { featureID => $featureID,
990                                 timeStamp => FriendlyTimestamp($timeStamp),                                 timeStamp => $timeStamp,
991                                 user => $user, text => $text };                                 user => $user, text => $text };
992          # Add it to the return list.          # Add it to the return list.
993          push @retVal, $annotationHash;          push @retVal, $annotationHash;
# Line 1091  Line 1016 
1016    
1017  =item RETURN  =item RETURN
1018    
1019  Returns a hash mapping the functional assignment IDs to user IDs.  Returns a hash mapping the user IDs to functional assignment IDs.
1020    
1021  =back  =back
1022    
# Line 1101  Line 1026 
1026      # Get the parameters.      # Get the parameters.
1027      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
1028      # Get all of the feature's annotations.      # Get all of the feature's annotations.
1029      my @query = $self->GetAll(['IsTargetOfAnnotation', 'Annotation'],      my @query = $self->GetAll(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
1030                              "IsTargetOfAnnotation(from-link) = ?",                              "IsTargetOfAnnotation(from-link) = ?",
1031                              [$featureID], ['Annotation(time)', 'Annotation(annotation)']);                              [$featureID], ['Annotation(time)', 'Annotation(annotation)',
1032                                               'MadeAnnotation(from-link)']);
1033      # Declare the return hash.      # Declare the return hash.
1034      my %retVal;      my %retVal;
     # Declare a hash for insuring we only make one assignment per user.  
     my %timeHash = ();  
1035      # Now we sort the assignments by timestamp in reverse.      # Now we sort the assignments by timestamp in reverse.
1036      my @sortedQuery = sort { -($a->[0] <=> $b->[0]) } @query;      my @sortedQuery = sort { -($a->[0] <=> $b->[0]) } @query;
1037      # Loop until we run out of annotations.      # Loop until we run out of annotations.
1038      for my $annotation (@sortedQuery) {      for my $annotation (@sortedQuery) {
1039          # Get the annotation fields.          # Get the annotation fields.
1040          my ($timeStamp, $text) = @{$annotation};          my ($timeStamp, $text, $user) = @{$annotation};
1041          # Check to see if this is a functional assignment.          # Check to see if this is a functional assignment.
1042          my ($user, $function) = _ParseAssignment($text);          my ($actualUser, $function) = _ParseAssignment($user, $text);
1043          if ($user && ! exists $timeHash{$user}) {          if ($actualUser && ! exists $retVal{$actualUser}) {
1044              # Here it is a functional assignment and there has been no              # Here it is a functional assignment and there has been no
1045              # previous assignment for this user, so we stuff it in the              # previous assignment for this user, so we stuff it in the
1046              # return hash.              # return hash.
1047              $retVal{$function} = $user;              $retVal{$actualUser} = $function;
             # Insure we don't assign to this user again.  
             $timeHash{$user} = 1;  
1048          }          }
1049      }      }
1050      # Return the hash of assignments found.      # Return the hash of assignments found.
# Line 1138  Line 1060 
1060  The functional assignment is handled differently depending on the type of feature. If  The functional assignment is handled differently depending on the type of feature. If
1061  the feature is identified by a FIG ID (begins with the string C<fig|>), then a functional  the feature is identified by a FIG ID (begins with the string C<fig|>), then a functional
1062  assignment is a type of annotation. The format of an assignment is described in  assignment is a type of annotation. The format of an assignment is described in
1063  L</ParseLocation>. Its worth noting that we cannot filter on the content of the  L</ParseAssignment>. Its worth noting that we cannot filter on the content of the
1064  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
1065  most features only have a small number of annotations.  most features only have a small number of annotations.
1066    
# Line 1200  Line 1122 
1122              }              }
1123          }          }
1124          # 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.
1125          my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation'],          my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
1126                                 "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",                                 "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",
1127                                 [$featureID]);                                 [$featureID]);
1128          my $timeSelected = 0;          my $timeSelected = 0;
1129          # Loop until we run out of annotations.          # Loop until we run out of annotations.
1130          while (my $annotation = $query->Fetch()) {          while (my $annotation = $query->Fetch()) {
1131              # Get the annotation text.              # Get the annotation text.
1132              my ($text, $time) = $annotation->Values(['Annotation(annotation)','Annotation(time)']);              my ($text, $time, $user) = $annotation->Values(['Annotation(annotation)',
1133                                                         'Annotation(time)', 'MadeAnnotation(from-link)']);
1134              # Check to see if this is a functional assignment for a trusted user.              # Check to see if this is a functional assignment for a trusted user.
1135              my ($user, $function) = _ParseAssignment($text);              my ($actualUser, $function) = _ParseAssignment($user, $text);
1136              if ($user) {              Trace("Assignment user is $actualUser, text is $function.") if T(4);
1137                if ($actualUser) {
1138                  # Here it is a functional assignment. Check the time and the user                  # Here it is a functional assignment. Check the time and the user
1139                  # name. The time must be recent and the user must be trusted.                  # name. The time must be recent and the user must be trusted.
1140                  if ((exists $trusteeTable{$user}) && ($time > $timeSelected)) {                  if ((exists $trusteeTable{$actualUser}) && ($time > $timeSelected)) {
1141                      $retVal = $function;                      $retVal = $function;
1142                      $timeSelected = $time;                      $timeSelected = $time;
1143                  }                  }
# Line 1229  Line 1153 
1153      return $retVal;      return $retVal;
1154  }  }
1155    
1156    =head3 FunctionsOf
1157    
1158    C<< my @functionList = $sprout->FunctionOf($featureID, $userID); >>
1159    
1160    Return the functional assignments of a particular feature.
1161    
1162    The functional assignment is handled differently depending on the type of feature. If
1163    the feature is identified by a FIG ID (begins with the string C<fig|>), then a functional
1164    assignment is a type of annotation. The format of an assignment is described in
1165    L</ParseAssignment>. Its worth noting that we cannot filter on the content of the
1166    annotation itself because it's a text field; however, this is not a big problem because
1167    most features only have a small number of annotations.
1168    
1169    If the feature is B<not> identified by a FIG ID, then the functional assignment
1170    information is taken from the B<ExternalAliasFunc> table. If the table does
1171    not contain an entry for the feature, an empty list is returned.
1172    
1173    =over 4
1174    
1175    =item featureID
1176    
1177    ID of the feature whose functional assignments are desired.
1178    
1179    =item RETURN
1180    
1181    Returns a list of 2-tuples, each consisting of a user ID and the text of an assignment by
1182    that user.
1183    
1184    =back
1185    
1186    =cut
1187    #: Return Type @@;
1188    sub FunctionsOf {
1189        # Get the parameters.
1190        my ($self, $featureID) = @_;
1191        # Declare the return value.
1192        my @retVal = ();
1193        # Determine the ID type.
1194        if ($featureID =~ m/^fig\|/) {
1195            # Here we have a FIG feature ID. We must build the list of trusted
1196            # users.
1197            my %trusteeTable = ();
1198            # Build a query for all of the feature's annotations, sorted by date.
1199            my $query = $self->Get(['IsTargetOfAnnotation', 'Annotation', 'MadeAnnotation'],
1200                                   "IsTargetOfAnnotation(from-link) = ? ORDER BY Annotation(time) DESC",
1201                                   [$featureID]);
1202            my $timeSelected = 0;
1203            # Loop until we run out of annotations.
1204            while (my $annotation = $query->Fetch()) {
1205                # Get the annotation text.
1206                my ($text, $time, $user) = $annotation->Values(['Annotation(annotation)',
1207                                                                'Annotation(time)',
1208                                                                'MadeAnnotation(user)']);
1209                # Check to see if this is a functional assignment for a trusted user.
1210                my ($actualUser, $function) = _ParseAssignment($user, $text);
1211                if ($actualUser) {
1212                    # Here it is a functional assignment.
1213                    push @retVal, [$actualUser, $function];
1214                }
1215            }
1216        } else {
1217            # Here we have a non-FIG feature ID. In this case the user ID does not
1218            # matter. We simply get the information from the External Alias Function
1219            # table.
1220            my @assignments = $self->GetEntityValues('ExternalAliasFunc', $featureID,
1221                                                     ['ExternalAliasFunc(func)']);
1222            push @retVal, map { ['master', $_] } @assignments;
1223        }
1224        # Return the assignments found.
1225        return @retVal;
1226    }
1227    
1228  =head3 BBHList  =head3 BBHList
1229    
1230  C<< my $bbhHash = $sprout->BBHList($genomeID, \@featureList); >>  C<< my $bbhHash = $sprout->BBHList($genomeID, \@featureList); >>
# Line 1266  Line 1262 
1262          my $query = $self->Get(['IsBidirectionalBestHitOf'],          my $query = $self->Get(['IsBidirectionalBestHitOf'],
1263                                 "IsBidirectionalBestHitOf(from-link) = ? AND IsBidirectionalBestHitOf(genome) = ?",                                 "IsBidirectionalBestHitOf(from-link) = ? AND IsBidirectionalBestHitOf(genome) = ?",
1264                                 [$featureID, $genomeID]);                                 [$featureID, $genomeID]);
1265          # Look for the best hit.          # Peel off the BBHs found.
1266          my $bbh = $query->Fetch;          my @found = ();
1267          if ($bbh) {          while (my $bbh = $query->Fetch) {
1268              my ($targetFeature) = $bbh->Value('IsBidirectionalBestHitOf(to-link)');              push @found, $bbh->Value('IsBidirectionalBestHitOf(to-link)');
             $retVal{$featureID} = $targetFeature;  
1269          }          }
1270            $retVal{$featureID} = \@found;
1271      }      }
1272      # Return the mapping.      # Return the mapping.
1273      return \%retVal;      return \%retVal;
# Line 1349  Line 1345 
1345      my $genomeData = $self->GetEntity('Genome', $genomeID);      my $genomeData = $self->GetEntity('Genome', $genomeID);
1346      if ($genomeData) {      if ($genomeData) {
1347          # The genome exists, so get the completeness flag.          # The genome exists, so get the completeness flag.
1348          ($retVal) = $genomeData->Value('complete');          ($retVal) = $genomeData->Value('Genome(complete)');
1349      }      }
1350      # Return the result.      # Return the result.
1351      return $retVal;      return $retVal;
# Line 1389  Line 1385 
1385    
1386  C<< my $genomeID = $sprout->GenomeOf($featureID); >>  C<< my $genomeID = $sprout->GenomeOf($featureID); >>
1387    
1388  Return the genome that contains a specified feature.  Return the genome that contains a specified feature or contig.
1389    
1390  =over 4  =over 4
1391    
1392  =item featureID  =item featureID
1393    
1394  ID of the feature whose genome is desired.  ID of the feature or contig whose genome is desired.
1395    
1396  =item RETURN  =item RETURN
1397    
1398  Returns the ID of the genome for the specified feature. If the feature is not found, returns  Returns the ID of the genome for the specified feature or contig. If the feature or contig is not
1399  an undefined value.  found, returns an undefined value.
1400    
1401  =back  =back
1402    
# Line 1409  Line 1405 
1405  sub GenomeOf {  sub GenomeOf {
1406      # Get the parameters.      # Get the parameters.
1407      my ($self, $featureID) = @_;      my ($self, $featureID) = @_;
1408      # Create a query to find the genome associated with the feature.      # Create a query to find the genome associated with the incoming ID.
1409      my $query = $self->Get(['IsLocatedIn', 'HasContig'], "IsLocatedIn(from-link) = ?", [$featureID]);      my $query = $self->Get(['IsLocatedIn', 'HasContig'], "IsLocatedIn(from-link) = ? OR HasContig(to-link) = ?",
1410                               [$featureID, $featureID]);
1411      # Declare the return value.      # Declare the return value.
1412      my $retVal;      my $retVal;
1413      # Get the genome ID.      # Get the genome ID.
# Line 1652  Line 1649 
1649      return join " ", sort @_;      return join " ", sort @_;
1650  }  }
1651    
 =head3 GetEntityTypes  
   
 C<< my @entityList = $sprout->GetEntityTypes(); >>  
   
 Return the list of supported entity types.  
   
 =cut  
 #: Return Type @;  
 sub GetEntityTypes {  
     # Get the parameters.  
     my ($self) = @_;  
     # Get the underlying database object.  
     my $erdb = $self->{_erdb};  
     # Get its entity type list.  
     my @retVal = $erdb->GetEntityTypes();  
 }  
   
1652  =head3 ReadFasta  =head3 ReadFasta
1653    
1654  C<< my %sequenceData = Sprout::ReadFasta($fileName, $prefix); >>  C<< my %sequenceData = Sprout::ReadFasta($fileName, $prefix); >>
# Line 1814  Line 1794 
1794      # Get the data directory name.      # Get the data directory name.
1795      my $outputDirectory = $self->{_options}->{dataDir};      my $outputDirectory = $self->{_options}->{dataDir};
1796      # Dump the relations.      # Dump the relations.
1797      $self->{_erdb}->DumpRelations($outputDirectory);      $self->DumpRelations($outputDirectory);
1798  }  }
1799    
1800  =head3 XMLFileName  =head3 XMLFileName
# Line 1866  Line 1846 
1846      # Get the parameters.      # Get the parameters.
1847      my ($self, $objectType, $fieldHash) = @_;      my ($self, $objectType, $fieldHash) = @_;
1848      # Call the underlying method.      # Call the underlying method.
1849      $self->{_erdb}->InsertObject($objectType, $fieldHash);      $self->InsertObject($objectType, $fieldHash);
1850  }  }
1851    
1852  =head3 Annotate  =head3 Annotate
# Line 2547  Line 2527 
2527                                      ['HasSSCell(from-link)', 'IsRoleOf(from-link)']);                                      ['HasSSCell(from-link)', 'IsRoleOf(from-link)']);
2528      # Create the return value.      # Create the return value.
2529      my %retVal = ();      my %retVal = ();
2530        # Build a hash to weed out duplicates. Sometimes the same PEG and role appears
2531        # in two spreadsheet cells.
2532        my %dupHash = ();
2533      # Loop through the results, adding them to the hash.      # Loop through the results, adding them to the hash.
2534      for my $record (@subsystems) {      for my $record (@subsystems) {
2535            # Get this subsystem and role.
2536          my ($subsys, $role) = @{$record};          my ($subsys, $role) = @{$record};
2537          if (exists $retVal{$subsys}) {          # Insure it's the first time for both.
2538            my $dupKey = "$subsys\n$role";
2539            if (! exists $dupHash{"$subsys\n$role"}) {
2540                $dupHash{$dupKey} = 1;
2541              push @{$retVal{$subsys}}, $role;              push @{$retVal{$subsys}}, $role;
         } else {  
             $retVal{$subsys} = [$role];  
2542          }          }
2543      }      }
2544      # Return the hash.      # Return the hash.
# Line 2592  Line 2577 
2577      return @retVal;      return @retVal;
2578  }  }
2579    
2580    
2581    
2582  =head3 RelatedFeatures  =head3 RelatedFeatures
2583    
2584  C<< my @relatedList = $sprout->RelatedFeatures($featureID, $function, $userID); >>  C<< my @relatedList = $sprout->RelatedFeatures($featureID, $function, $userID); >>
# Line 2693  Line 2680 
2680      return @retVal;      return @retVal;
2681  }  }
2682    
 =head3 GetAll  
   
 C<< my @list = $sprout->GetAll(\@objectNames, $filterClause, \@parameters, \@fields, $count); >>  
   
 Return a list of values taken from the objects returned by a query. The first three  
 parameters correspond to the parameters of the L</Get> method. The final parameter is  
 a list of the fields desired from each record found by the query. The field name  
 syntax is the standard syntax used for fields in the B<ERDB> system--  
 B<I<objectName>(I<fieldName>)>-- where I<objectName> is the name of the relevant entity  
 or relationship and I<fieldName> is the name of the field.  
   
 The list returned will be a list of lists. Each element of the list will contain  
 the values returned for the fields specified in the fourth parameter. If one of the  
 fields specified returns multiple values, they are flattened in with the rest. For  
 example, the following call will return a list of the features in a particular  
 spreadsheet cell, and each feature will be represented by a list containing the  
 feature ID followed by all of its aliases.  
   
 C<< $query = $sprout->Get(['ContainsFeature', 'Feature'], "ContainsFeature(from-link) = ?", [$ssCellID], ['Feature(id)', 'Feature(alias)']); >>  
   
 =over 4  
   
 =item objectNames  
   
 List containing the names of the entity and relationship objects to be retrieved.  
   
 =item filterClause  
   
 WHERE/ORDER BY clause (without the WHERE) to be used to filter and sort the query. The WHERE clause can  
 be parameterized with parameter markers (C<?>). Each field used must be specified in the standard form  
 B<I<objectName>(I<fieldName>)>. Any parameters specified in the filter clause should be added to the  
 parameter list as additional parameters. The fields in a filter clause can come from primary  
 entity relations, relationship relations, or secondary entity relations; however, all of the  
 entities and relationships involved must be included in the list of object names.  
   
 =item parameterList  
   
 List of the parameters to be substituted in for the parameters marks in the filter clause.  
   
 =item fields  
   
 List of the fields to be returned in each element of the list returned.  
   
 =item count  
   
 Maximum number of records to return. If omitted or 0, all available records will be returned.  
   
 =item RETURN  
   
 Returns a list of list references. Each element of the return list contains the values for the  
 fields specified in the B<fields> parameter.  
   
 =back  
   
 =cut  
 #: Return Type @@;  
 sub GetAll {  
     # Get the parameters.  
     my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;  
     # Call the ERDB method.  
     my @retVal = $self->{_erdb}->GetAll($objectNames, $filterClause, $parameterList,  
                                         $fields, $count);  
     # Return the resulting list.  
     return @retVal;  
 }  
   
 =head3 GetFlat  
   
 C<< my @list = $sprout->GetFlat(\@objectNames, $filterClause, $parameterList, $field); >>  
   
 This is a variation of L</GetAll> that asks for only a single field per record and  
 returns a single flattened list.  
   
 =over 4  
   
 =item objectNames  
   
 List containing the names of the entity and relationship objects to be retrieved.  
   
 =item filterClause  
   
 WHERE/ORDER BY clause (without the WHERE) to be used to filter and sort the query. The WHERE clause can  
 be parameterized with parameter markers (C<?>). Each field used must be specified in the standard form  
 B<I<objectName>(I<fieldName>)>. Any parameters specified in the filter clause should be added to the  
 parameter list as additional parameters. The fields in a filter clause can come from primary  
 entity relations, relationship relations, or secondary entity relations; however, all of the  
 entities and relationships involved must be included in the list of object names.  
   
 =item parameterList  
   
 List of the parameters to be substituted in for the parameters marks in the filter clause.  
   
 =item field  
   
 Name of the field to be used to get the elements of the list returned.  
   
 =item RETURN  
   
 Returns a list of values.  
   
 =back  
   
 =cut  
 #: Return Type @;  
 sub GetFlat {  
     # Get the parameters.  
     my ($self, $objectNames, $filterClause, $parameterList, $field) = @_;  
     # Construct the query.  
     my $query = $self->Get($objectNames, $filterClause, $parameterList);  
     # Create the result list.  
     my @retVal = ();  
     # Loop through the records, adding the field values found to the result list.  
     while (my $row = $query->Fetch()) {  
         push @retVal, $row->Value($field);  
     }  
     # Return the list created.  
     return @retVal;  
 }  
   
2683  =head3 Protein  =head3 Protein
2684    
2685  C<< my $protein = Sprout::Protein($sequence, $table); >>  C<< my $protein = Sprout::Protein($sequence, $table); >>
# Line 2913  Line 2781 
2781      # Create the return list, priming it with the name of the data directory.      # Create the return list, priming it with the name of the data directory.
2782      my @retVal = ($self->{_options}->{dataDir});      my @retVal = ($self->{_options}->{dataDir});
2783      # Concatenate the table names.      # Concatenate the table names.
2784      push @retVal, $self->{_erdb}->GetTableNames();      push @retVal, $self->GetTableNames();
2785      # Return the result.      # Return the result.
2786      return @retVal;      return @retVal;
2787  }  }
2788    
2789  =head3 LowBBHs  =head3 LowBBHs
2790    
2791  C<< my %bbhMap = $sprout->GoodBBHs($featureID, $cutoff); >>  C<< my %bbhMap = $sprout->LowBBHs($featureID, $cutoff); >>
2792    
2793  Return the bidirectional best hits of a feature whose score is no greater than a  Return the bidirectional best hits of a feature whose score is no greater than a
2794  specified cutoff value. A higher cutoff value will allow inclusion of hits with  specified cutoff value. A higher cutoff value will allow inclusion of hits with
# Line 3083  Line 2951 
2951      return $retVal;      return $retVal;
2952  }  }
2953    
2954    =head3 DeleteGenome
2955    
2956    C<< my $stats = $sprout->DeleteGenome($genomeID, $testFlag); >>
2957    
2958    Delete a genome from the database.
2959    
2960    =over 4
2961    
2962    =item genomeID
2963    
2964    ID of the genome to delete
2965    
2966    =item testFlag
2967    
2968    If TRUE, then the DELETE statements will be traced, but no deletions will occur.
2969    
2970    =item RETURN
2971    
2972    Returns a statistics object describing the rows deleted.
2973    
2974    =back
2975    
2976    =cut
2977    #: Return Type $%;
2978    sub DeleteGenome {
2979        # Get the parameters.
2980        my ($self, $genomeID, $testFlag) = @_;
2981        # Perform the delete for the genome's features.
2982        my $retVal = $self->Delete('Feature', "fig|$genomeID.%", $testFlag);
2983        # Perform the delete for the primary genome data.
2984        my $stats = $self->Delete('Genome', $genomeID, $testFlag);
2985        $retVal->Accumulate($stats);
2986        # Return the result.
2987        return $retVal;
2988    }
2989    
2990  =head2 Internal Utility Methods  =head2 Internal Utility Methods
2991    
2992  =head3 ParseAssignment  =head3 ParseAssignment
# Line 3093  Line 2997 
2997    
2998  A functional assignment is always of the form  A functional assignment is always of the form
2999    
3000      I<XXXX>C<\nset >I<YYYY>C< function to\n>I<ZZZZZ>      C<set >I<YYYY>C< function to\n>I<ZZZZZ>
3001    
3002    where I<YYYY> is the B<user>, and I<ZZZZ> is the actual functional role. In most cases,
3003    the user and the assigning user (from MadeAnnotation) will be the same, but that is
3004    not always the case.
3005    
3006  where I<XXXX> is the B<assigning user>, I<YYYY> is the B<user>, and I<ZZZZ> is the  In addition, the functional role may contain extra data that is stripped, such as
3007  actual functional role. In most cases, the user and the assigning user will be the  terminating spaces or a comment separated from the rest of the text by a tab.
 same, but that is not always the case.  
3008    
3009  This is a static method.  This is a static method.
3010    
3011  =over 4  =over 4
3012    
3013    =item user
3014    
3015    Name of the assigning user.
3016    
3017  =item text  =item text
3018    
3019  Text of the annotation.  Text of the annotation.
# Line 3118  Line 3029 
3029    
3030  sub _ParseAssignment {  sub _ParseAssignment {
3031      # Get the parameters.      # Get the parameters.
3032      my ($text) = @_;      my ($user, $text) = @_;
3033      # Declare the return value.      # Declare the return value.
3034      my @retVal = ();      my @retVal = ();
3035      # Check to see if this is a functional assignment.      # Check to see if this is a functional assignment.
3036      my ($user, $type, $function) = split(/\n/, $text);      my ($type, $function) = split(/\n/, $text);
3037      if ($type =~ m/^set ([^ ]+) function to$/i) {      if ($type =~ m/^set function to$/i) {
3038          # Here it is, so we return the user name (which is in $1), the functional role text,          # Here we have an assignment without a user, so we use the incoming user ID.
3039          # and the assigning user.          @retVal = ($user, $function);
3040          @retVal = ($1, $function, $user);      } elsif ($type =~ m/^set (\S+) function to$/i) {
3041            # Here we have an assignment with a user that is passed back to the caller.
3042            @retVal = ($1, $function);
3043        }
3044        # If we have an assignment, we need to clean the function text. There may be
3045        # extra junk at the end added as a note from the user.
3046        if (@retVal) {
3047            $retVal[1] =~ s/(\t\S)?\s*$//;
3048      }      }
3049      # Return the result list.      # Return the result list.
3050      return @retVal;      return @retVal;
# Line 3154  Line 3072 
3072    
3073  sub FriendlyTimestamp {  sub FriendlyTimestamp {
3074      my ($timeValue) = @_;      my ($timeValue) = @_;
3075      my $retVal = strftime("%a %b %e %H:%M:%S %Y", localtime($timeValue));      my $retVal = localtime($timeValue);
3076      return $retVal;      return $retVal;
3077  }  }
3078    
# Line 3216  Line 3134 
3134  }  }
3135    
3136    
   
3137  1;  1;

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.58

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3