27 #define id_assert(cond) arb_assert(cond)
55 return t1<t2 ? -1 : (t1>t2 ? 1 : 0);
73 virtual size_t unitsize()
const = 0;
74 virtual bool has_slice()
const = 0;
89 virtual int operate_on_mem(
void *mem,
size_t start,
size_t count, memop op)
const = 0;
90 virtual int cmp_data(
size_t start,
const AliData& other,
size_t ostart,
size_t count)
const = 0;
92 void copyPartTo(
void *mem,
size_t start,
size_t count)
const { operate_on_mem(mem, start, count, COPY_TO); }
95 return operate_on_mem(const_cast<void*>(mem), start, count, COMPARE_WITH);
101 id_assert(correlated(forbidden, op_error));
105 virtual UnitPtr unit_left_of(
size_t pos)
const = 0;
106 virtual UnitPtr unit_right_of(
size_t pos)
const = 0;
111 size_t elems()
const {
return size; }
112 size_t memsize()
const {
return unitsize()*elems(); }
113 void copyTo(
void *mem)
const { copyPartTo(mem, 0, elems()); }
114 bool empty()
const {
return !elems(); }
125 if (&other ==
this)
return true;
126 if (elems() != other.
elems())
return false;
128 return cmp_whole_data(other) == 0;
136 return is_valid_between(start) && is_valid_between(start+count);
148 static int fix_amount(
AliDataPtr from,
size_t offset,
size_t amount) {
150 size_t from_size = from->
elems();
151 if (offset>from_size) {
155 size_t last_pos = offset+amount-1;
156 size_t last_from = from->
elems()-1;
158 if (last_pos > last_from) {
160 amount = last_from-offset+1;
168 :
AliData(fix_amount(from_, offset_, amount_)),
177 return (offset == 0 && amount >= from->
elems())
207 id_assert(other.is_valid_part(ostart, count));
218 :
AliData(l->elems()+r->elems()),
221 hasSlice(left->has_slice() || right->has_slice())
223 id_assert(l->unitsize() == r->unitsize());
229 void *inc_by_units(
void *mem,
size_t units)
const {
return reinterpret_cast<char*
>(mem)+units*unitsize(); }
236 return left->create_gap(gapsize, gapinfo);
239 size_t left_elems = left->elems();
241 if (left_elems <=
start) {
245 size_t pos_behind =
start+count;
246 if (left_elems >= pos_behind) {
250 size_t take_left = left_elems-
start;
251 size_t take_right = count-take_left;
253 return new ComposedAliData(
259 size_t left_elems = left->elems();
260 size_t take_left = 0;
262 if (
start<left_elems) {
263 take_left =
min(count, left_elems-
start);
264 res = left->operate_on_mem(mem,
start, take_left, op);
268 size_t take_right = count-take_left;
270 size_t rstart =
start>left_elems ?
start-left_elems : 0;
271 id_assert(right->is_valid_part(rstart, take_right));
272 res = right->operate_on_mem(inc_by_units(mem, take_left), rstart, take_right, op);
278 size_t left_elems = left->elems();
279 size_t take_left = 0;
281 if (
start<left_elems) {
282 take_left =
min(count, left_elems-
start);
283 cmp = left->cmp_data(
start, other, ostart, take_left);
287 size_t take_right = count-take_left;
289 size_t rstart =
start>left_elems ?
start-left_elems : 0;
290 size_t rostart = ostart+take_left;
292 id_assert(is_valid_part(rstart, take_right));
293 id_assert(other.is_valid_part(rostart, take_right));
295 cmp = right->cmp_data(rstart, other, rostart, take_right);
303 if (left->elems() == pos) {
305 return left->unit_right_of(pos-1);
307 else if (left->elems() < pos) {
308 return right->unit_left_of(pos-left->elems());
311 return left->unit_left_of(pos);
316 if (left->elems() == pos) {
318 return right->unit_left_of(0);
320 else if (left->elems() < pos) {
321 return right->unit_right_of(pos-left->elems());
324 return left->unit_right_of(pos);
334 void init(
bool val) {
335 for (
int i = 0; i<256; ++i) {
344 case ANYTHING:
init(
true);
break;
350 for (
int i = 0; allowed[i]; ++i) {
358 size_t end = start+count-1;
359 for (
size_t col = start; col <= end && !
error; ++col) {
361 error =
GBS_global_string(
"You tried to delete '%c' at position %zu -> Operation aborted", data[col], col);
389 virtual UnitPtr at_ptr(
size_t pos)
const = 0;
392 GBK_terminate(
"logic error: slice_down called for explicit TypedAliData");
396 return at_ptr(pos-1);
409 : BaseType(gapsize, gap_)
415 T *typedMem = (
T*)mem;
416 for (
size_t a = 0; a<count; ++a) {
417 typedMem[a] = BaseType::std_gap();
422 const T *typedMem = (
const T*)mem;
423 for (
size_t a = 0; a<count; ++a) {
440 return -other.cmp_data(ostart, *
this,
start, count);
443 if (pos<BaseType::elems())
return UnitPtr(BaseType::std_gap_ptr());
448 template <
typename T>
454 bool allows_oversize;
458 : allows_oversize(allows_oversize_),
459 org_ali_size(ali_size_)
463 size_t allowed_size = new_ali_size;
464 if (allows_oversize && term_size>org_ali_size) {
465 size_t oversize = term_size-org_ali_size;
466 allowed_size = new_ali_size+oversize;
491 : BaseType(elements, gap_),
494 deletable(deletable_)
502 size_t msize = BaseType::unitsize()*count;
504 memcpy(mem, data+
start, msize);
508 const T *typedMem = (
const T*)mem;
509 for (
size_t a = 0; a<count; ++a) {
516 const T *typedMem = (
const T*)data;
519 BaseType::set_error(error);
530 id_assert(other.is_valid_part(ostart, count));
533 return -other.cmpPartWith(data+
start, ostart, count);
536 if (pos<BaseType::elems())
return UnitPtr(&data[pos]);
545 char preferred_gap(
const char *s1,
const char *s2)
const {
547 if (*s1 == std_gap() || *s2 == std_gap()) {
550 if (*s1 == dot || *s2 == dot) {
557 return *s1 == std_gap() ? std_gap() :
dot;
561 return *s2 == std_gap() ? std_gap() :
dot;
576 char use = preferred_gap(typed_ptr(gapinfo.left), typed_ptr(gapinfo.right));
585 return left->empty() ? right : (right->empty() ? left :
new ComposedAliData(left, right));
596 error = from->check_delete_allowed(pos, amount);
608 gapinfo.
left = data->unit_left_of(pos);
609 gapinfo.
right = data->unit_right_of(pos);
611 AliDataPtr gap = data->create_gap(count, gapinfo);
616 size_t curr_len = data->elems();
617 if (curr_len < wanted_len) {
618 data =
insert_gap(data, curr_len, wanted_len-curr_len);
620 else if (curr_len > wanted_len) {
621 data =
delete_from(data, wanted_len, curr_len-wanted_len, error);
643 inline T*& copyof(
const T* const_data,
size_t elemsize,
size_t elements) {
646 size_t memsize = elemsize*elements;
648 copy = (
T*)ARB_alloc<char>(memsize);
650 memcpy(copy, const_data, memsize);
654 #define COPYOF(typedarray) copyof(typedarray, sizeof(*(typedarray)), ARRAY_ELEMS(typedarray))
655 #define SIZEOF(typedarray) (sizeof(*(typedarray))*ARRAY_ELEMS(typedarray))
657 #define TEST_EXPECT_COPIES_EQUAL(d1,d2) do{ \
658 size_t s1 = (d1)->memsize(); \
659 size_t s2 = (d2)->memsize(); \
660 TEST_EXPECT_EQUAL(s1, s2); \
661 void *copy1 = ARB_alloc<char>(s1+s2); \
662 void *copy2 = reinterpret_cast<char*>(copy1)+s1; \
663 (d1)->copyTo(copy1); \
664 (d2)->copyTo(copy2); \
665 TEST_EXPECT_MEM_EQUAL(copy1, copy2, s1); \
669 #define TEST_EXPECT_COPY_EQUALS_ARRAY(adp,typedarray,asize) do{ \
670 size_t size = (adp)->memsize(); \
671 TEST_EXPECT_EQUAL(size, asize); \
672 void *ad_copy = ARB_alloc<char*>(size); \
673 (adp)->copyTo(ad_copy); \
674 TEST_EXPECT_MEM_EQUAL(ad_copy, typedarray, size); \
678 #define TEST_EXPECT_COPY_EQUALS_STRING(adp,str) do{ \
679 size_t size = (adp)->memsize(); \
680 char *ad_copy = ARB_alloc<char>(size+1); \
681 (adp)->copyTo(ad_copy); \
683 TEST_EXPECT_EQUAL(ad_copy, str); \
687 #if defined(ENABLE_CRASH_TESTS) && defined(ASSERTION_USED)
688 static void illegal_alidata_composition() {
691 int *i = ARB_alloc<int> (ELEMS);
692 char *c = ARB_alloc<char>(ELEMS);
698 void TEST_illegal_alidata__crashtest() {
702 template <
typename T>
705 size_t size = d->memsize();
706 T *copy = (
T*)ARB_alloc<char>(size);
711 template <
typename T>
713 int brute_force_compare = 0;
715 int minSize =
std::min(d1->elems(), d2->elems());
717 T *copy1 = makeCopy<T>(d1);
718 T *copy2 = makeCopy<T>(d2);
720 for (
int i = 0; i < minSize && brute_force_compare == 0; ++i) {
724 if (brute_force_compare == 0) {
725 brute_force_compare =
compare_type(d1->elems(), d2->elems());
732 int smart_forward_compare = d1->cmp_whole_data(*d2);
733 int smart_backward_compare = d2->cmp_whole_data(*d1);
742 return all().ofgroup(expected);
745 #define TEST_COMPARE_WORKS(d1,d2,expected) TEST_EXPECTATION(compare_works<char>(d1,d2,expected))
747 #define TEST_COMPARE_WORKS_ALL_TYPES(tid,d1,d2,expected) \
749 case 0: TEST_EXPECTATION(compare_works<char>(d1,d2,expected)); break; \
750 case 1: TEST_EXPECTATION(compare_works<GB_UINT4>(d1,d2,expected)); break; \
751 case 2: TEST_EXPECTATION(compare_works<float>(d1,d2,expected)); break; \
754 #if !defined(ENABLE_CRASH_TESTS)
755 static void avoid_INVALID_testExport() { avoid_INVALID_testExport(); }
759 #define SEQDATA "CGCAC-C-GG-C-GG.A.-C------GG-.C..UCAGU"
760 char chr_src[] = SEQDATA;
761 GB_CUINT4 int_src[] = { 0x01, 0x1213, 0x242526, 0x37383930, 0xffffffff };
762 float flt_src[] = { 0.0, 0.5, 1.0, -5.0, 20.1 };
769 TEST_EXPECT_COPY_EQUALS_ARRAY(type[0], chr_src, SIZEOF(chr_src)-1);
770 TEST_EXPECT_COPY_EQUALS_STRING(type[0], chr_src);
771 TEST_EXPECT_COPY_EQUALS_ARRAY(type[1], int_src, SIZEOF(int_src));
772 TEST_EXPECT_COPY_EQUALS_ARRAY(type[2], flt_src, SIZEOF(flt_src));
786 TEST_EXPECT_COPIES_EQUAL(
concat(start, mid, end), data);
792 TEST_EXPECT_COPIES_EQUAL(
concat(start, end), del);
797 TEST_EXPECT_COPIES_EQUAL(data,
concat(data, empty));
798 TEST_EXPECT_COPIES_EQUAL(data,
concat(empty, data));
799 TEST_EXPECT_COPIES_EQUAL(empty,
concat(empty, empty));
803 TEST_EXPECT_COPIES_EQUAL(start, del_rest);
806 TEST_EXPECT_COPIES_EQUAL(data, ins);
807 TEST_EXPECT_COPIES_EQUAL(del,
delete_from(ins, 3, 1, error));
810 TEST_EXPECT_COPIES_EQUAL(
insert_at(del, 3, empty), del);
811 TEST_EXPECT_COPIES_EQUAL(
insert_at(del, 777, empty), del);
812 TEST_EXPECT_COPIES_EQUAL(
insert_at(start, 777, end), del);
819 TEST_EXPECT_COPIES_EQUAL(ins_gap,
insert_gap(ins_gap, 7, 0));
836 TEST_EXPECT_COPY_EQUALS_STRING(start,
"CGC");
837 TEST_EXPECT_COPY_EQUALS_STRING(end,
"C-C-GG-C-GG.A.-C------GG-.C..UCAGU");
838 TEST_EXPECT_COPY_EQUALS_STRING(end_gap2,
"C-C-GG-C-GG.A.-C------GG-.C..UCAGU..");
839 TEST_EXPECT_COPY_EQUALS_STRING(mid,
"A");
840 TEST_EXPECT_COPY_EQUALS_STRING(end_gap1,
"A-");
841 TEST_EXPECT_COPY_EQUALS_STRING(del,
"CGCC-C-GG-C-GG.A.-C------GG-.C..UCAGU");
842 TEST_EXPECT_COPY_EQUALS_STRING(del_rest,
"CGC");
843 TEST_EXPECT_COPY_EQUALS_STRING(ins,
"CGCAC-C-GG-C-GG.A.-C------GG-.C..UCAGU");
844 TEST_EXPECT_COPY_EQUALS_STRING(gap_iseq,
"-----");
845 TEST_EXPECT_COPY_EQUALS_STRING(gap_iempty,
".....");
846 TEST_EXPECT_COPY_EQUALS_STRING(gap_in_gap,
".......");
847 TEST_EXPECT_COPY_EQUALS_STRING(ins_gap,
"CGCC------C-GG-C-GG.A.-C------GG-.C..UCAGU");
848 TEST_EXPECT_COPY_EQUALS_STRING(start_gap1,
".CGCC------C-GG-C-GG.A.-C------GG-.C..UCAGU");
849 TEST_EXPECT_COPY_EQUALS_STRING(start_gap3,
"...CGCC------C-GG-C-GG.A.-C------GG-.C..UCAGU");
858 TEST_EXPECT_COPY_EQUALS_STRING(ins,
"CGCAC-C-GG-C-GG.A.-C------GG-.C..UCAGU");
859 TEST_EXPECT_COPY_EQUALS_STRING(bef_dot,
"CGCAC-C-GG-C-GG...A.-C------GG-.C..UCAGU");
860 TEST_EXPECT_COPY_EQUALS_STRING(aft_dot,
"CGCAC-C-GG-C-GG...A.-C------GG-.C..UCAGU");
861 TEST_EXPECT_COPY_EQUALS_STRING(bet_dots,
"CGCAC-C-GG-C-GG.A.-C------GG-.C....UCAGU");
862 TEST_EXPECT_COPY_EQUALS_STRING(bet_dashes,
"CGCAC-C-GG-C-GG.A.-C--------GG-.C..UCAGU");
863 TEST_EXPECT_COPY_EQUALS_STRING(bet_dashdot,
"CGCAC-C-GG-C-GG.A.-C------GG---.C..UCAGU");
864 TEST_EXPECT_COPY_EQUALS_STRING(bet_dotdash,
"CGCAC-C-GG-C-GG.A.---C------GG-.C..UCAGU");
871 TEST_COMPARE_WORKS(start_gap1, same_as_start_gap1, 0);
873 TEST_EXPECT(start_gap1->differs_from(*start_gap3));
880 TEST_COMPARE_WORKS(end, end_gap2, -1);
887 TEST_COMPARE_WORKS_ALL_TYPES(t, start_gap1, start_gap3, 1);
888 TEST_COMPARE_WORKS_ALL_TYPES(t, gap_iempty, gap_in_gap, -1);
889 TEST_COMPARE_WORKS_ALL_TYPES(t, del, ins, 1);
890 TEST_COMPARE_WORKS_ALL_TYPES(t,
partof(ins_gap, 0, 17),
partof(start_gap3, 3, 17), 0);
891 TEST_COMPARE_WORKS_ALL_TYPES(t, start_gap3, start_gap3, 0);
917 Alignment(
const char *name_,
size_t len_) : name(strdup(name_)), len(len_) {}
946 error = apply_recursive(gb_child, term_type, item_name, ali);
950 error = apply_to_terminal(gb_data, term_type, item_name, ali);
961 for (gb_item =
GB_entry(gb_item_data, item_field);
968 error = apply_recursive(gb_ali, term_type, item_name, ali);
969 if (error) error =
GBS_global_string(
"%s '%s': %s", targetTypeName[term_type], item_name, error);
982 if (item_count<1) item_count = 1;
985 for (gb_item =
GB_entry(gb_ali,
"struct");
1012 mutable size_t count;
1024 virtual GB_ERROR check_applicable_to(
const Alignment& ali,
size_t& resulting_ali_length)
const = 0;
1036 return GBS_global_string(
"Can't insert at position %zu (exceeds length %zu of alignment '%s')",
1039 resulting_ali_length = len+amount;
1055 size_t end_pos = pos+amount-1;
1056 if (end_pos >= len) {
1057 return GBS_global_string(
"Can't delete positions %zu-%zu (exceeds max. position %zu of alignment '%s')",
1058 pos, end_pos, len-1, ali.
get_name());
1060 resulting_ali_length = len-amount;
1077 return format(to, allowed_size, error);
1081 resulting_ali_length = wanted_len;
1090 return cmd->apply(to, error);
1093 cmd =
new AliFormatCommand(ali.
get_len());
1094 return cmd->check_applicable_to(ali, resulting_ali_length);
1109 if (!error) tmp = second->
apply(tmp, error);
1129 mutable size_t modified_counter;
1139 bool shall = key[0] !=
'_';
1140 if (!shall) shall = term_type ==
IDT_SAI && strcmp(key,
"_REF") == 0;
1146 deletable(deletable_),
1147 progress(progress_title, progress_count),
1163 freenull(insDelBuffer);
1167 if (!insDelBuffer) {
1168 insDelBuffer_size = neededSpace+10;
1196 if (loaded.
isNull()) load_data();
1204 term_type(term_type_),
1211 return loaded_data()->unitsize();
1214 id_assert(loaded_data()->has_slice() ==
false);
1219 int cmp_data(
size_t start,
const AliData& other,
size_t ostart,
size_t count)
const OVERRIDE {
return loaded_data()->cmp_data(start, other, ostart, count); }
1226 GBK_terminate(
"logic error: slice_down called for explicit LazyAliData");
1229 void load_data()
const;
1237 const char *item_name;
1242 bool has_key(
const char *expected_key)
const {
1245 bool has_name(
const char *expected_name)
const {
1246 return strcmp(item_name, expected_name) == 0;
1253 (term_type ==
IDT_SAI && has_key(
"_REF")));
1259 (has_name(
"HELIX") || has_name(
"HELIX_NR")) &&
1263 bool does_allow_oversize(
TerminalType term_type)
const {
return is_ref(term_type); }
1264 char get_std_string_gaptype(
TerminalType term_type)
const {
1265 bool prefers_dots = is_ref(term_type) || is_helix(term_type);
1266 return prefers_dots ?
'.' :
'-';
1275 char stdgap = get_std_string_gaptype(term_type);
1277 else data =
new SequenceAliData(s, size_, stdgap,
'.', oversizable, deletable);
1320 : gb_data(gb_data_),
1322 item_name(item_name_),
1323 deletable(deletable_),
1327 data =
new LazyAliData(oversizable, size_, term_type, *
this);
1337 size_t modified_elems = modified_data->
elems();
1341 id_assert(strlen(modified) == modified_elems);
1353 if (!error) did_modify =
true;
1361 loaded = terminal.load_data(*
this, elems(), term_type);
1368 if (shall_edit(gb_data, term_type)) {
1371 bool terminal_was_modified;
1372 error = edited.apply(edit_command(), terminal_was_modified);
1373 if (terminal_was_modified) {
1378 progress.inc_and_check_user_abort(error);
1401 ? ( strchr(deletable_chars,
'%')
1403 : Deletable(deletable_chars))
1419 size_t resulting_ali_length;
1423 if (!error) error =
GB_write_int(gb_len, resulting_ali_length);
1472 const char *description =
NULp;
1477 description =
"Deleting columns";
1481 description =
"Inserting columns";
1498 if (ranges.
empty()) {
1499 error =
"Done with deleting nothing :)";
1523 if (!amount || ranges.
empty()) {
1524 error =
"Done with inserting no gaps :)";
1533 case INFRONTOF: pos = r->start();
break;
1534 case BEHIND: pos = r->end()+1;
break;
1540 for (
int pos = r->end(); pos >= r->start(); --pos) {
1556 bool is_ali_rel =
false;
1558 if (type !=
GB_DB) {
1562 if (strncmp(ali_key,
"ali_", 4) == 0) {
1566 bool is_species = strcmp(item_key,
"species") == 0;
1567 if (is_species || strcmp(item_key,
"extended") == 0) {
1587 #define PLAIN_APPLY_CMD(str,cmd) \
1588 size_t str_len = strlen(str); \
1589 AliDataPtr data = new SequenceAliData(str, str_len, '-', '.', dontAllowOversize(str_len), Deletable("-.")); \
1590 GB_ERROR error = NULp; \
1591 AliDataPtr mod = cmd.apply(data, error)
1593 #define APPLY_CMD(str,cmd) \
1594 PLAIN_APPLY_CMD(str, cmd); \
1595 TEST_EXPECT_NO_ERROR(error); \
1596 GB_CSTR res = mod->differs_from(*data) ? alidata2buffer(*mod) : NULp
1598 #define DO_FORMAT(str,wanted_len) \
1599 AliFormatCommand cmd(wanted_len); \
1602 #define DO_INSERT(str,pos,amount) \
1603 AliInsertCommand cmd(pos, amount); \
1606 #define DO_FORMAT_AND_INSERT(str,wanted_len,pos,amount) \
1607 AliCompositeCommand cmd(new AliFormatCommand(wanted_len), \
1608 new AliInsertCommand(pos,amount)); \
1611 #define DO_DELETE(str,pos,amount) \
1612 AliDeleteCommand cmd(pos, amount); \
1615 #define TEST_FORMAT(str,wanted_alilen,expected) do { DO_FORMAT(str,wanted_alilen); TEST_EXPECT_EQUAL(res, expected); } while(0)
1616 #define TEST_FORMAT__BROKEN(str,wanted_alilen,expected) do { DO_FORMAT(str,wanted_alilen); TEST_EXPECT_EQUAL__BROKEN(res, expected); } while(0)
1618 #define TEST_INSERT(str,pos,amount,expected) do { DO_INSERT(str,pos,amount); TEST_EXPECT_EQUAL(res, expected); } while(0)
1619 #define TEST_INSERT__BROKEN(str,pos,amount,expected) do { DO_INSERT(str,pos,amount); TEST_EXPECT_EQUAL__BROKEN(res, expected); } while(0)
1621 #define TEST_DELETE(str,pos,amount,expected) do { DO_DELETE(str,pos,amount); TEST_EXPECT_EQUAL(res, expected); } while(0)
1622 #define TEST_DELETE__BROKEN(str,pos,amount,expected) do { DO_DELETE(str,pos,amount); TEST_EXPECT_EQUAL__BROKEN(res, expected); } while(0)
1624 #define TEST_FORMAT_AND_INSERT(str,wanted_alilen,pos,amount,expected) do { DO_FORMAT_AND_INSERT(str,wanted_alilen,pos,amount); TEST_EXPECT_EQUAL(res, expected); } while(0)
1625 #define TEST_FORMAT_AND_INSERT__BROKEN(str,wanted_alilen,pos,amount,expected) do { DO_FORMAT_AND_INSERT(str,wanted_alilen,pos,amount); TEST_EXPECT_EQUAL__BROKEN(res, expected); } while(0)
1627 #define TEST_FORMAT_ERROR(str,wanted_alilen,exp_err) do { \
1628 AliFormatCommand cmd(wanted_alilen); \
1629 PLAIN_APPLY_CMD(str, cmd); \
1630 TEST_EXPECT_ERROR_CONTAINS(error, exp_err); \
1633 #define TEST_DELETE_ERROR(str,pos,amount,exp_err) do { \
1634 AliDeleteCommand cmd(pos, amount); \
1635 PLAIN_APPLY_CMD(str, cmd); \
1636 TEST_EXPECT_ERROR_CONTAINS(error, exp_err); \
1642 void TEST_format_insert_delete() {
1648 const char *UNMODIFIED =
NULp;
1650 TEST_FORMAT(
"xxx", 5,
"xxx..");
1651 TEST_FORMAT(
".x.", 5,
".x...");
1652 TEST_FORMAT(
".x..", 5,
".x...");
1653 TEST_FORMAT(
".x...", 5, UNMODIFIED);
1655 TEST_FORMAT(
"xxx--", 3,
"xxx");
1656 TEST_FORMAT(
"xxx..", 3,
"xxx");
1657 TEST_FORMAT_ERROR(
"xxxxx", 3,
"You tried to delete 'x' at position 3 -> Operation aborted");
1658 TEST_FORMAT_ERROR(
"xxx", 0,
"You tried to delete 'x' at position 0 -> Operation aborted");
1661 TEST_INSERT(
"abcde", 3, 0, UNMODIFIED);
1662 TEST_INSERT(
"abcde", 3, 1,
"abc-de");
1663 TEST_INSERT(
"abcde", 3, 2,
"abc--de");
1665 TEST_DELETE(
"abcde", 3, 0, UNMODIFIED);
1666 TEST_DELETE(
"abc-de", 3, 1,
"abcde");
1667 TEST_DELETE(
"abc--de", 3, 2,
"abcde");
1668 TEST_DELETE_ERROR(
"abc-xde", 3, 2,
"You tried to delete 'x' at position 4 -> Operation aborted");
1671 TEST_INSERT(
"abcde", 5, 1,
"abcde.");
1672 TEST_INSERT(
"abcde", 5, 4,
"abcde....");
1674 TEST_DELETE(
"abcde-", 5, 1,
"abcde");
1675 TEST_DELETE(
"abcde----", 5, 4,
"abcde");
1678 TEST_INSERT(
"abcde", 0, 1,
".abcde");
1679 TEST_INSERT(
"abcde", 0, 4,
"....abcde");
1681 TEST_DELETE(
"-abcde", 0, 1,
"abcde");
1682 TEST_DELETE(
"----abcde", 0, 4,
"abcde");
1685 TEST_FORMAT_AND_INSERT(
"abcde", 10, 8, 1,
"abcde......");
1686 TEST_FORMAT_AND_INSERT(
"abcde", 10, 8, 4,
"abcde.........");
1689 TEST_INSERT(
"", 0, 3,
"...");
1690 TEST_DELETE(
"---", 0, 3,
"");
1697 static struct arb_unit_test::test_alignment_data TADinsdel[] = {
1698 { 1,
"MtnK1722",
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUCACCUCC....." },
1699 { 1,
"MhnFormi",
"---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU....." },
1700 { 1,
"MhnT1916",
"...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU----" },
1703 static struct arb_unit_test::test_alignment_data EXTinsdel[] = {
1704 { 0,
"ECOLI",
"---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCCCACCUGA...." },
1705 { 0,
"HELIX",
".....[<[.........[..[..[<<.[..].>>]....]..]....].>......]" },
1706 { 0,
"HELIX_NR",
".....1.1.........25.25.34..34.34..34...25.25...1........1" },
1709 #define HELIX_REF ".....x..x........x...x.x....x.x....x...x...x...x.........x"
1710 #define HELIX_STRUCT "VERSION=3\nLOOP={etc.pp\n}\n"
1712 static const char *read_item_entry(
GBDATA *gb_item,
const char *ali_name,
const char *entry_name) {
1726 static char *ints2string(
const GB_UINT4 *ints,
size_t count) {
1727 char *
str = ARB_alloc<char>(count+1);
1728 for (
size_t c = 0; c<count; ++c) {
1729 str[c] = (ints[c]<10) ? ints[c]+
'0' :
'?';
1734 static GB_UINT4 *string2ints(
const char *str,
size_t count) {
1735 GB_UINT4 *ints = ARB_alloc<GB_UINT4>(count);
1736 for (
size_t c = 0; c<count; ++c) {
1737 ints[c] =
int(str[c]-
'0');
1741 static char *floats2string(
const float *floats,
size_t count) {
1742 char *str = ARB_alloc<char>(count+1);
1743 for (
size_t c = 0; c<count; ++c) {
1744 str[c] =
char(floats[c]*64.0+0.5)+
' '+1;
1749 static float *string2floats(
const char *str,
size_t count) {
1750 float *floats = ARB_alloc<float>(count);
1751 for (
size_t c = 0; c<count; ++c) {
1752 floats[c] = float(str[c]-
' '-1)/64.0;
1757 static GBDATA *get_ali_entry(
GBDATA *gb_item,
const char *ali_name,
const char *entry_name) {
1761 if (gb_ali) gb_entry =
GB_entry(gb_ali, entry_name);
1766 static char *read_item_ints_entry_as_string(
GBDATA *gb_item,
const char *ali_name,
const char *entry_name) {
1767 char *result =
NULp;
1768 GBDATA *gb_entry = get_ali_entry(gb_item, ali_name, entry_name);
1777 static char *read_item_floats_entry_as_string(
GBDATA *gb_item,
const char *ali_name,
const char *entry_name) {
1778 char *result =
NULp;
1779 GBDATA *gb_entry = get_ali_entry(gb_item, ali_name, entry_name);
1789 #define TEST_ITEM_HAS_ENTRY(find,name,ename,expected) \
1790 TEST_EXPECT_EQUAL(read_item_entry(find(gb_main, name), ali_name, ename), expected)
1792 #define TEST_ITEM_HAS_INTSENTRY(find,name,ename,expected) \
1793 TEST_EXPECT_EQUAL(&*SmartCharPtr(read_item_ints_entry_as_string(find(gb_main, name), ali_name, ename)), expected)
1795 #define TEST_ITEM_HAS_FLOATSENTRY(find,name,ename,expected) \
1796 TEST_EXPECT_EQUAL(&*SmartCharPtr(read_item_floats_entry_as_string(find(gb_main, name), ali_name, ename)), expected)
1798 #define TEST_ITEM_HAS_DATA(find,name,expected) TEST_ITEM_HAS_ENTRY(find,name,"data",expected)
1800 #define TEST_SPECIES_HAS_DATA(ad,sd) TEST_ITEM_HAS_DATA(GBT_find_species,ad.name,sd)
1801 #define TEST_SAI_HAS_DATA(ad,sd) TEST_ITEM_HAS_DATA(GBT_find_SAI,ad.name,sd)
1802 #define TEST_SAI_HAS_ENTRY(ad,ename,sd) TEST_ITEM_HAS_ENTRY(GBT_find_SAI,ad.name,ename,sd)
1804 #define TEST_SPECIES_HAS_INTS(ad,id) TEST_ITEM_HAS_INTSENTRY(GBT_find_species,ad.name,"NN",id)
1805 #define TEST_SPECIES_HAS_FLOATS(ad,fd) TEST_ITEM_HAS_FLOATSENTRY(GBT_find_species,ad.name,"FF",fd)
1807 #define TEST_DATA(sd0,sd1,sd2,ed0,ed1,ed2,ref,ints,floats,struct) do { \
1808 TEST_SPECIES_HAS_DATA(TADinsdel[0], sd0); \
1809 TEST_SPECIES_HAS_DATA(TADinsdel[1], sd1); \
1810 TEST_SPECIES_HAS_DATA(TADinsdel[2], sd2); \
1811 TEST_SAI_HAS_DATA(EXTinsdel[0], ed0); \
1812 TEST_SAI_HAS_DATA(EXTinsdel[1], ed1); \
1813 TEST_SAI_HAS_DATA(EXTinsdel[2], ed2); \
1814 TEST_SAI_HAS_ENTRY(EXTinsdel[1], "_REF", ref); \
1815 GBDATA *gb_ref = GB_search(gb_main, "secedit/structs/ali_mini/struct/ref", GB_FIND); \
1816 TEST_EXPECT_EQUAL(GB_read_char_pntr(gb_ref), ref); \
1817 TEST_SPECIES_HAS_INTS(TADinsdel[0], ints); \
1818 TEST_SPECIES_HAS_FLOATS(TADinsdel[0], floats); \
1819 TEST_SAI_HAS_ENTRY(EXTinsdel[1], "_STRUCT", struct); \
1822 static int get_alignment_aligned(
GBDATA *
gb_main,
const char *aliname) {
1824 return gb_alignment ? *
GBT_read_int(gb_alignment,
"aligned") : -1;
1827 #define TEST_ALI_LEN_ALIGNED(len,aligned) do { \
1828 TEST_EXPECT_EQUAL(GBT_get_alignment_len(gb_main, ali_name), len); \
1829 TEST_EXPECT_EQUAL(get_alignment_aligned(gb_main, ali_name), aligned); \
1832 static ARB_ERROR add_some_SAIs(
GBDATA *gb_main,
const char *ali_name) {
1835 TEST_DB_INSERT_SAI(gb_main, error, ali_name, EXTinsdel);
1859 const char *intsAsStr =
"9346740960354855652100942568200611650200211394358998513";
1860 size_t len = strlen(intsAsStr);
1861 GB_UINT4 *ints = string2ints(intsAsStr, len);
1863 char *asStr = ints2string(ints, len);
1872 const char *floatsAsStr =
"ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uCLDoHlWV59DW";
1873 size_t len = strlen(floatsAsStr);
1874 float *floats = string2floats(floatsAsStr, len);
1876 char *asStr = floats2string(floats, len);
1889 const char *ali_name =
"ali_mini";
1890 GBDATA *gb_main = TEST_CREATE_DB(error, ali_name, TADinsdel,
false);
1894 if (!error) error = add_some_SAIs(gb_main, ali_name);
1898 for (
int pass = 1; pass <= 2; ++pass) {
1899 if (pass == 1) TEST_ALI_LEN_ALIGNED(56, 1);
1900 if (pass == 2) TEST_ALI_LEN_ALIGNED(57, 0);
1902 TEST_DATA(
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUCACCUCC.....",
1903 "---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU.....",
1904 "...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU----",
1905 "---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCCCACCUGA....",
1906 ".....[<[.........[..[..[<<.[..].>>]....]..]....].>......]",
1907 ".....1.1.........25.25.34..34.34..34...25.25...1........1",
1908 ".....x..x........x...x.x....x.x....x...x...x...x.........x",
1909 "9346740960354855652100942568200611650200211394358998513",
1910 "ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uCLDoHlWV59DW",
1917 TEST_ALI_LEN_ALIGNED(57, 1);
1918 TEST_DATA(
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUCACCUCC......",
1919 "---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU.....",
1920 "...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU-----",
1921 "---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCCCACCUGA.....",
1922 ".....[<[.........[..[..[<<.[..].>>]....]..]....].>......]",
1923 ".....1.1.........25.25.34..34.34..34...25.25...1........1",
1924 ".....x..x........x...x.x....x.x....x...x...x...x.........x",
1925 "934674096035485565210094256820061165020021139435899851300",
1926 "ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uCLDoHlWV59DW!",
1930 #define COL(col) ((col)-19)
1933 TEST_ALI_LEN_ALIGNED(59, 1);
1934 TEST_DATA(
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC......",
1935 "---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.....",
1936 "...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-----",
1937 "---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.....",
1938 ".....[<[.........[..[..[<<.[..].>>]....]..]......].>......]",
1939 ".....1.1.........25.25.34..34.34..34...25.25.....1........1",
1940 ".....x..x........x...x.x....x.x....x...x...x.....x.........x",
1941 "93467409603548556521009425682006116502002113900435899851300",
1942 "ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59DW!",
1946 TEST_ALI_LEN_ALIGNED(61, 1);
1947 TEST_DATA(
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
1948 "---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
1949 "...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
1950 "---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
1951 ".....[<[.........[..[..[<<.[..].>>]....]..]......].>........]",
1952 ".....1.1.........25.25.34..34.34..34...25.25.....1..........1",
1953 ".....x..x........x...x.x....x.x....x...x...x.....x...........x",
1954 "9346740960354855652100942568200611650200211390043589985100300",
1955 "ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
1959 TEST_ALI_LEN_ALIGNED(63, 1);
1960 TEST_DATA(
".....G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
1961 "-----A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
1962 ".....A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
1963 "-----U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
1964 ".......[<[.........[..[..[<<.[..].>>]....]..]......].>........]",
1965 ".......1.1.........25.25.34..34.34..34...25.25.....1..........1",
1966 ".......x..x........x...x.x....x.x....x...x...x.....x...........x",
1967 "900346740960354855652100942568200611650200211390043589985100300",
1968 "O!!Du8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
1973 TEST_ALI_LEN_ALIGNED(65, 1);
1974 TEST_DATA(
".....G---GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
1975 "-----A---CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
1976 ".....A---CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
1977 "-----U---GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
1978 ".........[<[.........[..[..[<<.[..].>>]....]..]......].>........]",
1979 ".........1.1.........25.25.34..34.34..34...25.25.....1..........1",
1980 ".........x..x........x...x.x....x.x....x...x...x.....x...........x",
1981 "90034670040960354855652100942568200611650200211390043589985100300",
1982 "O!!Du8E!!Jh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
1986 TEST_ALI_LEN_ALIGNED(67, 1);
1987 TEST_DATA(
".....G---G--GC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
1988 "-----A---C--GA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
1989 ".....A---C--GA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
1990 "-----U---G--CC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
1991 ".........[..<[.........[..[..[<<.[..].>>]....]..]......].>........]",
1992 ".........1...1.........25.25.34..34.34..34...25.25.....1..........1",
1993 ".........x....x........x...x.x....x.x....x...x...x.....x...........x",
1994 "9003467004000960354855652100942568200611650200211390043589985100300",
1995 "O!!Du8E!!J!!h60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
1999 TEST_ALI_LEN_ALIGNED(69, 1);
2000 TEST_DATA(
".....G---G--G--C-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
2001 "-----A---C--G--A-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
2002 ".....A---C--G--A-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
2003 "-----U---G--C--C-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
2004 ".........[..<..[.........[..[..[<<.[..].>>]....]..]......].>........]",
2005 ".........1.....1.........25.25.34..34.34..34...25.25.....1..........1",
2006 ".........x......x........x...x.x....x.x....x...x...x.....x...........x",
2007 "900346700400000960354855652100942568200611650200211390043589985100300",
2008 "O!!Du8E!!J!!h!!60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
2012 TEST_ALI_LEN_ALIGNED(71, 1);
2013 TEST_DATA(
".....G---G--G--C---C-G...--A--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCC........",
2014 "-----A---C--G--A---U-C-----C--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU.......",
2015 ".....A---C--G--A---A-C.....G--G--GAA-CCUG-CGGC-UGG--AUC--ACCUCCU-------",
2016 "-----U---G--C--C---U-G-----G--C--CCU-UAGC-GCGG-UGG--UCC--CACCUGA.......",
2017 ".........[..<..[...........[..[..[<<.[..].>>]....]..]......].>........]",
2018 ".........1.....1...........25.25.34..34.34..34...25.25.....1..........1",
2019 ".........x........x........x...x.x....x.x....x...x...x.....x...........x",
2021 "90034670040000090060354855652100942568200611650200211390043589985100300",
2022 "O!!Du8E!!J!!h!!6!!0e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
2027 TEST_ALI_LEN_ALIGNED(73, 1);
2028 TEST_DATA(
".....G---G--G--C---C-G...--A--G--GAA-CCU--G-CGGC-UGG--AUC--ACCUCC........",
2029 "-----A---C--G--A---U-C-----C--G--GAA-CCU--G-CGGC-UGG--AUC--ACCUCCU.......",
2030 ".....A---C--G--A---A-C.....G--G--GAA-CCU--G-CGGC-UGG--AUC--ACCUCCU-------",
2031 "-----U---G--C--C---U-G-----G--C--CCU-UAG--C-GCGG-UGG--UCC--CACCUGA.......",
2032 ".........[..<..[...........[..[..[<<.[....].>>]....]..]......].>........]",
2033 ".........1.....1...........25.25.34..34...34..34...25.25.....1..........1",
2034 ".........x........x........x...x.x....x...x....x...x...x.....x...........x",
2035 "9003467004000009006035485565210094256820000611650200211390043589985100300",
2036 "O!!Du8E!!J!!h!!6!!0e1XYLgxvzrqmeMiMAjB5E!!JxT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
2040 TEST_ALI_LEN_ALIGNED(75, 1);
2041 TEST_DATA(
".....G---G--G--C---C-G...--A--G--GAA-CCU--G---CGGC-UGG--AUC--ACCUCC........",
2042 "-----A---C--G--A---U-C-----C--G--GAA-CCU--G---CGGC-UGG--AUC--ACCUCCU.......",
2043 ".....A---C--G--A---A-C.....G--G--GAA-CCU--G---CGGC-UGG--AUC--ACCUCCU-------",
2044 "-----U---G--C--C---U-G-----G--C--CCU-UAG--C---GCGG-UGG--UCC--CACCUGA.......",
2045 ".........[..<..[...........[..[..[<<.[....]...>>]....]..]......].>........]",
2046 ".........1.....1...........25.25.34..34...3..4..34...25.25.....1..........1",
2048 ".........x........x........x...x.x....x...x......x...x...x.....x...........x",
2049 "900346700400000900603548556521009425682000000611650200211390043589985100300",
2050 "O!!Du8E!!J!!h!!6!!0e1XYLgxvzrqmeMiMAjB5E!!J!!xT6JPiCvQrq4uC!!LDoHlWV59!!DW!",
2054 TEST_ALI_LEN_ALIGNED(77, 1);
2055 TEST_DATA(
".....G---G--G--C---C-G...--A--G--GAA-CCU--G---CG--GC-UGG--AUC--ACCUCC........",
2056 "-----A---C--G--A---U-C-----C--G--GAA-CCU--G---CG--GC-UGG--AUC--ACCUCCU.......",
2057 ".....A---C--G--A---A-C.....G--G--GAA-CCU--G---CG--GC-UGG--AUC--ACCUCCU-------",
2058 "-----U---G--C--C---U-G-----G--C--CCU-UAG--C---GC--GG-UGG--UCC--CACCUGA.......",
2059 ".........[..<..[...........[..[..[<<.[....]...>>..]....]..]......].>........]",
2060 ".........1.....1...........25.25.34..34...3..4....34...25.25.....1..........1",
2061 ".........x........x........x...x.x....x...x........x...x...x.....x...........x",
2062 "90034670040000090060354855652100942568200000061100650200211390043589985100300",
2063 "O!!Du8E!!J!!h!!6!!0e1XYLgxvzrqmeMiMAjB5E!!J!!xT6!!JPiCvQrq4uC!!LDoHlWV59!!DW!",
2067 TEST_ALI_LEN_ALIGNED(79, 1);
2068 TEST_DATA(
".....G---G--G--C---C-G...--A--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCC........",
2069 "-----A---C--G--A---U-C-----C--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU.......",
2070 ".....A---C--G--A---A-C.....G--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU-------",
2071 "-----U---G--C--C---U-G-----G--C--CCU-UAG--C---GC--G--G-UGG--UCC--CACCUGA.......",
2072 ".........[..<..[...........[..[..[<<.[....]...>>..]......]..]......].>........]",
2073 ".........1.....1...........25.25.34..34...3..4....3..4...25.25.....1..........1",
2074 ".........x........x........x...x.x....x...x..........x...x...x.....x...........x",
2075 "9003467004000009006035485565210094256820000006110060050200211390043589985100300",
2076 "O!!Du8E!!J!!h!!6!!0e1XYLgxvzrqmeMiMAjB5E!!J!!xT6!!J!!PiCvQrq4uC!!LDoHlWV59!!DW!",
2082 TEST_ALI_LEN_ALIGNED(81, 1);
2083 TEST_DATA(
".....G---G--G--C---C-G...----A--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCC........",
2084 "-----A---C--G--A---U-C-------C--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU.......",
2085 ".....A---C--G--A---A-C.......G--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU-------",
2086 "-----U---G--C--C---U-G-------G--C--CCU-UAG--C---GC--G--G-UGG--UCC--CACCUGA.......",
2087 ".........[..<..[.............[..[..[<<.[....]...>>..]......]..]......].>........]",
2088 ".........1.....1.............25.25.34..34...3..4....3..4...25.25.....1..........1",
2089 ".........x........x..........x...x.x....x...x..........x...x...x.....x...........x",
2090 "900346700400000900603548500565210094256820000006110060050200211390043589985100300",
2091 "O!!Du8E!!J!!h!!6!!0e1XYLg!!xvzrqmeMiMAjB5E!!J!!xT6!!J!!PiCvQrq4uC!!LDoHlWV59!!DW!",
2096 TEST_ALI_LEN_ALIGNED(75, 1);
2097 TEST_DATA(
".....G---G--G--C---C-G.A--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCC........",
2098 "-----A---C--G--A---U-C-C--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU.......",
2099 ".....A---C--G--A---A-C.G--G--GAA-CCU--G---CG--G--C-UGG--AUC--ACCUCCU-------",
2100 "-----U---G--C--C---U-G-G--C--CCU-UAG--C---GC--G--G-UGG--UCC--CACCUGA.......",
2101 ".........[..<..[.......[..[..[<<.[....]...>>..]......]..]......].>........]",
2102 ".........1.....1.......25.25.34..34...3..4....3..4...25.25.....1..........1",
2103 ".........x........x....x...x.x....x...x..........x...x...x.....x...........x",
2104 "900346700400000900603545210094256820000006110060050200211390043589985100300",
2105 "O!!Du8E!!J!!h!!6!!0e1XYzrqmeMiMAjB5E!!J!!xT6!!J!!PiCvQrq4uC!!LDoHlWV59!!DW!",
2109 TEST_ALI_LEN_ALIGNED(74, 1);
2110 TEST_DATA(
".....G---G--G--C---C-G.A--G--GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCC........",
2111 "-----A---C--G--A---U-C-C--G--GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCCU.......",
2112 ".....A---C--G--A---A-C.G--G--GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCCU-------",
2113 "-----U---G--C--C---U-G-G--C--CCU-UAG--C---GC--G--G-UGG-UCC--CACCUGA.......",
2114 ".........[..<..[.......[..[..[<<.[....]...>>..]......].]......].>........]",
2115 ".........1.....1.......25.25.34..34...3..4....3..4...2525.....1..........1",
2116 ".........x........x....x...x.x....x...x..........x...x..x.....x...........x",
2117 "90034670040000090060354521009425682000000611006005020021390043589985100300",
2118 "O!!Du8E!!J!!h!!6!!0e1XYzrqmeMiMAjB5E!!J!!xT6!!J!!PiCvQr4uC!!LDoHlWV59!!DW!",
2123 TEST_ALI_LEN_ALIGNED(73, 1);
2124 TEST_DATA(
".....G---G--G--C---C-G.A--G-GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCC........",
2125 "-----A---C--G--A---U-C-C--G-GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCCU.......",
2126 ".....A---C--G--A---A-C.G--G-GAA-CCU--G---CG--G--C-UGG-AUC--ACCUCCU-------",
2127 "-----U---G--C--C---U-G-G--C-CCU-UAG--C---GC--G--G-UGG-UCC--CACCUGA.......",
2128 ".........[..<..[.......[..[.[<<.[....]...>>..]......].]......].>........]",
2129 ".........1.....1.......25.2534..34...3..4....3..4...2525.....1..........1",
2130 ".........x........x....x...xx....x...x..........x...x..x.....x...........x",
2131 "9003467004000009006035452100425682000000611006005020021390043589985100300",
2132 "O!!Du8E!!J!!h!!6!!0e1XYzrqmeiMAjB5E!!J!!xT6!!J!!PiCvQr4uC!!LDoHlWV59!!DW!",
2137 TEST_ALI_LEN_ALIGNED(68, 1);
2138 TEST_DATA(
".....G---G--G--C---C-G.A--G-GAA-CCU--G---CG--G--C-UGG-ACCUCC........",
2139 "-----A---C--G--A---U-C-C--G-GAA-CCU--G---CG--G--C-UGG-ACCUCCU.......",
2140 ".....A---C--G--A---A-C.G--G-GAA-CCU--G---CG--G--C-UGG-ACCUCCU-------",
2141 "-----U---G--C--C---U-G-G--C-CCU-UAG--C---GC--G--G-UGG-CACCUGA.......",
2142 ".........[..<..[.......[..[.[<<.[....]...>>..]......]...].>........]",
2143 ".........1.....1.......25.2534..34...3..4....3..4...2...1..........1",
2144 ".........x........x....x...xx....x...x..........x...x...x...........x",
2145 "90034670040000090060354521004256820000006110060050200043589985100300",
2146 "O!!Du8E!!J!!h!!6!!0e1XYzrqmeiMAjB5E!!J!!xT6!!J!!PiCvQ!LDoHlWV59!!DW!",
2155 "SAI 'HELIX': You tried to delete 'x' at position 18 -> Operation aborted");
2161 "SAI 'HELIX_NR': You tried to delete '4' at position 40 -> Operation aborted");
2167 "Can't insert at position 4711 (exceeds length 68 of alignment 'ali_mini')");
2173 "Can't delete positions 66-68 (exceeds max. position 67 of alignment 'ali_mini')");
2179 "Illegal sequence position -1");
2185 TEST_DATA(
".....G---G--G--C---C-G.A--G-GAA-CCU--G---CG--G--C-UGG-ACCUCC........",
2186 "-----A---C--G--A---U-C-C--G-GAA-CCU--G---CG--G--C-UGG-ACCUCCU.......",
2187 ".....A---C--G--A---A-C.G--G-GAA-CCU--G---CG--G--C-UGG-ACCUCCU-------",
2188 "-----U---G--C--C---U-G-G--C-CCU-UAG--C---GC--G--G-UGG-CACCUGA.......",
2189 ".........[..<..[.......[..[.[<<.[....]...>>..]......]...].>........]",
2190 ".........1.....1.......25.2534..34...3..4....3..4...2...1..........1",
2191 ".........x........x....x...xx....x...x..........x...x...x...........x",
2192 "90034670040000090060354521004256820000006110060050200043589985100300",
2193 "O!!Du8E!!J!!h!!6!!0e1XYzrqmeiMAjB5E!!J!!xT6!!J!!PiCvQ!LDoHlWV59!!DW!",
2200 void TEST_insert_delete_DB() {
2201 test_insert_delete_DB();
2207 const char *ali_name =
"ali_mini";
2208 GBDATA *gb_main = TEST_CREATE_DB(error, ali_name, TADinsdel,
false);
2212 if (!error) error = add_some_SAIs(gb_main, ali_name);
2218 int alilen_exp = 57;
2219 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2220 TEST_DATA(
"...G-GGC-C-G...--A--G--GAA-CCUG-CGGC-UGG--AUCACCUCC......",
2221 "---A-CGA-U-C-----C--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU.....",
2222 "...A-CGA-A-C.....G--G--GAA-CCUG-CGGC-UGG--AUCACCUCCU-----",
2223 "---U-GCC-U-G-----G--C--CCU-UAGC-GCGG-UGG--UCCCACCUGA.....",
2224 ".....[<[.........[..[..[<<.[..].>>]....]..]....].>......]",
2225 ".....1.1.........25.25.34..34.34..34...25.25...1........1",
2226 ".....x..x........x...x.x....x.x....x...x...x...x.........x",
2227 "934674096035485565210094256820061165020021139435899851300",
2228 "ODu8EJh60e1XYLgxvzrqmeMiMAjB5EJxT6JPiCvQrq4uCLDoHlWV59DW!",
2232 "xxx-------x-x-xxx---------x---------x---------------xxxx-",
2236 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2237 TEST_DATA(
"G-GGC-CG.A--G--GAACCUG-CGGCUGG--AUCACCUCC..",
2238 "A-CGA-UC-C--G--GAACCUG-CGGCUGG--AUCACCUCCU.",
2239 "A-CGA-AC.G--G--GAACCUG-CGGCUGG--AUCACCUCCU-",
2240 "U-GCC-UG-G--C--CCUUAGC-GCGGUGG--UCCCACCUGA.",
2241 "..[<[....[..[..[<<[..].>>]...]..]....].>..]",
2242 "..1.1....25.25.34.34.34..34..25.25...1....1",
2243 "..x..x...x...x.x...x.x....x..x...x...x.....x",
2244 "6740960585210094258200611652002113943589980",
2245 "8EJh60eXLzrqmeMiMAB5EJxT6JPCvQrq4uCLDoHlWV!",
2250 "---xx---xxxxxxxx---------xxxx--------------",
2254 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2255 TEST_DATA(
"G-G--GC-CG...A--G--GAACCUG-CG--GCUGG--AUCACCUCC..",
2256 "A-C--GA-UC---C--G--GAACCUG-CG--GCUGG--AUCACCUCCU.",
2257 "A-C--GA-AC...G--G--GAACCUG-CG--GCUGG--AUCACCUCCU-",
2258 "U-G--CC-UG---G--C--CCUUAGC-GC--GGUGG--UCCCACCUGA.",
2259 "..[..<[......[..[..[<<[..].>>..]...]..]....].>..]",
2260 "..1...1......25.25.34.34.34....34..25.25...1....1",
2261 "..x....x.....x...x.x...x.x......x..x...x...x.....x",
2262 "6740009605008521009425820061100652002113943589980",
2263 "8EJ!!h60eX!!LzrqmeMiMAB5EJxT6!!JPCvQrq4uCLDoHlWV!",
2268 "-----------xx-x------------xxxxxx---------------x",
2272 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2273 TEST_DATA(
"G-G--GC-CG.......A------G--GAACCUG-CG--GC----UGG--AUCACCUCC......",
2274 "A-C--GA-UC-------C------G--GAACCUG-CG--GC----UGG--AUCACCUCCU.....",
2275 "A-C--GA-AC.......G------G--GAACCUG-CG--GC----UGG--AUCACCUCCU-----",
2276 "U-G--CC-UG-------G------C--CCUUAGC-GC--GG----UGG--UCCCACCUGA.....",
2277 "..[..<[..........[......[..[<<[..].>>..].......]..]....].>..]....",
2278 "..1...1..........25.....25.34.34.34....34......25.25...1....1....",
2279 "..x....x.........x.......x.x...x.x......x......x...x...x.........x",
2280 "67400096050080000520000100942582006110065000020021139435899800000",
2281 "8EJ!!h60eX!!L!!!!zr!!!!qmeMiMAB5EJxT6!!JP!!!!CvQrq4uCLDoHlWV!!!!!",
2286 "x----xx--------------------------------------xxx----xxxx--------x",
2290 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2291 TEST_DATA(
".G-G---G-C-CG.......A------G--GAACCUG-CG--GC-----U-G-G--AU-C-A-C-CUCC.......",
2292 ".A-C---G-A-UC-------C------G--GAACCUG-CG--GC-----U-G-G--AU-C-A-C-CUCCU......",
2293 ".A-C---G-A-AC.......G------G--GAACCUG-CG--GC-----U-G-G--AU-C-A-C-CUCCU------",
2294 ".U-G---C-C-UG-------G------C--CCUUAGC-GC--GG-----U-G-G--UC-C-C-A-CCUGA......",
2295 "...[...<.[..........[......[..[<<[..].>>..]..........]..]........].>..].....",
2296 "...1.....1..........25.....25.34.34.34....34.........25.25.......1....1.....",
2297 "...x......x.........x.......x.x...x.x......x.........x...x.......x..........x",
2298 "0674000009605008000052000010094258200611006500000200002113090403058998000000",
2299 "!8EJ!!!h!60eX!!L!!!!zr!!!!qmeMiMAB5EJxT6!!JP!!!!!C!v!Qrq4u!C!L!D!oHlWV!!!!!!",
2304 "------------------------------xxxxxxx----------------------------xxxxxx-----",
2308 TEST_ALI_LEN_ALIGNED(alilen_exp, 1);
2309 TEST_DATA(
".G-G---G-C-CG.......A------G--G--A--A--C--C--U--G---CG--GC-----U-G-G--AU-C-A-C-C--U--C--C.............",
2310 ".A-C---G-A-UC-------C------G--G--A--A--C--C--U--G---CG--GC-----U-G-G--AU-C-A-C-C--U--C--C--U..........",
2311 ".A-C---G-A-AC.......G------G--G--A--A--C--C--U--G---CG--GC-----U-G-G--AU-C-A-C-C--U--C--C--U----------",
2312 ".U-G---C-C-UG-------G------C--C--C--U--U--A--G--C---GC--GG-----U-G-G--UC-C-C-A-C--C--U--G--A..........",
2313 "...[...<.[..........[......[..[..<..<..[........]...>>..]..........]..]........].....>........].......",
2314 "...1.....1..........25.....25.3..4.....3..4.....3..4....34.........25.25.......1..............1.......",
2315 "...x......x.........x.......x.x...........x.....x........x.........x...x.......x......................x",
2316 "067400000960500800005200001009400200500800200000000611006500000200002113090403050080090090080000000000",
2317 "!8EJ!!!h!60eX!!L!!!!zr!!!!qmeMi!!M!!A!!B!!5!!E!!J!!xT6!!JP!!!!!C!v!Qrq4u!C!L!D!o!!H!!l!!W!!V!!!!!!!!!!",
2326 #endif // UNIT_TESTS
virtual bool has_slice() const =0
GB_ERROR GB_write_bits(GBDATA *gbd, const char *bits, long size, const char *c_0)
float * GB_read_floats(GBDATA *gbd)
AliDataPtr apply(AliDataPtr to, GB_ERROR &error) const OVERRIDE
AliDataPtr slice_down(size_t start, size_t count) const OVERRIDE
TypedAliData< T > BaseType
bool has_slice() const OVERRIDE
AliDataPtr format(AliDataPtr data, const size_t wanted_len, GB_ERROR &error)
long GB_read_int(GBDATA *gbd)
GBDATA * GB_child(GBDATA *father)
#define implicated(hypothesis, conclusion)
GB_ERROR GB_write_bytes(GBDATA *gbd, const char *s, long size)
virtual AliDataPtr apply(AliDataPtr to, GB_ERROR &error) const =0
AliDataPtr delete_from(AliDataPtr from, size_t pos, size_t amount, GB_ERROR &error)
virtual size_t unitsize() const =0
static void dot(double **i, double **j, double **k)
CONSTEXPR_INLINE unsigned char safeCharIndex(char c)
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
static GB_ERROR apply_command_to_alignment(const AliEditCommand &cmd, const char *cmd_description, GBDATA *Main, const char *alignment_name, const char *deletable_chars)
GBDATA * GB_find(GBDATA *gbd, const char *key, GB_SEARCH_TYPE gbs)
bool has_slice() const OVERRIDE
int operate_on_mem(void *mem, size_t start, size_t count, AliData::memop op) const OVERRIDE
TypedAliData< T > BaseType
GB_ERROR check_applicable_to(const Alignment &ali, size_t &resulting_ali_length) const OVERRIDE
GBDATA * GB_nextEntry(GBDATA *entry)
TypedAliData(size_t size_, T gap_)
GBDATA * GBT_get_alignment(GBDATA *gb_main, const char *aliname)
bool ARB_is_alignment_relative_data(GBDATA *gb_data)
void GB_disable_quicksave(GBDATA *gbd, const char *reason)
virtual GB_ERROR check_applicable_to(const Alignment &ali, size_t &resulting_ali_length) const =0
UnitPtr unit_left_of(size_t pos) const OVERRIDE
const AliEditCommand & edit_command() const
char * ARB_strdup(const char *str)
const T * std_gap_ptr() const
UnitPtr unit_left_of(size_t pos) const OVERRIDE
const char * GBS_global_string(const char *templat,...)
int get_len(int idx) const
SizeAwarable(bool allows_oversize_, size_t ali_size_)
static char * alignment_name
const char * get_name() const
int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const OVERRIDE
AliDataPtr slice_down(size_t start, size_t count) const OVERRIDE
UnitPtr unit_left_of(size_t pos) const OVERRIDE
bool isNull() const
test if SmartPtr is NULp
GB_ERROR ARB_insdel_columns(GBDATA *Main, const char *alignment_name, long pos, long count, const char *deletable_chars)
SpecificAliData(const T *static_data, size_t elements, const T &gap_, const SizeAwarable &sizeAware, const Deletable &deletable_)
AliDataPtr create_gap(size_t gapsize, const UnitPair &gapinfo) const OVERRIDE
static GB_CSTR targetTypeName[]
EditedTerminal(GBDATA *gb_data_, GB_TYPES type_, const char *item_name_, size_t size_, TerminalType term_type, const Alignment &ali, const Deletable &deletable_)
UnitPtr unit_right_of(size_t pos) const OVERRIDE
static size_t countAffectedEntries(GBDATA *Main, const Alignment &ali)
#define ARRAY_ELEMS(array)
AliDataPtr partof(AliDataPtr data, size_t pos, size_t amount)
char buffer[MESSAGE_BUFFERSIZE]
GBDATA * GB_get_father(GBDATA *gbd)
static GB_ERROR format_to_alilen(GBDATA *Main, const char *alignment_name)
static size_t insDelBuffer_size
GB_ERROR ARB_delete_columns_using_SAI(GBDATA *Main, const char *alignment_name, const RangeList &ranges, const char *deletable_chars)
const void * expect_pointer() const
AliDataPtr insert_at(AliDataPtr dest, size_t pos, AliDataPtr src)
static HelixNrInfo * start
int operate_on_mem(void *mem, size_t start, size_t count, memop op) const OVERRIDE
LazyAliData(const SizeAwarable &oversizable, size_t size_, TerminalType term_type_, EditedTerminal &terminal_)
#define TEST_PUBLISH(testfunction)
GBDATA * GBT_find_SAI(GBDATA *gb_main, const char *name)
NOT4PERL GBDATA * GBT_add_data(GBDATA *species, const char *ali_name, const char *key, GB_TYPES type) __ATTR__DEPRECATED_TODO("better use GBT_create_sequence_data()")
UnitPtr at_ptr(size_t pos) const OVERRIDE
GB_CSTR GB_read_bytes_pntr(GBDATA *gbd)
GB_ERROR ARB_insert_columns_using_SAI(GBDATA *Main, const char *alignment_name, const RangeList &ranges, UseRange units, InsertWhere where, size_t amount)
GB_ERROR GB_await_error()
AliDataPtr after(AliDataPtr data, size_t pos)
NOT4PERL long * GBT_read_int(GBDATA *gb_container, const char *fieldpath)
#define TEST_EXPECT(cond)
GB_ERROR ARB_format_alignment(GBDATA *Main, const char *alignment_name)
long GB_read_count(GBDATA *gbd)
GB_ERROR apply_to_alignment(GBDATA *gb_main, const Alignment &ali) const
const T * get_data() const
GB_TYPES GB_read_type(GBDATA *gbd)
size_t get_entry_count() const
GB_CSTR GB_read_key_pntr(GBDATA *gbd)
AliDataPtr concat(AliDataPtr left, AliDataPtr right)
bool differs_from(const AliData &other) const
const T & std_gap() const
AliDataPtr apply(AliDataPtr to, GB_ERROR &) const OVERRIDE
void set_pointer(const void *ptr_)
long GB_number_of_subentries(GBDATA *gbd)
void GBK_terminate(const char *error) __ATTR__NORETURN
~AliCompositeCommand() OVERRIDE
int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const OVERRIDE
reverse_iterator rend() const
virtual ~AliEditCommand()
int cmp_whole_data(const AliData &other) const
int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const OVERRIDE
UnitPtr unit_right_of(size_t pos) const OVERRIDE
GB_ERROR check_applicable_to(const Alignment &ali, size_t &resulting_ali_length) const OVERRIDE
UnitPtr unit_right_of(size_t pos) const OVERRIDE
static void error(const char *msg)
int cmpPartWith(const void *mem, size_t start, size_t count) const
int operate_on_mem(void *mem, size_t start, size_t count, memop op) const OVERRIDE
UnitPtr unit_right_of(size_t pos) const OVERRIDE
GB_ERROR check_applicable_to(const Alignment &ali, size_t &resulting_ali_length) const OVERRIDE
expectation_group & add(const expectation &e)
Deletable(const char *allowed)
AliDeleteCommand(size_t pos_, size_t amount_)
bool is_valid_pos(size_t pos) const
SpecificGap(size_t gapsize, const T &gap_)
int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const OVERRIDE
AliDataPtr create_gap(size_t gapsize, const UnitPair &gapinfo) const OVERRIDE
size_t unitsize() const OVERRIDE
GB_UINT4 * GB_read_ints(GBDATA *gbd)
GB_CSTR alidata2buffer(const AliData &data)
AliCompositeCommand(AliEditCommand *cmd1_, AliEditCommand *cmd2_)
void copyTo(void *mem) const
bool is_valid_part(size_t start, size_t count) const
static bool shall_edit(GBDATA *gb_data, TerminalType term_type)
const void * get_pointer() const
GB_ERROR check_delete_allowed(const T *, size_t, size_t, const Deletable &)
__ATTR__NORETURN AliDataPtr slice_down(size_t, size_t) const OVERRIDE
GB_CUINT4 * GB_read_ints_pntr(GBDATA *gbd)
AliDataPtr apply(AliDataPtr to, GB_ERROR &error) const OVERRIDE
int compare_type(const T &t1, const T &t2)
AliDataPtr before(AliDataPtr data, size_t pos)
GB_ERROR GB_write_int(GBDATA *gbd, long i)
virtual AliDataPtr slice_down(size_t start, size_t count) const =0
#define __ATTR__REDUCED_OPTIMIZE
size_t get_allowed_size(size_t term_size, size_t new_ali_size) const
static void copy(double **i, double **j)
#define IF_ASSERTION_USED(x)
reverse_iterator rbegin() const
GB_ERROR close(GB_ERROR error)
UnitPtr at_ptr(size_t pos) const OVERRIDE
AliFormatCommand(size_t wanted_len_)
#define TEST_EXPECT_CODE_ASSERTION_FAILS(cb)
static AliDataPtr make(AliDataPtr from, size_t offset, size_t amount)
UnitPtr unit_left_of(size_t pos) const OVERRIDE
bool equals(const AliData &other) const
bool equals(const copy< T > &t1, const copy< T > &t2)
virtual int operate_on_mem(void *mem, size_t start, size_t count, memop op) const =0
char * provide_insDelBuffer(size_t neededSpace)
int operate_on_mem(void *mem, size_t start, size_t count, AliData::memop op) const OVERRIDE
GB_ERROR GB_write_ints(GBDATA *gbd, const GB_UINT4 *i, long size)
SmartPtr< AliData > AliDataPtr
AliDataPtr create_gap(size_t gapsize, const UnitPair &) const OVERRIDE
static char * insDelBuffer
GBDATA * GBT_find_or_create(GBDATA *father, const char *key, long delete_level)
AliDataPtr insert_gap(AliDataPtr data, size_t pos, size_t count)
size_t unitsize() const OVERRIDE
RangeList build_RangeList_from_string(const char *SAI_data, const char *set_bytes, bool invert)
GB_ERROR get_delete_error(const char *data, size_t start, size_t count) const
AliDataPtr create_gap(size_t gapsize, const UnitPair &gapinfo) const OVERRIDE
GB_ERROR check_delete_allowed(size_t start, size_t count) const
static ARB_init_perl_interface init
#define TEST_EXPECT_NO_ERROR(call)
GBDATA * GB_find_string(GBDATA *gbd, const char *key, const char *str, GB_CASE case_sens, GB_SEARCH_TYPE gbs)
SequenceAliData(const char *static_data, size_t elements, char stdgap, char dotgap, const SizeAwarable &sizeAware, const Deletable &deletable_)
int operate_on_mem(void *mem, size_t start, size_t count, memop op) const OVERRIDE
GB_ERROR GB_write_floats(GBDATA *gbd, const float *f, long size)
virtual UnitPtr unit_left_of(size_t pos) const =0
GB_CSTR GB_read_bits_pntr(GBDATA *gbd, char c_0, char c_1)
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
virtual AliDataPtr create_gap(size_t gapsize, const UnitPair &gapinfo) const =0
Alignment(const char *name_, size_t len_)
#define __ATTR__REDUCED_OPTIMIZE__NO_GCSE
int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const OVERRIDE
virtual UnitPtr unit_right_of(size_t pos) const =0
void set_error(GB_ERROR error) const
GBDATA * GB_nextChild(GBDATA *child)
void copyPartTo(void *mem, size_t start, size_t count) const
GB_CFLOAT * GB_read_floats_pntr(GBDATA *gbd)
bool has_slice() const OVERRIDE
GB_transaction ta(gb_var)
AliDataPtr create_gap(size_t gapsize, const UnitPair &gapinfo) const OVERRIDE
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
AliDataPtr apply(AliDataPtr to, GB_ERROR &error) const OVERRIDE
static const T * typed_ptr(const UnitPtr &uptr)
GB_ERROR GBT_check_data(GBDATA *Main, const char *alignment_name)
GBDATA * GBT_get_presets(GBDATA *gb_main)
UnitPtr(const void *ptr_)
GB_ERROR apply(const AliEditCommand &cmd, bool &did_modify)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
range_set::const_reverse_iterator reverse_iterator
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
virtual int cmp_data(size_t start, const AliData &other, size_t ostart, size_t count) const =0
GB_ERROR check_applicable_to(const Alignment &ali, size_t &resulting_ali_length) const OVERRIDE
const unsigned int GB_CUINT4
bool has_slice() const OVERRIDE
AliDataPtr makeAliSeqData(char *&allocated_data, size_t elems, char gap, char dot)
AliInsertCommand(size_t pos_, size_t amount_)
size_t unitsize() const OVERRIDE
AliEditor(const AliEditCommand &cmd_, const Deletable &deletable_, const char *progress_title, size_t progress_count)
#define TEST_EXPECT_EQUAL(expr, want)
GB_ERROR mid(GBL_command_arguments *args, int start_index)
GBDATA * GB_entry(GBDATA *father, const char *key)
bool is_valid_between(size_t pos) const
void GB_close(GBDATA *gbd)
Deletable(DeleteWhat what)
SizeAwarable dontAllowOversize(size_t ali_size)
size_t unitsize() const OVERRIDE
AliDataPtr makeAliData(T *&allocated_data, size_t elems, const T &gap)
GB_write_int const char s