[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.5, Tue Jan 25 03:02:07 2005 UTC
# Line 1016  Line 1016 
1016  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
1017  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
1018  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
1019  features only have a small number of annotations.  features only have a small number of annotations. Finally, if a single user has multiple
1020    functional assignments, we will only keep the most recent one.
1021    
1022  =over 4  =over 4
1023    
# Line 1037  Line 1038 
1038          my $self = shift @_;          my $self = shift @_;
1039          my ($featureID) = @_;          my ($featureID) = @_;
1040          # Get all of the feature's annotations.          # Get all of the feature's annotations.
1041          my @query = $self->GetFlat(['IsTargetOfAnnotation', 'Annotation'],      my @query = $self->GetAll(['IsTargetOfAnnotation', 'Annotation'],
1042                                                      "IsTargetOfAnnotation(from-link) = ?",                                                      "IsTargetOfAnnotation(from-link) = ?",
1043                                                          [$featureID], 'Annotation(annotation)');                              [$featureID], ['Annotation(time)', 'Annotation(annotation)']);
1044          # Declare the return hash.          # Declare the return hash.
1045          my %retVal;          my %retVal;
1046        # Declare a hash for insuring we only make one assignment per user.
1047        my %timeHash = ();
1048        # Now we sort the assignments by timestamp in reverse.
1049        my @sortedQuery = sort { -($a->[0] <=> $b->[0]) } @query;
1050          # Loop until we run out of annotations.          # Loop until we run out of annotations.
1051          for my $text (@query) {      for my $annotation (@sortedQuery) {
1052            # Get the annotation fields.
1053            my ($timeStamp, $text) = @{$annotation};
1054                  # Check to see if this is a functional assignment.                  # Check to see if this is a functional assignment.
1055                  my ($user, $function) = ParseAssignment($text);                  my ($user, $function) = ParseAssignment($text);
1056                  if ($user) {          if ($user && ! exists $timeHash{$user}) {
1057                          # Here it is, so stuff it in the return hash.              # Here it is a functional assignment and there has been no
1058                # previous assignment for this user, so we stuff it in the
1059                # return hash.
1060                          $retVal{$function} = $user;                          $retVal{$function} = $user;
1061                # Insure we don't assign to this user again.
1062                $timeHash{$user} = 1;
1063                  }                  }
1064          }          }
1065          # Return the hash of assignments found.          # Return the hash of assignments found.

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3