11 #ifndef ALI_SOLUTION_HXX
12 #define ALI_SOLUTION_HXX
14 #ifndef ALI_PROFILE_HXX
19 unsigned long first_seq_base, last_seq_base;
20 unsigned long first_ref_base, last_ref_base;
22 unsigned char **inserted;
23 unsigned char **undefined;
24 unsigned long insert_counter;
26 ALI_MAP(
unsigned long first_seq_base,
unsigned long last_seq_base,
27 unsigned long first_ref_base,
unsigned long last_ref_base);
31 free((
char *) mapping);
33 free((
char *) inserted);
35 free((
char *) undefined);
38 return first_seq_base;
44 return first_ref_base;
50 void set(
unsigned long base,
unsigned long pos,
int insert = -1) {
53 if (base < first_seq_base || base > last_seq_base)
56 if (pos > last_ref_base - first_ref_base)
59 b = base - first_seq_base;
61 (*undefined)[b/8] &= (
unsigned char) ~(0x01<<(7-(b%8)));
64 if ((*inserted)[b/8]>>(7-(b%8)) & 0x01) {
65 if (insert_counter > 0)
70 (*inserted)[b/8] &= (
unsigned char) ~(0x01<<(7-(b%8)));
74 if (!((*inserted)[b/8]>>(7-(b%8)) & 0x01)) {
75 (*inserted)[b/8] |= (
unsigned char) (0x01<<(7-(b%8)));
81 if (base < first_seq_base || base > last_seq_base)
83 return (*mapping)[base - first_seq_base];
86 return insert_counter;
90 if (base < first_seq_base && base > last_seq_base)
92 b = base - first_seq_base;
93 if (((*inserted)[b/8]>>(7-(b%8))) & 0x01)
100 if (base < first_seq_base && base > last_seq_base)
102 b = base - first_seq_base;
103 (*undefined)[b/8] |= (
unsigned char) (0x01<<(7-(b%8)));
107 if (base < first_seq_base && base > last_seq_base)
109 b = base - first_seq_base;
110 (*undefined)[b/8] &= (
unsigned char) ~(0x01<<(7-(b%8)));
114 if (base < first_seq_base && base > last_seq_base)
116 b = base - first_seq_base;
117 if (((*undefined)[b/8]>>(7-(b%8))) & 0x01)
124 for (b = first_seq_base; b <= last_seq_base; b++)
133 if (first_seq_base != map->first_seq_base ||
134 last_seq_base != map->last_seq_base ||
135 first_ref_base != map->first_ref_base ||
136 last_ref_base != map->last_ref_base)
138 for (i = 0; i < last_seq_base - first_seq_base + 1; i++)
139 if ((*mapping)[i] != (*map->mapping)[i])
141 for (i = 0; i < ((last_seq_base - first_seq_base) / 8) + 1; i++)
142 if ((*inserted)[i] != (*map->inserted)[i])
152 printf(
"Map: Bases %ld to %ld, Positions %ld to %ld\n",
153 first_seq_base, last_seq_base, first_ref_base, last_ref_base);
154 printf(
"Undefined : ");
155 for (i = first_seq_base; i <= last_seq_base; i++)
182 unsigned long *start_ref,
unsigned long *end_ref,
183 unsigned long area_number = 0);
193 #error ali_solution.hxx included twice
194 #endif // ALI_SOLUTION_HXX
long position(unsigned long base)
void unundefine(unsigned long base)
ALI_MAP(unsigned long first_seq_base, unsigned long last_seq_base, unsigned long first_ref_base, unsigned long last_ref_base)
unsigned long first_base()
unsigned long first_reference_base()
int is_undefined(unsigned long base)
static HelixNrInfo * start
int is_konsistent(ALI_MAP *map)
int free_area(unsigned long *start, unsigned long *end, unsigned long *start_ref, unsigned long *end_ref, unsigned long area_number=0)
int is_equal(ALI_MAP *map)
ALI_SEQUENCE * sequence_without_inserts(ALI_NORM_SEQUENCE *ref_seq)
ALI_MAP * inverse_without_inserts()
void set(unsigned long base, unsigned long pos, int insert=-1)
unsigned long last_reference_base()
unsigned long insertations()
ALI_SUB_SOLUTION(ALI_PROFILE *prof, ALI_MAP *map)
void ali_fatal_error(const char *message, const char *func)
unsigned long number_of_free_areas()
ALI_SUB_SOLUTION(ALI_PROFILE *prof)
int is_inserted(unsigned long base)
int delete_map(ALI_MAP *map)
unsigned long last_base()
void undefine(unsigned long base)
ALI_SEQUENCE * sequence(ALI_NORM_SEQUENCE *ref_seq)