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

def Bio::NeuralNetwork::Gene::Schema::SchemaFactory::_schema_from_motif (   self,
  motif,
  motif_list,
  num_ambiguous 
) [private]

Create a schema from a given starting motif.

Arguments:

o motif - A motif with the pattern we will start from.

o motif_list - The total motifs we have.to match to.

o num_ambiguous - The number of ambiguous characters that should
be present in the schema.

Returns:

o A string representing the newly generated schema.

o A list of all of the motifs in motif_list that match the schema.

Definition at line 675 of file Schema.py.

00675                                                                   :
        """Create a schema from a given starting motif.

        Arguments:

        o motif - A motif with the pattern we will start from.

        o motif_list - The total motifs we have.to match to.

        o num_ambiguous - The number of ambiguous characters that should
        be present in the schema.

        Returns:

        o A string representing the newly generated schema.

        o A list of all of the motifs in motif_list that match the schema.
        """
        assert motif in motif_list, \
               "Expected starting motif present in remaining motifs."

        # convert random positions in the motif to ambiguous characters
        # convert the motif into a list of characters so we can manipulate it
        new_schema_list = list(motif)
        for add_ambiguous in range(num_ambiguous):
            # add an ambiguous position in a new place in the motif
            while 1:
                ambig_pos = random.choice(range(len(new_schema_list)))

                # only add a position if it isn't already ambiguous
                # otherwise, we'll try again
                if new_schema_list[ambig_pos] != self._ambiguity_symbol:
                    new_schema_list[ambig_pos] = self._ambiguity_symbol
                    break

        # convert the schema back to a string
        new_schema = string.join(new_schema_list, '')

        # get the motifs that the schema matches
        matched_motifs = []
        for motif in motif_list:
            if matches_schema(motif, new_schema, self._ambiguity_symbol):
                matched_motifs.append(motif)

        return new_schema, matched_motifs
            
    def from_signatures(self, signature_repository, num_ambiguous):


Generated by  Doxygen 1.6.0   Back to index