Package Bio :: Package motifs :: Module matrix :: Class PositionSpecificScoringMatrix
[hide private]
[frames] | no frames]

Class PositionSpecificScoringMatrix

source code

       object --+        
                |        
             dict --+    
                    |    
GenericPositionMatrix --+
                        |
                       PositionSpecificScoringMatrix

Instance Methods [hide private]
 
_calculate(self, sequence, m, n) source code
 
calculate(self, sequence)
Returns the PWM score for a given sequence for all positions.
source code
 
search(self, sequence, threshold=0.0, both=True)
Find hits with PWM score above given threshold.
source code
 
max(self)
Maximal possible score for this motif.
source code
 
min(self)
Minimal possible score for this motif.
source code
 
gc_content(self)
Compute the fraction GC content.
source code
 
mean(self, background=None)
Expected value of the score of a motif.
source code
 
std(self, background=None)
Standard deviation of the score of a motif.
source code
 
dist_pearson(self, other)
Return the similarity score based on pearson correlation for the given motif against self.
source code
 
dist_pearson_at(self, other, offset) source code
 
distribution(self, background=None, precision=10**3)
calculate the distribution of the scores at the given precision.
source code

Inherited from GenericPositionMatrix: __getitem__, __init__, __str__, anticonsensus, consensus, degenerate_consensus, reverse_complement

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

calculate(self, sequence)

source code 

Returns the PWM score for a given sequence for all positions.

Notes:

  • the sequence can only be a DNA sequence
  • the search is performed only on one strand
  • if the sequence and the motif have the same length, a single number is returned
  • otherwise, the result is a one-dimensional list or numpy array

search(self, sequence, threshold=0.0, both=True)

source code 

Find hits with PWM score above given threshold.

A generator function, returning found hits in the given sequence with the pwm score higher than the threshold.

max(self)

source code 

Maximal possible score for this motif.

returns the score computed for the consensus sequence.

Decorators:
  • @property

min(self)

source code 

Minimal possible score for this motif.

returns the score computed for the anticonsensus sequence.

Decorators:
  • @property

gc_content(self)

source code 
Compute the fraction GC content.
Decorators:
  • @property
Overrides: GenericPositionMatrix.gc_content
(inherited documentation)

dist_pearson(self, other)

source code 

Return the similarity score based on pearson correlation for the given motif against self.

We use the Pearson's correlation of the respective probabilities.