[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.90, Fri Sep 29 15:10:05 2006 UTC revision 1.91, Sat Oct 14 18:12:48 2006 UTC
# Line 3699  Line 3699 
3699      $self->Insert('HasProperty', { 'from-link' => $featureID, 'to-link' => $propID, evidence => $url });      $self->Insert('HasProperty', { 'from-link' => $featureID, 'to-link' => $propID, evidence => $url });
3700  }  }
3701    
3702    =head2 Virtual Methods
3703    
3704    =head3 CleanKeywords
3705    
3706    C<< my $cleanedString = $sprout->CleanKeywords($searchExpression); >>
3707    
3708    Clean up a search expression or keyword list. This involves converting the periods
3709    in EC numbers to underscores, converting non-leading minus signs to underscores,
3710    a vertical bar or colon to an apostrophe, and forcing lower case for all alphabetic
3711    characters. In addition, any extra spaces are removed.
3712    
3713    =over 4
3714    
3715    =item searchExpression
3716    
3717    Search expression or keyword list to clean. Note that a search expression may
3718    contain boolean operators which need to be preserved. This includes leading
3719    minus signs.
3720    
3721    =item RETURN
3722    
3723    Cleaned expression or keyword list.
3724    
3725    =back
3726    
3727    =cut
3728    
3729    sub CleanKeywords {
3730        # Get the parameters.
3731        my ($self, $searchExpression) = @_;
3732        # Perform the standard cleanup.
3733        my $retVal = $self->ERDB::CleanKeywords($searchExpression);
3734        # Fix the periods in EC and TC numbers.
3735        $retVal =~ s/(\d+|\-)\.(\d+|-)\.(\d+|-)\.(\d+|-)/$1_$2_$3_$4/g;
3736        # Fix non-trailing periods.
3737        $retVal =~ s/\.(\w)/_$1/g;
3738        # Fix non-leading minus signs.
3739        $retVal =~ s/(\w)[\-]/$1_/g;
3740        # Fix the vertical bars and colons
3741        $retVal =~ s/(\w)[|:](\w)/$1'$2/g;
3742        # Return the result.
3743        return $retVal;
3744    }
3745    
3746  =head2 Internal Utility Methods  =head2 Internal Utility Methods
3747    
3748  =head3 ParseAssignment  =head3 ParseAssignment

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.91

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3