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

Class PatternRepository

source code

object --+
         |
        PatternRepository

This holds a list of specific patterns found in sequences.

This is designed to be a general holder for a set of patterns and
should be subclassed for specific implementations (ie. holding Motifs
or Signatures.

Instance Methods [hide private]
 
__init__(self, pattern_info)
Initialize a repository with patterns,
source code
 
get_all(self)
Retrieve all of the patterns in the repository.
source code
 
get_random(self, num_patterns)
Retrieve the specified number of patterns randomly.
source code
 
get_top_percentage(self, percent)
Return a percentage of the patterns.
source code
 
get_top(self, num_patterns)
Return the specified number of most frequently occurring patterns
source code
 
get_differing(self, top_num, bottom_num)
Retrieve patterns that are at the extreme ranges.
source code
 
remove_polyA(self, at_percentage=0.9)
Remove patterns which are likely due to polyA tails from the lists.
source code
 
count(self, pattern)
Return the number of times the specified pattern is found.
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, pattern_info)
(Constructor)

source code 
Initialize a repository with patterns,

Arguments:

o pattern_info - A representation of all of the patterns found in
a *Finder search. This should be a dictionary, where the keys
are patterns, and the values are the number of times a pattern is
found.

The patterns are represented interally as a list of two
tuples, where the first element is the number of times a pattern
occurs, and the second is the pattern itself. This makes it easy
to sort the list and return the top N patterns.

Overrides: object.__init__

get_random(self, num_patterns)

source code 
Retrieve the specified number of patterns randomly.

Randomly selects patterns from the list and returns them.

Arguments:

o num_patterns - The total number of patterns to return.

get_top_percentage(self, percent)

source code 
Return a percentage of the patterns.

This returns the top 'percent' percentage of the patterns in the
repository.

get_top(self, num_patterns)

source code 
Return the specified number of most frequently occurring patterns

Arguments:

o num_patterns - The number of patterns to return.

get_differing(self, top_num, bottom_num)

source code 
Retrieve patterns that are at the extreme ranges.

This returns both patterns at the top of the list (ie. the same as
returned by get_top) and at the bottom of the list. This
is especially useful for patterns that are the differences between
two sets of patterns.

Arguments:

o top_num - The number of patterns to take from the top of the list.

o bottom_num - The number of patterns to take from the bottom of
the list.

remove_polyA(self, at_percentage=0.9)

source code 
Remove patterns which are likely due to polyA tails from the lists.

This is just a helper function to remove pattenrs which are likely
just due to polyA tails, and thus are not really great motifs.
This will also get rid of stuff like ATATAT, which might be a
useful motif, so use at your own discretion.

XXX Could we write a more general function, based on info content
or something like that?

Arguments:

o at_percentage - The percentage of A and T residues in a pattern
that qualifies it for being removed.