Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.Align.AlignInfo.PSSM Class Reference

List of all members.

Public Member Functions

def __init__
def __getitem__
def __str__
def get_residue

Public Attributes

 pssm

Detailed Description

Represent a position specific score matrix.

This class is meant to make it easy to access the info within a PSSM
and also make it easy to print out the information in a nice table.

Let's say you had an alignment like this:
GTATC
AT--C
CTGTC

The position specific score matrix (when printed) looks like:

  G A T C
G 1 1 0 1
T 0 0 3 0
A 1 1 0 0
T 0 0 2 0
C 0 0 0 3

You can access a single element of the PSSM using the following:

your_pssm[sequence_number][residue_count_name]

For instance, to get the 'T' residue for the second element in the
above alignment you would need to do:

your_pssm[1]['T']

Definition at line 606 of file AlignInfo.py.


Constructor & Destructor Documentation

def Bio.Align.AlignInfo.PSSM.__init__ (   self,
  pssm 
)
Initialize with pssm data to represent.

The pssm passed should be a list with the following structure:

list[0] - The letter of the residue being represented (for instance,
from the example above, the first few list[0]s would be GTAT...
list[1] - A dictionary with the letter substitutions and counts.

Definition at line 635 of file AlignInfo.py.

00635 
00636     def __init__(self, pssm):
00637         """Initialize with pssm data to represent.
00638 
00639         The pssm passed should be a list with the following structure:
00640 
00641         list[0] - The letter of the residue being represented (for instance,
00642         from the example above, the first few list[0]s would be GTAT...
00643         list[1] - A dictionary with the letter substitutions and counts.
00644         """
00645         self.pssm = pssm

Here is the caller graph for this function:


Member Function Documentation

def Bio.Align.AlignInfo.PSSM.__getitem__ (   self,
  pos 
)

Definition at line 646 of file AlignInfo.py.

00646 
00647     def __getitem__(self, pos):
00648         return self.pssm[pos][1]

Here is the caller graph for this function:

Definition at line 649 of file AlignInfo.py.

00649 
00650     def __str__(self):
00651         out = " "
00652         all_residues = self.pssm[0][1].keys()
00653         all_residues.sort()
00654         
00655         # first print out the top header
00656         for res in all_residues:
00657             out += "   %s" % res
00658         out += "\n"
00659 
00660         # for each item, write out the substitutions
00661         for item in self.pssm:
00662             out += "%s " % item[0]
00663             for res in all_residues:
00664                 out += " %.1f" % item[1][res]
00665 
00666             out += "\n"
00667         return out

Here is the caller graph for this function:

def Bio.Align.AlignInfo.PSSM.get_residue (   self,
  pos 
)
Return the residue letter at the specified position.

Definition at line 668 of file AlignInfo.py.

00668 
00669     def get_residue(self, pos):
00670         """Return the residue letter at the specified position.
00671         """
00672         return self.pssm[pos][0]
00673 


Member Data Documentation

Definition at line 644 of file AlignInfo.py.


The documentation for this class was generated from the following file: