Logo Search packages:      
Sourcecode: python-biopython version File versions  Download package

def Bio::NeuralNetwork::Gene::Schema::Schema::encode_motif (   self,
  motif 
)

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.

Definition at line 59 of file Schema.py.

00059                                  :
        """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.
        """
        regexp_string = ""

        for motif_letter in motif:
            try:
                letter_matches = self._ambiguity_info[motif_letter]
            except KeyError:
                raise KeyError("No match information for letter %s"
                               % motif_letter)

            if len(letter_matches) > 1:
                regexp_match = "[" + letter_matches + "]"
            elif len(letter_matches) == 1:
                regexp_match = letter_matches
            else:
                raise ValueError("Unexpected match information %s"
                                 % letter_matches)

            regexp_string += regexp_match

        return sre.compile(regexp_string)

    def find_ambiguous(self, motif):


Generated by  Doxygen 1.6.0   Back to index