annotate corebio/transform.py @ 10:20716450be87

Uploaded
author davidmurphy
date Mon, 30 Jan 2012 21:17:50 -0500
parents c55bdc2fb9fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
1 # Copyright (c) 2006 John Gilman
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
2 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
3 # This software is distributed under the MIT Open Source License.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
4 # <http://www.opensource.org/licenses/mit-license.html>
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
5 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
6 # Permission is hereby granted, free of charge, to any person obtaining a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
7 # copy of this software and associated documentation files (the "Software"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
8 # to deal in the Software without restriction, including without limitation
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
9 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
10 # and/or sell copies of the Software, and to permit persons to whom the
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
11 # Software is furnished to do so, subject to the following conditions:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
12 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
13 # The above copyright notice and this permission notice shall be included
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
14 # in all copies or substantial portions of the Software.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
15 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
22 # THE SOFTWARE.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
23
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
24 """ Transformations of Seqs (alphabetic sequences).
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
25
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
26
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
27
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
28 Classes :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
29 - Transform -- Simple transforms of alphabetic strings.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
30 - GeneticCode -- The genetic mapping of dna to protein.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
31
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
32 Functions :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
33 - mask_low_complexity -- Implementation of Seg algorithm to remove low complexity
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
34 regions from protein sequences.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
35
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
36
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
37 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
38
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
39
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
40 from corebio.data import dna_extended_letters, dna_ambiguity
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
41 from corebio.seq import Seq, protein_alphabet, nucleic_alphabet, dna_alphabet
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
42 from string import maketrans
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
43 from corebio.moremath import log2 , entropy
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
44
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
45 __all__ = [
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
46 'Transform',
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
47 'mask_low_complexity',
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
48 'GeneticCode'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
49 ]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
50
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
51 class Transform(object) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
52 """A translation between alphabetic strings.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
53 (This class is not called 'Translation' to avoid confusion with the
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
54 biological translation of rna to protein.)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
55
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
56 Example:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
57 trans = Transform(
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
58 Seq("ACGTRYSWKMBDHVN-acgtUuryswkmbdhvnXx?.~'", dna_alphabet),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
59 Seq("ACGTRYSWKMNNNNN-acgtUuryswkmbnnnnXx?.~", reduced_nucleic_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
60 )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
61 s0 = Seq("AAAAAV", nucleic_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
62 s1 = trans(s0)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
63 assert(s1.alphabet == reduced_nucleic_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
64 assert(s2 == Seq("AAAAAN", reduced_nucleic_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
65
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
66 Status : Beta
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
67 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
68
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
69 __slots__ = ["table", "source", "target"]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
70 def __init__(self, source, target) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
71
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
72 self.table = maketrans(source, target)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
73 self.source = source
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
74 self.target = target
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
75
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
76
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
77 def __call__(self, seq) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
78 """Translate sequence."""
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
79 if not self.source.alphabet.alphabetic(seq) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
80 raise ValueError("Incompatable alphabets")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
81 s = str.translate(seq, self.table)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
82 cls = self.target.__class__
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
83 return cls(s, self.target.alphabet, seq.name, seq.description)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
84 # End class Translation
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
85
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
86 # FIXME: Test, document, add to seq.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
87 dna_complement = Transform(
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
88 Seq("ACGTRYSWKMBDHVN-acgtUuryswkmbdhvnXx?.~", dna_alphabet),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
89 Seq("TGCAYRSWMKVHDBN-tgcaAayrswmkvhdbnXx?.~", dna_alphabet),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
90 )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
91
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
92
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
93
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
94 def mask_low_complexity(seq, width =12, trigger=1.8, extension=2.0, mask='X') :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
95 """ Mask low complexity regions in protein sequences.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
96
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
97 Uses the method of Seg [1] by Wootton & Federhen [2] to divide a sequence
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
98 into regions of high and low complexity. The sequence is divided into
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
99 overlapping windows. Low complexity windows either have a sequence entropy
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
100 less that the trigger complexity, or have an entropy less than the extension
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
101 complexity and neighbor other low-complexity windows. The sequence within
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
102 low complexity regions are replaced with the mask character (default 'X'),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
103 and the masked alphabetic sequence is returned.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
104
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
105 The default parameters, width=12, trigger=1.8, extension=2.0, mask='X' are
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
106 suitable for masking protein sequences before a database search. The
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
107 standard default seg parameters are width=12, trigger=2.2, extension=2.5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
108
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
109 Arguments:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
110 Seq seq -- An alphabetic sequence
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
111 int width -- Window width
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
112 float trigger -- Entropy in bits between 0 and 4.3.. ( =log_2(20) )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
113 float extension -- Entropy in bits between 0 and 4.3.. ( =log_2(20) )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
114 char mask -- The mask character (default: 'X')
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
115 Returns :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
116 Seq -- A masked alphabetic sequence
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
117 Raises :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
118 ValueError -- On invalid arguments
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
119 Refs:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
120 [1] seg man page:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
121 http://bioportal.weizmann.ac.il/education/materials/gcg/seg.html
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
122 [2] Wootton & Federhen (Computers and Chemistry 17; 149-163, (1993))
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
123 Authors:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
124 GEC 2005
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
125 Future :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
126 - Optional mask character.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
127 - Option to lower case masked symbols.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
128 - Remove arbitary restriction to protein.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
129 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
130
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
131 lg20 = log2(20)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
132 if trigger<0 or trigger>lg20 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
133 raise ValueError("Invalid trigger complexity: %f"% trigger)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
134 if extension<0 or extension>lg20 or extension<trigger:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
135 raise ValueError("Invalid extension complexity: %f"% extension)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
136 if width<0 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
137 raise ValueError("Invalid width: %d"% width)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
138
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
139 if width > len(seq) : return seq
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
140
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
141 s = seq.ords()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
142
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
143 X = seq.alphabet.ord(mask)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
144
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
145
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
146 nwindows = len(seq)- width +1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
147 ent = [ 0 for x in range(0, nwindows)]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
148 count = [ 0 for x in range(0, len(seq.alphabet) )]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
149
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
150 for c in s[0:width] : count[c] +=1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
151 ent[0] = entropy(count,2)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
152
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
153 for i in range(1, nwindows) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
154 count[ s[i-1] ] -= 1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
155 count[ s[i+width-1] ] +=1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
156 ent[i] = entropy(count,2)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
157
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
158 prev_segged = False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
159 for i in range(0, nwindows) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
160 if ((prev_segged and ent[i]< extension) or
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
161 ent[i]< trigger) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
162 for j in range(0, width) : s[i+j]=X
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
163 prev_segged=True
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
164 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
165 prev_segged = False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
166
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
167
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
168 # Redo, only backwards
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
169 prev_segged = False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
170 for i in range(nwindows-1, -1, -1) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
171 if ((prev_segged and ent[i]< extension) or
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
172 ent[i]< trigger) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
173 for j in range(0, width) : s[i+j]=X
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
174 prev_segged=True
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
175 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
176 prev_segged = False
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
177
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
178
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
179 return seq.alphabet.chrs(s)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
180 # end mask_low_complexity()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
181
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
182
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
183 class GeneticCode(object):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
184 """An encoding of amino acids by DNA triplets.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
185
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
186 Example :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
187
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
188 Genetic Code [1]: Standard
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
189 T C A G
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
190 +---------+---------+---------+---------+
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
191 T | TTT F | TCT S | TAT Y | TGT C | T
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
192 T | TTC F | TCC S | TAC Y | TGC C | C
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
193 T | TTA L | TCA S | TAA Stop| TGA Stop| A
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
194 T | TTG L(s)| TCG S | TAG Stop| TGG W | G
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
195 +---------+---------+---------+---------+
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
196 C | CTT L | CCT P | CAT H | CGT R | T
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
197 C | CTC L | CCC P | CAC H | CGC R | C
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
198 C | CTA L | CCA P | CAA Q | CGA R | A
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
199 C | CTG L(s)| CCG P | CAG Q | CGG R | G
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
200 +---------+---------+---------+---------+
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
201 A | ATT I | ACT T | AAT N | AGT S | T
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
202 A | ATC I | ACC T | AAC N | AGC S | C
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
203 A | ATA I | ACA T | AAA K | AGA R | A
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
204 A | ATG M(s)| ACG T | AAG K | AGG R | G
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
205 +---------+---------+---------+---------+
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
206 G | GTT V | GCT A | GAT D | GGT G | T
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
207 G | GTC V | GCC A | GAC D | GGC G | C
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
208 G | GTA V | GCA A | GAA E | GGA G | A
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
209 G | GTG V | GCG A | GAG E | GGG G | G
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
210 +---------+---------+---------+---------+
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
211
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
212
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
213 See Also :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
214 -- http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
215 -- http://www.ncbi.nlm.nih.gov/projects/collab/FT/index.html#7.5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
216 Authors:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
217 JXG, GEC
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
218 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
219 # TODO: Explain use of '?' in translated sequence.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
220 # TODO: Does translate fails with aproriate execption when fed gaps?
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
221 # TODO: Can back_translate handle gaps?
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
222
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
223 def __init__(self, ident, description,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
224 amino_acid, start, base1, base2, base3):
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
225 """Create a new GeneticCode.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
226
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
227 Args:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
228 -- ident - Standarad identifier (Or zero). An integer
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
229 -- description
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
230 -- amino acid - A sequecne of amino acids and stop codons. e.g.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
231 "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
232 -- start - A sequence indicating start codons, e.g.,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
233 "---M---------------M---------------M----------------------------"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
234 -- base1 - The first base of each codon. e.g.,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
235 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
236 -- base2 - The second base of each codon. e.g.,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
237 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
238 -- base3 - The last base of each codon. e.g.,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
239 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
240 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
241 self.ident = ident
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
242 self.description = description
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
243
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
244 self.amino_acid = amino_acid
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
245 self.start = start
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
246 self.base1 = base1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
247 self.base2 = base2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
248 self.base3 = base3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
249
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
250 stop_codons = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
251 start_codons = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
252 for i, a in enumerate(amino_acid) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
253 codon = base1[i] + base2[i] + base3[i]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
254 if a=='*' : stop_codons.append(codon)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
255 if start[i] == 'M': start_codons.append(codon)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
256
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
257 self.stop_codons = tuple(stop_codons)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
258 self.start_codons = tuple(start_codons)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
259
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
260 # Building the full translation table is expensive,
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
261 # so we avoid doing so until necessary.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
262 self._table = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
263 self._back_table = None
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
264
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
265 #@staticmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
266 def std_list():
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
267 "Return a list of standard genetic codes."
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
268 return _codon_tables
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
269 std_list = staticmethod(std_list)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
270
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
271 #@staticmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
272 def std():
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
273 "The standard 'universal' genetic code."
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
274 return _codon_tables[0]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
275 std = staticmethod(std)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
276
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
277
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
278 #@staticmethod
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
279 def by_name(name) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
280 """Find a genetic code in the code list by name or identifier.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
281 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
282 for t in _codon_tables :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
283 if t.ident == name or t.description == name :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
284 return t
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
285 raise ValueError("No such translation table: %s" % str(name) )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
286 by_name = staticmethod(by_name)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
287
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
288
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
289 def _get_table(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
290 if self._table is None : self._create_table()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
291 return self._table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
292 table = property(_get_table, None, "A map between codons and amino acids")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
293
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
294 def _get_back_table(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
295 if self._back_table is None :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
296 self._create_table()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
297 return self._back_table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
298 back_table = property(_get_back_table, None, "A map between amino acids and codons")
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
299
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
300
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
301 def _create_table(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
302 aa = self.amino_acid
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
303 base1 = self.base1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
304 base2 = self.base2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
305 base3 = self.base3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
306
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
307 # Construct a table of unambiguous codon translations
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
308 table = {}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
309 for i, a in enumerate(aa) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
310 codon = base1[i] + base2[i] + base3[i]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
311 table[codon] = a
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
312
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
313 # Build the back table.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
314 back_table = {}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
315 items = table.items()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
316 items.sort()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
317 for codon, aa in items[::-1] :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
318 back_table[aa] = codon # Use first codon, alphabetically.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
319 back_table['X'] = 'NNN'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
320 back_table['B'] = 'NNN'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
321 back_table['Z'] = 'NNN'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
322 back_table['J'] = 'NNN'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
323 self._back_table = back_table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
324
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
325 ltable = {}
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
326 letters = dna_extended_letters+'U' # include RNA in table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
327
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
328 # Create a list of all possble codons
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
329 codons = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
330 for c1 in letters:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
331 for c2 in letters:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
332 for c3 in letters :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
333 codons.append( c1+c2+c3)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
334
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
335 # For each ambiguous codon, construct all compatible unambiguous codons.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
336 # Translate and collect a set of all possible translated amino acids.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
337 # If more than one translation look for possible amino acid ambiguity
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
338 # codes.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
339 for C in codons :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
340 translated = dict() # Use dict, because no set in py2.3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
341 c = C.replace('U', 'T') # Convert rna codon to dna
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
342 for c1 in dna_ambiguity[c[0]]:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
343 for c2 in dna_ambiguity[c[1]]:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
344 for c3 in dna_ambiguity[c[2]]:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
345 aa = table[ c1+c2+c3 ]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
346 translated[aa] = ''
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
347 translated = list(translated.keys())
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
348 translated.sort()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
349 if len(translated) ==1 :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
350 trans = list(translated)[0]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
351 elif translated == ['D','N'] :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
352 trans = 'B'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
353 elif translated == ['E','Q'] :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
354 trans = 'Z'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
355 elif translated == ['I','L'] :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
356 trans = 'J'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
357 elif '*' in translated:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
358 trans = '?'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
359 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
360 trans = 'X'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
361 ltable[C] = trans
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
362
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
363 self._table = ltable
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
364 # End create tables
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
365
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
366 def translate(self, seq, frame=0) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
367 """Translate a DNA sequence to a polypeptide using full
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
368 IUPAC ambiguities in DNA/RNA and amino acid codes.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
369
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
370 Returns :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
371 -- Seq - A polypeptide sequence
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
372 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
373 # TODO: Optimize.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
374 # TODO: Insanity check alphabet.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
375 seq = str(seq)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
376 table = self.table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
377 trans = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
378 L = len(seq)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
379 for i in range(frame, L-2, 3) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
380 codon = seq[i:i+3].upper()
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
381 trans.append( table[codon])
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
382 return Seq(''.join(trans), protein_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
383
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
384
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
385 def back_translate(self, seq) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
386 """Convert protein back into coding DNA.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
387
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
388 Args:
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
389 -- seq - A polypeptide sequence.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
390
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
391 Returns :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
392 -- Seq - A dna sequence
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
393 """
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
394 # TODO: Optimzie
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
395 # TODO: Insanity check alphabet.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
396 table = self.back_table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
397 seq = str(seq)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
398 trans = [ table[a] for a in seq]
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
399 return Seq(''.join(trans), dna_alphabet)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
400
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
401 #TODO: translate_orf(self, seq, start) ?
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
402 #TODO: translate_to_stop(self, seq, frame) ?
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
403 #TODO: translate_all_frames(self,seq) -> 6 translations.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
404
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
405 def __repr__(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
406 string = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
407 string += 'GeneticCode( %d, "' % self.ident
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
408 string += self.description
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
409 string += '", \n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
410 string += ' amino_acid = "'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
411 string += self.amino_acid
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
412 string += '",\n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
413 string += ' start = "'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
414 string += self.start
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
415 string += '",\n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
416 string += ' base1 = "'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
417 string += self.base1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
418 string += '",\n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
419 string += ' base2 = "'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
420 string += self.base2
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
421 string += '",\n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
422 string += ' base3 = "'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
423 string += self.base3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
424 string += '" )'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
425 return ''.join(string)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
426
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
427
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
428 def __str__(self) :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
429 """Returns a text representation of this genetic code."""
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
430 # Inspired by http://bugzilla.open-bio.org/show_bug.cgi?id=1963
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
431 letters = "TCAG" # Convectional ordering for codon tables.
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
432 string = []
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
433
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
434 if self.ident :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
435 string += 'Genetic Code [%d]: ' % self.ident
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
436 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
437 string += 'Genetic Code: '
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
438 string += self.description or ''
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
439
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
440 string += "\n "
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
441 string += " ".join( [" %s " % c2 for c2 in letters] )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
442
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
443 string += "\n +"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
444 string += "+".join(["---------" for c2 in letters]) + "+ "
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
445
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
446 table = self.table
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
447
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
448 for c1 in letters :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
449 for c3 in letters :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
450 string += '\n '
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
451 string += c1
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
452 string += " |"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
453 for c2 in letters :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
454 codon = c1+c2+c3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
455 string += " " + codon
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
456 if codon in self.stop_codons :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
457 string += " Stop|"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
458 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
459 amino = table.get(codon, '?')
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
460 if codon in self.start_codons :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
461 string += " %s(s)|" % amino
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
462 else :
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
463 string += " %s |" % amino
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
464 string += " " + c3
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
465
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
466 string += "\n +"
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
467 string += "+".join(["---------" for c2 in letters])
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
468 string += "+ "
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
469 string += '\n'
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
470 return ''.join(string)
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
471 # end class GeneticCode
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
472
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
473
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
474 # Data from http://www.ncbi.nlm.nih.gov/projects/collab/FT/index.html#7.5
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
475 # Aug. 2006
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
476 # Genetic Code Tables
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
477 #
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
478 # Authority International Sequence Databank Collaboration
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
479 # Contact NCBI
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
480 # Scope /transl_table qualifier
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
481 # URL http://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?mode=c
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
482 _codon_tables = (
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
483 GeneticCode(1, "Standard",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
484 "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
485 "---M---------------M---------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
486 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
487 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
488 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
489
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
490 GeneticCode(2, "Vertebrate Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
491 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSS**VVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
492 "--------------------------------MMMM---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
493 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
494 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
495 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
496
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
497 GeneticCode(3, "Yeast Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
498 "FFLLSSSSYY**CCWWTTTTPPPPHHQQRRRRIIMMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
499 "----------------------------------MM----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
500 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
501 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
502 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
503
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
504 GeneticCode(4, "Mold, Protozoan, Coelenterate Mitochondrial & Mycoplasma/Spiroplasma",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
505 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
506 "--MM---------------M------------MMMM---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
507 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
508 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
509 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
510
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
511 GeneticCode(5, "Invertebrate Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
512 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSSSVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
513 "---M----------------------------MMMM---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
514 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
515 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
516 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
517
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
518 GeneticCode(6, "Ciliate, Dasycladacean and Hexamita Nuclear",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
519 "FFLLSSSSYYQQCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
520 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
521 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
522 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
523 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
524
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
525 GeneticCode(9, "Echinoderm and Flatworm Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
526 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
527 "-----------------------------------M---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
528 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
529 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
530 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
531
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
532 GeneticCode(10, "Euplotid Nuclear",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
533 "FFLLSSSSYY**CCCWLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
534 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
535 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
536 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
537 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
538
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
539 GeneticCode(11, "Bacterial and Plant Plastid",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
540 "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
541 "---M---------------M------------MMMM---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
542 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
543 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
544 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
545
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
546 GeneticCode(12, "Alternative Yeast Nuclear",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
547 "FFLLSSSSYY**CC*WLLLSPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
548 "-------------------M---------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
549 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
550 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
551 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
552
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
553 GeneticCode(13,"Ascidian Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
554 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNKKSSGGVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
555 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
556 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
557 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
558 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
559
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
560 GeneticCode(14, "Alternative Flatworm Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
561 "FFLLSSSSYYY*CCWWLLLLPPPPHHQQRRRRIIIMTTTTNNNKSSSSVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
562 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
563 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
564 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
565 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
566
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
567 GeneticCode(15, "Blepharisma Nuclear",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
568 "FFLLSSSSYY*QCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
569 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
570 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
571 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
572 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
573
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
574 GeneticCode(16, "Chlorophycean Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
575 "FFLLSSSSYY*LCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
576 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
577 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
578 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
579 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
580
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
581 GeneticCode(21, "Trematode Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
582 "FFLLSSSSYY**CCWWLLLLPPPPHHQQRRRRIIMMTTTTNNNKSSSSVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
583 "-----------------------------------M---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
584 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
585 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
586 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
587
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
588 GeneticCode(22, "Scenedesmus obliquus Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
589 "FFLLSS*SYY*LCC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
590 "-----------------------------------M----------------------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
591 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
592 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
593 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG"),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
594
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
595 GeneticCode(23,"Thraustochytrium Mitochondrial",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
596 "FF*LSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
597 "--------------------------------M--M---------------M------------",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
598 "TTTTTTTTTTTTTTTTCCCCCCCCCCCCCCCCAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
599 "TTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGGTTTTCCCCAAAAGGGG",
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
600 "TCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAGTCAG",),
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
601 )
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
602
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
603
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
604
c55bdc2fb9fa Uploaded
davidmurphy
parents:
diff changeset
605