source: tags/arb_5.5/AWT/AWT_seq_simple_pro.cxx

Last change on this file was 5589, checked in by westram, 15 years ago
  • removed initialization-calls for removed global variable 'awt_pro_a_nucs'
  • Added replacement class AWT_translator (some instances are cached internally)
  • protein code_nr is now explicitely passed to AWT_pro_a_nucs_convert(), fixed all calls This makes AWT_pro_a_nucs_convert independent from AWAR_PROTEIN_TYPE and no longer requires to initialize any global before using it.
  • warnings about missing 'transl_table' / 'codon_start' now uses '1..n', instead of internal index '0..n-1'
  • Translate sequences:
    • fixed counting of species w/o 'transl_table' or 'codon_start'. Did as well count species which had no data in selected alignment.
    • fallback for 'transl_table' now is table selected in translation window (was always 0)
    • print number of taxa without data (in handled alignment)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#include <stdio.h>
2#include <memory.h>
3#include <string.h>
4
5#include <arbdb.h>
6#include <arbdbt.h>
7#include <awt_tree.hxx>
8#include "awt_seq_simple_pro.hxx"
9
10#define awt_assert(bed) arb_assert(bed)
11
12AP_sequence_simple_protein::AP_sequence_simple_protein(AP_tree_root *rooti) : AP_sequence(rooti) {
13    sequence = 0;
14}
15
16AP_sequence_simple_protein::~AP_sequence_simple_protein(void) {
17    delete sequence;
18    sequence = 0;
19}
20
21AP_sequence *AP_sequence_simple_protein::dup(void) {
22    return new AP_sequence_simple_protein(root);
23}
24
25
26
27void AP_sequence_simple_protein::set(const char *isequence) {
28    const char    *s;
29    unsigned char  c;
30    ap_pro        *d;
31
32    AWT_translator *translator = AWT_get_user_translator(this->root->gb_main);
33
34    const struct arb_r2a_pro_2_nuc * const *s2str = translator->S2strArray();
35    sequence_len = root->filter->real_len;
36    sequence = new ap_pro[sequence_len+1];
37    memset(sequence,s2str['.']->index,(size_t)(sizeof(ap_pro) * sequence_len));
38    s = isequence;
39    d = sequence;
40    const uchar *simplify = root->filter->simplify;
41    int sindex = s2str['s']->index;
42    if (root->filter->bootstrap){
43        int iseqlen = strlen(isequence);
44        int i;
45        for (i=root->filter->real_len-1;i>=0;i--){
46            int pos = root->filter->bootstrap[i];
47            if (pos >= iseqlen) continue;
48            c = s[pos];
49            if (! (s2str[c] ) ) {   // unknown character
50                continue;
51            }
52            int ind = s2str[simplify[c]]->index;
53            if (ind >= sindex) ind --;
54            d[i] = ind;
55        }
56    }else{
57        char *f = root->filter->filter_mask;
58        int i = root->filter->filter_len;
59        while ( (c = (*s++)) ) {
60            if (!i) break;
61            i--;
62            if (*(f++)) {
63                if (! (s2str[c] ) ) {   // unknown character
64                    d++;
65                    continue;
66                }
67                int ind = s2str[simplify[c]]->index;
68                if (ind >= sindex) ind --;
69                *(d++) = ind;
70            }
71        }
72    }
73    is_set_flag = AP_TRUE;
74    cashed_real_len = -1.0;
75}
76
77AP_FLOAT AP_sequence_simple_protein::combine( const AP_sequence *, const AP_sequence *) {
78    return 0.0;
79}
80
81void AP_sequence_simple_protein::partial_match(const AP_sequence* /*part*/, long */*overlap*/, long */*penalty*/) const {
82    awt_assert(0); // should be unused
83}
84
85
86
Note: See TracBrowser for help on using the repository browser.