source: branches/port5/NALIGNER/ali_genseq.hxx

Last change on this file was 4912, checked in by westram, 18 years ago
  • untabified + indented
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.1 KB
Line 
1
2
3#ifndef _GENSEQ_INC_
4#define _GENSEQ_INC_
5
6class ALI_GENSEQ {
7    unsigned long sequence_len;
8    unsigned char (*sequence)[];
9
10public:
11    ALI_GENSEQ() {
12        sequence_len = 0;
13        sequence = 0;
14    }
15    ALI_GENSEQ(char *seq) {
16        sequence_len = strlen(seq);
17        sequence = (unsigned char (*)[]) strdup(seq);
18    }
19    ~ALI_GENSEQ() {
20        if (sequence != 0) 
21            free(sequence);
22    }
23    const unsigned long length() {
24        return sequence_len;
25    }
26    char *const string() {
27        return (char *) sequence;
28    }
29};
30
31
32class ALI_NORM_GENSEQ {
33    unsigned long num_of_bases;
34    unsigned char (*bases)[];
35    unsigned char (*start_pos)[];
36
37    int is_base(char b);
38    int is_base(int b);
39    int normalize_base(char b);
40    unsigned long number_of_bases(char *seq);
41public:
42    ALI_NORM_GENSEQ(char *a);
43    ALI_NORM_GENSEQ(ALI_GENSEQ &a);
44
45    int is_start(unsigned long pos) {
46        if (pos > num_of_bases) 
47            return 0;
48        if ((*start_pos)[(pos/8)] & 1<<(7-(pos%8)))
49            return 1;
50        return 0;
51    }
52};
53
Note: See TracBrowser for help on using the repository browser.