File: codon.tex

package info (click to toggle)
wise 2.4.1-21
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 27,140 kB
  • sloc: ansic: 276,365; makefile: 1,003; perl: 886; lex: 93; yacc: 81; sh: 24
file content (358 lines) | stat: -rw-r--r-- 10,042 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
\section{codon}
\label{module_codon}
This module contains the following objects

\begin{itemize}
\item \ref{object_CodonTable} CodonTable

\item This module also contains some factory methods
\end{itemize}
\subsection{codon factory methods}
\subsubsection{is_non_ambiguous_codon_seq}
\begin{description}
\item[External C] {\tt Wise2_is_non_ambiguous_codon_seq (seq)}
\item[Perl] {\tt &Wise2::is_non_ambiguous_codon_seq (seq)}

\end{description}
Arguments
\begin{description}
\item[seq] [READ ] pointer to DNA sequence [char *]
\item[returns] [UNKN ] TRUE if real codon, FALSE if contains N's [boolean]
\end{description}
Tells you if this codon is a real codon


\subsubsection{codon_from_base4_codon}
\begin{description}
\item[External C] {\tt Wise2_codon_from_base4_codon (c)}
\item[Perl] {\tt &Wise2::codon_from_base4_codon (c)}

\end{description}
Arguments
\begin{description}
\item[c] [UNKN ] Undocumented argument [int]
\item[returns] [UNKN ] Undocumented return value [codon]
\end{description}
maps a 0-63 codon to a 0-123 codon. Suprisingly useful.


\subsubsection{base4_codon_from_codon}
\begin{description}
\item[External C] {\tt Wise2_base4_codon_from_codon (c)}
\item[Perl] {\tt &Wise2::base4_codon_from_codon (c)}

\end{description}
Arguments
\begin{description}
\item[c] [READ ] codon 0-125 [codon]
\item[returns] [UNKN ] base 4 codon (0-63) [int]
\end{description}
maps a 0-125 codon to a 0-63 codon.


If ambiguous then returns 64 having issued a warning.


\subsubsection{has_random_bases}
\begin{description}
\item[External C] {\tt Wise2_has_random_bases (c)}
\item[Perl] {\tt &Wise2::has_random_bases (c)}

\end{description}
Arguments
\begin{description}
\item[c] [READ ] codon number 0-124 [codon]
\item[returns] [UNKN ] TRUE if has N's , FALSE otherwise [boolean]
\end{description}
Tests to see if this codon number has any N's in it


\subsubsection{permute_possible_random_bases}
\begin{description}
\item[External C] {\tt Wise2_permute_possible_random_bases (c,one,two,three)}
\item[Perl] {\tt &Wise2::permute_possible_random_bases (c,one,two,three)}

\end{description}
Arguments
\begin{description}
\item[c] [READ ] codon number [codon]
\item[one] [READ ] base to replace first position if N [base]
\item[two] [READ ] base to replace second position if N [base]
\item[three] [READ ] base to replace third position if N [base]
\item[returns] [UNKN ] codon number  [codon]
\end{description}
Bizarely useful function for calculating ambiguity scores.


This takes the codon c, and for each possible base, 
if it is N, replaces it with one, two or three.


If the base is not N, it remains the same


\subsubsection{base_from_codon}
\begin{description}
\item[External C] {\tt Wise2_base_from_codon (c,pos)}
\item[Perl] {\tt &Wise2::base_from_codon (c,pos)}

\end{description}
Arguments
\begin{description}
\item[c] [UNKN ] Undocumented argument [codon]
\item[pos] [UNKN ] Undocumented argument [int]
\item[returns] [UNKN ] Undocumented return value [base]
\end{description}
Probably not the best function to use for this, but 
useful. Takes a codon and with pos being 1,2,3 gives
you the firt,second of third base


\subsubsection{codon_from_seq}
\begin{description}
\item[External C] {\tt Wise2_codon_from_seq (seq)}
\item[Perl] {\tt &Wise2::codon_from_seq (seq)}

\end{description}
Arguments
\begin{description}
\item[seq] [UNKN ] pointer to sequence of at least 3 chrs long. [char *]
\item[returns] [UNKN ] Undocumented return value [codon]
\end{description}
takes an ASCII coded pointer to a 3 base pair
sequence (it could be the part of a sequence: it only
assummes that the seq points with 3 chars at pos 0,1,2 
in C coordinates from seq. No NULL is required). It 
ives back the codon as made from standard mapping, ie,
25*base_1+5*base_2 + base3 being a number from 0-124 inc.


\subsubsection{base4_codon_from_seq}
\begin{description}
\item[External C] {\tt Wise2_base4_codon_from_seq (seq)}
\item[Perl] {\tt &Wise2::base4_codon_from_seq (seq)}

\end{description}
Arguments
\begin{description}
\item[seq] [UNKN ] pointer to sequence of at least 3 chrs long [char *]
\item[returns] [UNKN ] Undocumented return value [int]
\end{description}
Sometimes it is more useful to work in base64, ie, 
non N. this functions does the same thing as 
/codon_from_seq but produces a seq being
16*base1 + 4 *base2 + base3


\subsubsection{char_from_base}
\begin{description}
\item[External C] {\tt Wise2_char_from_base (b)}
\item[Perl] {\tt &Wise2::char_from_base (b)}

\end{description}
Arguments
\begin{description}
\item[b] [UNKN ] Undocumented argument [base]
\item[returns] [UNKN ] Undocumented return value [char]
\end{description}
maps a base number (-04 inc) to A,T,G,C,N


\subsubsection{base_from_char}
\begin{description}
\item[External C] {\tt Wise2_base_from_char (c)}
\item[Perl] {\tt &Wise2::base_from_char (c)}

