Package Bio :: Package SubsMat :: Class SeqMat
[hide private]
[frames] | no frames]

Class SeqMat

source code

object --+    
         |    
      dict --+
             |
            SeqMat
Known Subclasses:

A Generic sequence matrix class.

The key is a 2-tuple containing the letter indices of the matrix. Those should be sorted in the tuple (low, high). Because each matrix is dealt with as a half-matrix.

Instance Methods [hide private]
 
_alphabet_from_matrix(self)
Set alphabet letters from the matrix entries (PRIVATE).
source code
new empty dictionary

__init__(self, data=None, alphabet=None, mat_name='', build_later=0)
Initialize.
source code
 
_correct_matrix(self)
Sort key tuples (PRIVATE).
source code
 
_full_to_half(self)
Convert a full-matrix to a half-matrix.
source code
 
_init_zero(self)
Initialize the ab_list values to zero (PRIVATE).
source code
 
make_entropy(self)
Calculate and set the entropy attribute.
source code
 
sum(self)
Return sum of the results.
source code
 
print_full_mat(self, f=None, format='%4d', topformat='%4s', alphabet=None, factor=1, non_sym=None)
Print the full matrix to the file handle f or stdout.
source code
 
print_mat(self, f=None, format='%4d', bottomformat='%4s', alphabet=None, factor=1)
Print a nice half-matrix.
source code
 
__str__(self)
Print a nice half-matrix.
source code
 
__sub__(self, other)
Return integer subtraction product of the two matrices.
source code
 
__mul__(self, other)
Matrix multiplication.
source code
 
__add__(self, other)
Matrix addition.
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __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, viewitems, viewkeys, viewvalues

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]

__init__(self, data=None, alphabet=None, mat_name='', build_later=0)
(Constructor)

source code 

Initialize.

User may supply:

  • data: matrix itself
  • mat_name: its name. See below.
  • alphabet: an instance of Bio.Alphabet, or a subclass. If not supplied, constructor builds its own from that matrix.
  • build_later: skip the matrix size assertion. User will build the matrix after creating the instance. Constructor builds a half matrix filled with zeroes.
Returns:
new empty dictionary

Overrides: object.__init__

print_mat(self, f=None, format='%4d', bottomformat='%4s', alphabet=None, factor=1)

source code 

Print a nice half-matrix.

f=sys.stdout to see on the screen.

User may pass own alphabet, which should contain all letters in the alphabet of the matrix, but may be in a different order. This order will be the order of the letters on the axes.

__str__(self)
(Informal representation operator)

source code 
Print a nice half-matrix.
Overrides: object.__str__

__mul__(self, other)

source code 

Matrix multiplication.

Returns a matrix for which each entry is the multiplication product of the two matrices passed.