1
2
3
4
5
6 """This module deals with CAPS markers.
7
8 A CAPS marker is a location a DifferentialCutsite as described below and a
9 set of primers that can be used to visualize this. More information can
10 be found in the paper located at:
11
12 http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&list_uids=8106085&dopt=Abstract
13
14 Copyright Jonathan Taylor 2005
15 """
16
18 """A differential cutsite is a location in an alignment where an enzyme cuts
19 at least one sequence and also cannot cut at least one other sequence.
20
21 Members:
22 start Where it lives in the alignment.
23 enzyme The enzyme that causes this.
24 cuts_in A list of sequences (as indexes into the alignment) the
25 enzyme cuts in.
26 blocked_in A list of sequences (as indexes into the alignment) the
27 enzyme is blocked in.
28
29 """
30
32 """Initialize a DifferentialCutsite.
33
34 Each member (as listed in the class description) should be included as a
35 keyword.
36 """
37
38 self.start = int(kwds["start"])
39 self.enzyme = kwds["enzyme"]
40 self.cuts_in = kwds["cuts_in"]
41 self.blocked_in = kwds["blocked_in"]
42
45
47 """A map of an alignment showing all possible dcuts.
48
49 Members:
50 alignment The alignment that is mapped.
51 dcuts A list of possible CAPS markers in the form of
52 DifferentialCutsites.
53 """
54
55 - def __init__(self, alignment, enzymes = []):
77
79 cuts = {}
80 all = []
81
82
83 for seq in self.sequences:
84
85
86 cuts[seq] = [cut - enzyme.fst5 for cut in enzyme.search(seq)]
87
88
89 all.extend(cuts[seq])
90
91
92 all.sort()
93
94 last = -999
95 new = []
96 for cut in all:
97 if cut != last:
98 new.append(cut)
99 last = cut
100
101 all = new
102
103
104 for cut in all:
105
106
107 cuts_in = []
108 blocked_in = []
109
110 for i in range(0, self.size):
111 seq = self.sequences[i]
112 if cut in cuts[seq]:
113 cuts_in.append(i)
114 else:
115 blocked_in.append(i)
116
117 if cuts_in != [] and blocked_in != []:
118 self.dcuts.append(DifferentialCutsite(start = cut, enzyme = enzyme, cuts_in = cuts_in, blocked_in = blocked_in))
119
121 self.dcuts = []
122
123 for enzyme in self.enzymes:
124 self._digest_with(enzyme)
125