Deal with motifs that have ambiguity characters in it.
This motif class allows specific ambiguity characters and tries to
speed up finding motifs using regular expressions.
This is likely to be a replacement for the Schema representation,
since it allows multiple ambiguity characters to be used.
Methods
|
|
__init__
all_unambiguous
encode_motif
find_ambiguous
find_matches
num_ambiguous
num_matches
|
|
__init__
|
__init__ ( self, ambiguity_info )
Initialize with ambiguity information.
Arguments:
|
|
all_unambiguous
|
all_unambiguous ( self )
Return a listing of all unambiguous letters allowed in motifs.
|
|
encode_motif
|
encode_motif ( self, motif )
Encode the passed motif as a regular expression pattern object.
Arguments:
Returns:
A compiled regular expression pattern object that can be used
for searching strings.
Exceptions
|
|
KeyError( "No match information for letter %s" % motif_letter )
ValueError( "Unexpected match information %s" % letter_matches )
|
|
|
find_ambiguous
|
find_ambiguous ( self, motif )
Return the location of ambiguous items in the motif.
This just checks through the motif and compares each letter
against the ambiguity information. If a letter stands for multiple
items, it is ambiguous.
Exceptions
|
|
KeyError( "No match information for letter %s" % motif_letter )
|
|
|
find_matches
|
find_matches (
self,
motif,
query,
)
Return all non-overlapping motif matches in the query string.
This utilizes the regular expression findall function, and will
return a list of all non-overlapping occurances in query that
match the ambiguous motif.
|
|
num_ambiguous
|
num_ambiguous ( self, motif )
Return the number of ambiguous letters in a given motif.
|
|
num_matches
|
num_matches (
self,
motif,
query,
)
Find the number of non-overlapping times motif occurs in query.
|
|