\end{description}
Arguments
\begin{description}
\item[c] [UNKN ] Undocumented argument [char]
\item[returns] [UNKN ] Undocumented return value [base]
\end{description}
maps a char (atcgn) to number, 
case insensitive, returns BASE_N
if not atcgn


\subsubsection{char_complement_base}
\begin{description}
\item[External C] {\tt Wise2_char_complement_base (c)}
\item[Perl] {\tt &Wise2::char_complement_base (c)}

\end{description}
Arguments
\begin{description}
\item[c] [UNKN ] Undocumented argument [char]
\item[returns] [UNKN ] Undocumented return value [char]
\end{description}
the char equivalent of /complement_base.
this gives the complement in char of a base
in char. Does not check for non ATGCN


\subsubsection{complement_base}
\begin{description}
\item[External C] {\tt Wise2_complement_base (b)}
\item[Perl] {\tt &Wise2::complement_base (b)}

\end{description}
Arguments
\begin{description}
\item[b] [UNKN ] Undocumented argument [base]
\item[returns] [UNKN ] Undocumented return value [base]
\end{description}
gives back the complement as a number
ofthe base (given as a number)




\subsection{Object CodonTable}

\label{object_CodonTable}

The CodonTable object has the following fields. To see how to access them refer to \ref{accessing_fields}
\begin{description}
\item{codon_str[125]} Type [aa : Scalar] No documentation

\item{name} Type [char * : Scalar] No documentation

\end{description}
The codon table provides a mapping from the 64 codons to the 20 amino
acids. The rest of the modules provides assorted codon<->base<->amino
acid mappings.


Probably the trickiest thing is that there are two different types of
representations of codons. One in base 5 (N being the 5th base),
providing 0-124 inclusive codon numbers.  These numbers are the ones
going to be principly used in most calculations.


However, it is often very useful to use 0-63 numbers, for example 
in the precise definition of the codon table. 




Member functions of CodonTable

\subsubsection{read_CodonTable_file}

\begin{description}
\item[External C] {\tt Wise2_read_CodonTable_file (file)}
\item[Perl] {\tt &Wise2::CodonTable::read_CodonTable_file (file)}

\item[Perl-OOP call] {\tt $obj->read_CodonTable_file()}

\end{description}
Arguments
\begin{description}
\item[file] [READ ] filename to open [char *]
\item[returns] [OWNER] A codon-table, NULL if error [CodonTable *]
\end{description}
Opens filename, reads it as if a Ewan style
codon table and closes.


\subsubsection{read_CodonTable}

\begin{description}
\item[External C] {\tt Wise2_read_CodonTable (ifp)}
\item[Perl] {\tt &Wise2::CodonTable::read_CodonTable (ifp)}

\item[Perl-OOP call] {\tt $obj->read_CodonTable()}

\end{description}
Arguments
\begin{description}
\item[ifp] [READ ] file input [FILE *]
\item[returns] [UNKN ] Undocumented return value [CodonTable *]
\end{description}
reads a codon table from a filestream in Ewan
format.


As Ewan format is really bad and has no start/stop
this will effectively read to the end of the file.
Ooops.


\subsubsection{aminoacid_from_seq}

\begin{description}
\item[External C] {\tt Wise2_aminoacid_from_seq (ct,seq)}
\item[Perl] {\tt &Wise2::CodonTable::aminoacid_from_seq (ct,seq)}

\item[Perl-OOP call] {\tt $obj->aminoacid_from_seq(seq)}

\end{description}
Arguments
\begin{description}
\item[ct] [READ ] codon table [CodonTable *]
\item[seq] [READ ] pointer to DNA chars [char *]
\item[returns] [UNKN ] an amino acid char (A-Z) [aa]
\end{description}
Returns the amino acid for this position in the DNA sequence
Takes the pointer +1 and +2 points.


No error checks implemented. Probably a mistake ;)


\subsubsection{aminoacid_from_codon}

\begin{description}
\item[External C] {\tt Wise2_aminoacid_from_codon (ct,c)}
\item[Perl] {\tt &Wise2::CodonTable::aminoacid_from_codon (ct,c)}

\item[Perl-OOP call] {\tt $obj->aminoacid_from_codon(c)}

\end{description}
Arguments
\begin{description}
\item[ct] [READ ] codon table [CodonTable *]
\item[c] [READ ] codon number [codon]
\item[returns] [READ ] aminoacid that is this codon (X for ambiguous, * for stop) [aa]
\end{description}
returns amino acid for this codon number (NB codon numbers 0-125)


\subsubsection{is_stop_codon}

\begin{description}
\item[External C] {\tt Wise2_is_stop_codon (c,ct)}
\item[Perl] {\tt &Wise2::CodonTable::is_stop_codon (c,ct)}

\item[Perl-OOP call] {\tt $obj->is_stop_codon(ct)}

\end{description}
Arguments
\begin{description}
\item[c] [READ ] codon number [codon]
\item[ct] [READ ] codon table [CodonTable *]
\item[returns] [UNKN ] TRUE if is stop, FALSE otherwise [boolean]
\end{description}
tells you whether this codon number is really a stop
in this translation table


\subsubsection{is_valid_aminoacid}

\begin{description}
\item[External C] {\tt Wise2_is_valid_aminoacid (ct,c)}
\item[Perl] {\tt &Wise2::CodonTable::is_valid_aminoacid (ct,c)}

\item[Perl-OOP call] {\tt $obj->is_valid_aminoacid(c)}

\end{description}
Arguments
\begin{description}
\item[ct] [READ ] Codon Table [CodonTable *]
\item[c] [UNKN ] aminoacid [char]
\item[returns] [UNKN ] TRUE if valid, FALSE if not. [boolean]
\end{description}
Tells you if this letter (c) is recognised as a valid amino acid
in this codon table