[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.4, Tue Jan 25 01:36:09 2005 UTC revision 1.6, Wed Jan 26 17:41:53 2005 UTC
# Line 36  Line 36 
36    
37  #: Constructor SFXlate->new_sprout_only();  #: Constructor SFXlate->new_sprout_only();
38    
   
39  =head2 Public Methods  =head2 Public Methods
40    
41  =head3 new  =head3 new
# Line 1016  Line 1015 
1015  It has the format "XXXX\nset XXXX function to\nYYYYY". In this instance, XXXX is the user ID  It has the format "XXXX\nset XXXX function to\nYYYYY". In this instance, XXXX is the user ID
1016  and YYYYY is the functional assignment text. Its worth noting that we cannot filter on the content  and YYYYY is the functional assignment text. Its worth noting that we cannot filter on the content
1017  of the annotation itself because it's a text field; however, this is not a big problem because most  of the annotation itself because it's a text field; however, this is not a big problem because most
1018  features only have a small number of annotations.  features only have a small number of annotations. Finally, if a single user has multiple
1019    functional assignments, we will only keep the most recent one.
1020    
1021  =over 4  =over 4
1022    
# Line 1037  Line 1037 
1037          my $self = shift @_;          my $self = shift @_;
1038          my ($featureID) = @_;          my ($featureID) = @_;
1039          # Get all of the feature's annotations.          # Get all of the feature's annotations.
1040          my @query = $self->GetFlat(['IsTargetOfAnnotation', 'Annotation'],      my @query = $self->GetAll(['IsTargetOfAnnotation', 'Annotation'],
1041                                                      "IsTargetOfAnnotation(from-link) = ?",                                                      "IsTargetOfAnnotation(from-link) = ?",
1042                                                          [$featureID], 'Annotation(annotation)');                              [$featureID], ['Annotation(time)', 'Annotation(annotation)']);
1043          # Declare the return hash.          # Declare the return hash.
1044          my %retVal;          my %retVal;
1045        # Declare a hash for insuring we only make one assignment per user.
1046        my %timeHash = ();
1047        # Now we sort the assignments by timestamp in reverse.
1048        my @sortedQuery = sort { -($a->[0] <=> $b->[0]) } @query;
1049          # Loop until we run out of annotations.          # Loop until we run out of annotations.
1050          for my $text (@query) {      for my $annotation (@sortedQuery) {
1051            # Get the annotation fields.
1052            my ($timeStamp, $text) = @{$annotation};
1053                  # Check to see if this is a functional assignment.                  # Check to see if this is a functional assignment.
1054                  my ($user, $function) = ParseAssignment($text);                  my ($user, $function) = ParseAssignment($text);
1055                  if ($user) {          if ($user && ! exists $timeHash{$user}) {
1056                          # Here it is, so stuff it in the return hash.              # Here it is a functional assignment and there has been no
1057                # previous assignment for this user, so we stuff it in the
1058                # return hash.
1059                          $retVal{$function} = $user;                          $retVal{$function} = $user;
1060                # Insure we don't assign to this user again.
1061                $timeHash{$user} = 1;
1062                  }                  }
1063          }          }
1064          # Return the hash of assignments found.          # Return the hash of assignments found.

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3