next up previous contents
Next: Indexing a Darwin Sequence Up: Accessing a Darwin Sequence Previous: The String Function

The SearchDb Function

It is easy to search for all entries in a sequence database that contain a specific pattern. The function
SearchDb( $pat_{1}, pat_{2}, \ldots, pat_{k}$ : { string, set(string) })
accepts a sequence of patterns where each pattern is either a string or a set of string objects. When multiple parameters are contained in a set, the SearchDb returns the logical OR of the results, that is, it returns all Entry that contain any one of the patterns contained in the set. The comma symbol represents the logical AND of the arguments. In this case, SearchDb returns only those Entry that contain all such patterns. SearchDb searches the database currently assigned to the system variable DB.

> DB := ReadDb('Sample/SH2'):   # load the SH2 database 
                                #   & assign it to DB
> SearchDb('mouse');            # returns all Entry() which contain 
                                #   the pattern 'mouse'.


> SearchDb('SH3');


> SearchDb('mouse', 'SH3');       # return all Entry() which contain 
                                  #  both 'mouse' and 'SH3'. 


> SearchDb({'mouse', 'human'});   # return all Entry() which contain
>                                 # human or mouse


> SearchDb('SH3', {'mouse', 'human'}); # return all Entry() containing
>                                      # (SH3 and (mouse or human))
The SearchDb function is case insensitive, thus searching for pattern 'mouse' is equivalent to searching for 'MOUSE'. Any pattern is allowed as a parameter to the SearchDb function. We can even search for peptide sequences.
> SearchDb('NGGYYI');             # a segment of the SH2 domain
Note, however, that this is an exact match - in computer science terms - a common substring search.

Gaston Gonnet