ARB
Classes | Macros | Functions | Variables
AP_codon_table.cxx File Reference
#include "AP_codon_table.hxx"
#include "AP_pro_a_nucs.hxx"
#include "iupac.h"
#include <arb_global_defs.h>
#include <arb_str.h>
#include <cctype>
Include dependency graph for AP_codon_table.cxx:

Go to the source code of this file.

Classes

class  Codon_Group
 

Macros

#define pn_assert(cond)   arb_assert(cond)
 
#define EMBL_BACTERIAL_TABLE_INDEX   11
 
#define AWT_CODON_TABLE_MAX_NAME_LENGTH   57
 
#define VALID_PROTEIN   "ABCDEFGHIJKLMNPQRSTVWXYZ*"
 
#define VALID_PROTEIN_NO_X   "ABCDEFGHIJKLMNPQRSTVWYZ*"
 
#define MAX_EMBL_TRANSL_TABLE_VALUE   31
 
#define MAX_CODON_LIST_LENGTH   (70*3)
 

Functions

int TTIT_embl2arb (int embl_code_nr)
 
int TTIT_arb2embl (int arb_code_nr)
 
static void addToAmbiguous (int codon_nr, char possible_translation)
 
void AP_initialize_codon_tables ()
 
int dna2idx (char c)
 
char idx2dna (int idx)
 
int calc_codon_nr (const char *dna)
 
void build_codon (int codon_nr, char *to_buffer)
 
const charAWT_get_codon_code_name (int code)
 
const chargetAminoAcidAbbr (char aa)
 
char isStartOrStopCodonNr (int codon_nr, int code_nr)
 
bool protMatches (char p1, char p2)
 
bool containsProtMatching (const char *pstr, char p)
 
bool isGap (char c)
 
GB_ERROR neverTranslatesError (const char *dna, char protein)
 
bool AWT_is_codon (char protein, const char *const dna, const TransTables &allowed, TransTables &remaining, const char **fail_reason_ptr)
 
int legal_dna_no (int i)
 
const charbuildMixedCodon (const char *const con1, const char *const con2)
 
static int expandMore (const char *bufferStart, int no_of_condons, char *&to_buffer)
 
static Codon_Groupget_Codon_Group (char protein, int code_nr)
 
const charAP_get_codons (char protein, int code_nr)
 

Variables

static AWT_Codon_Code_Definition AWT_codon_def [AWT_CODON_TABLES+1]
 
static bool codon_tables_initialized = false
 
static char definite_translation [AWT_MAX_CODONS]
 
static charambiguous_codons [AWT_MAX_CODONS]
 
static const charaa_3letter_name [26+1]
 

Macro Definition Documentation

#define pn_assert (   cond)    arb_assert(cond)
#define EMBL_BACTERIAL_TABLE_INDEX   11

Definition at line 23 of file AP_codon_table.cxx.

Referenced by TTIT_embl2arb().

#define AWT_CODON_TABLE_MAX_NAME_LENGTH   57

Definition at line 24 of file AP_codon_table.cxx.

Referenced by AP_initialize_codon_tables().

#define VALID_PROTEIN   "ABCDEFGHIJKLMNPQRSTVWXYZ*"

Definition at line 26 of file AP_codon_table.cxx.

Referenced by neverTranslatesError().

#define VALID_PROTEIN_NO_X   "ABCDEFGHIJKLMNPQRSTVWYZ*"

Definition at line 27 of file AP_codon_table.cxx.

Referenced by AWT_is_codon().

#define MAX_EMBL_TRANSL_TABLE_VALUE   31

Definition at line 216 of file AP_codon_table.cxx.

Referenced by TTIT_embl2arb().

#define MAX_CODON_LIST_LENGTH   (70*3)

Definition at line 987 of file AP_codon_table.cxx.

Referenced by AP_get_codons().

Function Documentation

int TTIT_embl2arb ( int  embl_code_nr)
int TTIT_arb2embl ( int  arb_code_nr)
static void addToAmbiguous ( int  codon_nr,
char  possible_translation 
)
static

Definition at line 269 of file AP_codon_table.cxx.

References AWT_MAX_CODONS, and length.

Referenced by AP_initialize_codon_tables().

void AP_initialize_codon_tables ( )
int dna2idx ( char  c)
inline

Definition at line 358 of file AP_codon_table.cxx.

Referenced by calc_codon_nr().

char idx2dna ( int  idx)
inline

Definition at line 369 of file AP_codon_table.cxx.

References pn_assert.

Referenced by build_codon().

int calc_codon_nr ( const char dna)
inline

Definition at line 374 of file AP_codon_table.cxx.

References AWT_MAX_CODONS, dna2idx(), and pn_assert.

Referenced by AWT_is_codon(), and AWT_translator::isStartOrStopCodon().

void build_codon ( int  codon_nr,
char to_buffer 
)
inline

Definition at line 384 of file AP_codon_table.cxx.

References AWT_MAX_CODONS, idx2dna(), and pn_assert.

Referenced by Codon_Group::expand().

