Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Private Member Functions
Bio.CAPS.CAPSMap Class Reference

List of all members.

Public Member Functions

def __init__

Public Attributes

 sequences
 size
 length
 alignment
 enzymes
 dcuts

Private Member Functions

def _digest_with
def _digest

Detailed Description

A map of an alignment showing all possible dcuts.

Members:
alignment  The alignment that is mapped.
dcuts      A list of possible CAPS markers in the form of 
                     DifferentialCutsites.

Definition at line 46 of file __init__.py.


Constructor & Destructor Documentation

def Bio.CAPS.CAPSMap.__init__ (   self,
  alignment,
  enzymes = [] 
)
Initialize the CAPSMap

Required:
alignment    The alignment to be mapped.

Optional:
enzymes      The enzymes to be used to create the map.

Definition at line 55 of file __init__.py.

00055 
00056     def __init__(self, alignment, enzymes = []):
00057         """Initialize the CAPSMap
00058 
00059         Required:
00060         alignment    The alignment to be mapped.
00061 
00062         Optional:
00063         enzymes      The enzymes to be used to create the map.
00064         """
00065 
00066         self.sequences = [rec.seq for rec in alignment]
00067         self.size = len(self.sequences)
00068         self.length = len(self.sequences[0])
00069         for seq in self.sequences:
00070             if len(seq) != self.length:
00071                 raise AlignmentHasDifferentLengthsError
00072 
00073         self.alignment = alignment
00074         self.enzymes = enzymes
00075 
00076         # look for dcuts
00077         self._digest()
    

Here is the caller graph for this function:


Member Function Documentation

def Bio.CAPS.CAPSMap._digest (   self) [private]

Definition at line 120 of file __init__.py.

00120 
00121     def _digest(self):
00122         self.dcuts = []
00123 
00124         for enzyme in self.enzymes:
00125             self._digest_with(enzyme)
def Bio.CAPS.CAPSMap._digest_with (   self,
  enzyme 
) [private]

Definition at line 78 of file __init__.py.

00078 
00079     def _digest_with(self, enzyme):
00080         cuts = {}
00081         all = []
00082 
00083         # go through each sequence
00084         for seq in self.sequences:
00085 
00086             # grab all the cuts in the sequence
00087             cuts[seq] = [cut - enzyme.fst5 for cut in enzyme.search(seq)]
00088 
00089             # maintain a list of all cuts in all sequences
00090             all.extend(cuts[seq])
00091 
00092         # we sort the all list and remove duplicates
00093         all.sort()
00094         
00095         last = -999
00096         new = []
00097         for cut in all:
00098             if cut != last:
00099                 new.append(cut)
00100             last = cut
00101 
00102         all = new
00103         # all now has indices for all sequences in the alignment
00104 
00105         for cut in all:
00106             # test for dcuts
00107 
00108             cuts_in = []
00109             blocked_in = []
00110 
00111             for i in range(0, self.size):
00112                 seq = self.sequences[i]
00113                 if cut in cuts[seq]:
00114                     cuts_in.append(i)
00115                 else:
00116                     blocked_in.append(i)
00117 
00118             if cuts_in != [] and blocked_in != []:
00119                 self.dcuts.append(DifferentialCutsite(start = cut, enzyme = enzyme, cuts_in = cuts_in, blocked_in = blocked_in))


Member Data Documentation

Definition at line 72 of file __init__.py.

Definition at line 121 of file __init__.py.

Definition at line 73 of file __init__.py.

Definition at line 67 of file __init__.py.

Definition at line 65 of file __init__.py.

Definition at line 66 of file __init__.py.


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