Back to index

python-biopython  1.60
Classes | Functions
Bio.NeuralNetwork.Gene.Schema Namespace Reference

Classes

class  Schema
class  SchemaDNAAlphabet
class  GeneticAlgorithmFinder
class  DifferentialSchemaFitness
class  MostCountSchemaFitness
class  RandomMotifGenerator
class  SimpleFinisher
class  SchemaFinder
class  SchemaCoder
class  SchemaFactory

Functions

def matches_schema

Detailed Description

Deal with Motifs or Signatures allowing ambiguity in the sequences.

This class contains Schema which deal with Motifs and Signatures at
a higher level, by introducing `don't care` (ambiguity) symbols into
the sequences. For instance, you could combine the following Motifs:

'GATC', 'GATG', 'GATG', 'GATT'

as all falling under a schema like 'GAT*', where the star indicates a
character can be anything. This helps us condense a whole ton of
motifs or signatures.

Function Documentation

def Bio.NeuralNetwork.Gene.Schema.matches_schema (   pattern,
  schema,
  ambiguity_character = '*' 
)
Determine whether or not the given pattern matches the schema.

Arguments:

o pattern - A string representing the pattern we want to check for
matching. This pattern can contain ambiguity characters (which are
assumed to be the same as those in the schema).

o schema - A string schema with ambiguity characters.

o ambiguity_character - The character used for ambiguity in the schema.

Definition at line 529 of file Schema.py.

00529 
00530 def matches_schema(pattern, schema, ambiguity_character = '*'):
00531     """Determine whether or not the given pattern matches the schema.
00532 
00533     Arguments:
00534 
00535     o pattern - A string representing the pattern we want to check for
00536     matching. This pattern can contain ambiguity characters (which are
00537     assumed to be the same as those in the schema).
00538 
00539     o schema - A string schema with ambiguity characters.
00540 
00541     o ambiguity_character - The character used for ambiguity in the schema.
00542     """
00543     if len(pattern) != len(schema):
00544         return 0
00545 
00546     # check each position, and return a non match if the schema and pattern
00547     # are non ambiguous and don't match
00548     for pos in range(len(pattern)):
00549         if (schema[pos] != ambiguity_character and
00550             pattern[pos] != ambiguity_character and
00551             pattern[pos] != schema[pos]):
00552             
00553             return 0
00554 
00555     return 1