const char* AWT_get_codon_code_name ( int  code)
const char* getAminoAcidAbbr ( char  aa)

Definition at line 427 of file AP_codon_table.cxx.

References NULp.

Referenced by TranslateGeneToAminoAcidSequence().

char isStartOrStopCodonNr ( int  codon_nr,
int  code_nr 
)
inline
bool protMatches ( char  p1,
char  p2 
)
inline

return true if p1 matches p2

Parameters
p1"normal" protein (neither B, Z nor J)
p2any protein (B, Z and J ok) B is a shortcut for Asp(=D) or Asn(=N) J is a shortcut for Ile(=I) or Leu(=L) Z is a shortcut for Glu(=E) or Gln(=Q)

Definition at line 546 of file AP_codon_table.cxx.

References pn_assert.

Referenced by AWT_is_codon().

bool containsProtMatching ( const char pstr,
char  p 
)
inline

return true, if 'pstr' contains any protein that matches 'p'. uses same logic as protMatches()

Definition at line 564 of file AP_codon_table.cxx.

References pn_assert.

Referenced by AWT_is_codon().

bool isGap ( char  c)
inline

Definition at line 574 of file AP_codon_table.cxx.

References GAP::is_std_gap().

Referenced by AWT_is_codon().

GB_ERROR neverTranslatesError ( const char dna,
char  protein 
)
inline

Definition at line 576 of file AP_codon_table.cxx.

References GBS_global_string(), and VALID_PROTEIN.

Referenced by AWT_is_codon().

bool AWT_is_codon ( char  protein,
const char *const  dna,
const TransTables allowed,
TransTables remaining,
const char **  fail_reason_ptr 
)

test if 'dna' codes 'protein'

Parameters
proteinamino acid
dnathree nucleotides (gaps allowed, e.g. 'A-C' can be tested vs 'X')
allowedallowed translation tables
remainingreturns the remaining allowed translation tables (only if this functions returns true)
fail_reason_ptrif not NULp => store reason for failure here (or set it to NULp on success)
Returns
true if dna translates to protein

Definition at line 583 of file AP_codon_table.cxx.

References TransTables::all(), TransTables::allow(), TransTables::any(), ARB_strBeginsWith(), AWT_CODON_TABLES, AWT_is_codon(), AWT_MAX_CODONS, calc_codon_nr(), codon_tables_initialized, containsProtMatching(), iupac::decode(), TransTables::explicit_table(), TransTables::forbid(), TransTables::forbidAll(), GB_AT_DNA, GBS_global_string(), TransTables::is_allowed(), TransTables::is_subset_of(), isGap(), isStartOrStopCodonNr(), N, neverTranslatesError(), TransTables::none(), NULp, pn_assert, protMatches(), TransTables::to_string(), TTIT_arb2embl(), TTIT_EMBL, and VALID_PROTEIN_NO_X.

Referenced by AWT_is_codon(), AWT_translator::isStartOrStopCodon(), and Distributor::translates_to_Xs().

int legal_dna_no ( int  i)
inline

Definition at line 851 of file AP_codon_table.cxx.

const char* buildMixedCodon ( const char *const  con1,
const char *const  con2 
)
inline

Definition at line 853 of file AP_codon_table.cxx.

References iupac::combine(), GB_AT_DNA, NULp, and pn_assert.

Referenced by expandMore().

static int expandMore ( const char bufferStart,
int  no_of_condons,
char *&  to_buffer 
)
static

Definition at line 891 of file AP_codon_table.cxx.

References buildMixedCodon(), and result.

Referenced by Codon_Group::expand().

static Codon_Group* get_Codon_Group ( char  protein,
int  code_nr 
)
static

Definition at line 960 of file AP_codon_table.cxx.

References AWT_CODON_TABLES, codon_tables_initialized, N, NULp, and pn_assert.

Referenced by AP_get_codons().

const char* AP_get_codons ( char  protein,
int  code_nr 
)

Variable Documentation

Definition at line 42 of file AP_codon_table.cxx.

bool codon_tables_initialized = false
static

Definition at line 265 of file AP_codon_table.cxx.

Referenced by AP_initialize_codon_tables(), AWT_is_codon(), and get_Codon_Group().

char definite_translation[AWT_MAX_CODONS]
static

Definition at line 266 of file AP_codon_table.cxx.

char* ambiguous_codons[AWT_MAX_CODONS]
static

Definition at line 267 of file AP_codon_table.cxx.

const char* aa_3letter_name[26+1]
static
Initial value:
= {
"Ala",
"Asx",
"Cys",
"Asp",
"Glu",
"Phe",
"Gly",
"His",
"Ile",
"Xle",
"Lys",
"Leu",
"Met",
"Asn",
NULp,
"Pro",
"Gln",
"Arg",
"Ser",
"Thr",
NULp,
"Val",
"Trp",
"Xaa",
"Tyr",
"Glx",
NULp
}
#define NULp
Definition: cxxforward.h:116

Definition at line 397 of file AP_codon_table.cxx.