36 memcpy(startCodon, gene_seq, 3);
39 int arb_transl_table, codon_start;
42 if (arb_transl_table == -1) arb_transl_table =
TTIT_embl2arb(1);
43 if (codon_start == -1) codon_start = 0;
45 if (!error)
translate_nuc2aa(arb_transl_table, gene_seq, gene_length, codon_start,
false,
true,
true, &translated_length);
78 char *add_note =
NULp;
81 #define set_result_bit(s) result = GEN_remove_state(result|s)
85 int translated_length;
88 if (!generated || translated_length<1) {
95 if (generated[translated_length-1] ==
'*') {
96 generated[--translated_length] = 0;
102 if (strcmp(generated+1, original+1) == 0) {
103 if (generated[0] == original[0]) {
108 remove = ignore_start_codon_error;
113 const char *to_remove[] = {
116 "ARB_translation_note",
121 int failed_field = -1;
123 for (
int r = 0; to_remove[r] && !err; ++r) {
127 if (err) failed_field = r;
130 if (err) error =
GBS_global_string(
"Failed to delete field '%s' (%s)", to_remove[failed_field], err);
144 if (add_note && !error) {
154 #undef set_result_bit
160 int wrong_start_codon = 0;
165 const int possibleCodons = 4*4*4;
170 for (
int Try = 0; Try <= retry && !
error; Try++) {
194 AW_repeated_question* q = ok_to_ignore_wrong_start_codon;
196 if (q->get_answer(
"only_start_codon_differs",
197 "Translation differs only in start codon",
198 "Ignore and remove,Keep translation",
"all",
false) == 0) {
221 if (!error && failed>0) {
222 warn(cd,
GBS_global_string(
"%i translations could not be reproduced by ARB", failed));
223 static bool first_warning =
true;
226 "Note: Reproducible translations were removed from database.\n"
227 " Failed translations were left in database and an additional\n"
228 " field 'ARB_translation' was added.");
231 first_warning =
false;
233 if (wrong_start_codon>0) {
235 warn(cd,
GBS_global_string(
"- %i translations had wrong start codon (%s)", wrong_start_codon, codonInfo));
239 warn(cd,
GBS_global_string(
"- %i ARB_translation_note entries were generated. Please examine!", note_added));
static GEN_remove_state remove_redundant_translation(GBDATA *gb_gene, bool ignore_start_codon_error, char *errornousCodon, GB_ERROR &error)
long GBS_incr_hash(GB_HASH *hs, const char *key)
GBDATA * GB_nextEntry(GBDATA *entry)
GB_ERROR GEN_testAndRemoveTranslations(GBDATA *gb_gene_data, void(*warn)(AW_CL cd, const char *msg), AW_CL cd, AW_repeated_question *ok_to_ignore_wrong_start_codon)
const char * GBS_global_string(const char *templat,...)
void GBS_free_hash(GB_HASH *hs)
GB_ERROR GB_delete(GBDATA *&source)
int TTIT_embl2arb(int embl_code_nr)
GB_ERROR GB_await_error()
int translate_nuc2aa(int arb_code_nr, char *data, size_t size, size_t pos, bool translate_all, bool create_start_codon, bool append_stop_codon, int *translatedSize)
static void error(const char *msg)
static char * translate_gene_sequence(GBDATA *gb_gene, GB_ERROR &error, int &translated_length, char *startCodon)
GB_ERROR translate_getInfo(GBDATA *gb_item, int &arb_transl_table, int &codon_start)
GB_ERROR GBT_write_byte(GBDATA *gb_container, const char *fieldpath, unsigned char content)
char * GBS_hashtab_2_string(const GB_HASH *hash)
#define set_result_bit(s)
GB_ERROR GBT_write_string(GBDATA *gb_container, const char *fieldpath, const char *content)
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
NOT4PERL char * GBT_read_gene_sequence_and_length(GBDATA *gb_gene, bool use_revComplement, char partSeparator, size_t *gene_length)
GBDATA * GB_entry(GBDATA *father, const char *key)
char * GBS_global_string_copy(const char *templat,...)
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)