Package Bio :: Package NeuralNetwork :: Package Gene :: Module Schema :: Class Schema
[hide private]
[frames] | no frames]

Class Schema

source code

object --+
         |
        Schema

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.

Instance Methods [hide private]
 
__init__(self, ambiguity_info)
Initialize with ambiguity information.
source code
 
encode_motif(self, motif)
Encode the passed motif as a regular expression pattern object.
source code
 
find_ambiguous(self, motif)
Return the location of ambiguous items in the motif.
source code
 
num_ambiguous(self, motif)
Return the number of ambiguous letters in a given motif.
source code
 
find_matches(self, motif, query)
Return all non-overlapping motif matches in the query string.
source code
 
num_matches(self, motif, query)
Find the number of non-overlapping times motif occurs in query.
source code
 
all_unambiguous(self)
Return a listing of all unambiguous letters allowed in motifs.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ambiguity_info)
(Constructor)

source code 

Initialize with ambiguity information.

Arguments:

o ambiguity_info - A dictionary which maps letters in the motifs to the ambiguous characters which they might represent. For example, {'R' : 'AG'} specifies that Rs in the motif can match an A or a G. All letters in the motif must be represented in the ambiguity_info dictionary.

Overrides: object.__init__

encode_motif(self, motif)

source code 

Encode the passed motif as a regular expression pattern object.

Arguments:

o motif - The motif we want to encode. This should be a string.

Returns: A compiled regular expression pattern object that can be used for searching strings.

find_ambiguous(self, motif)

source code 

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.

find_matches(self, motif, query)

source code 

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.