- Timestamp:
- 07/10/11 14:39:27 (8 months ago)
- Location:
- trunk
- Files:
-
- 3 removed
- 38 modified
- 7 copied
-
ARBDB/ad_prot.h (modified) (2 diffs)
-
ARBDB/ad_save_load.cxx (modified) (2 diffs)
-
ARBDB/admap.cxx (modified) (1 diff)
-
ARBDB/adsocket.cxx (modified) (1 diff)
-
ARBDB/adtcp.cxx (modified) (2 diffs)
-
ARBDB/gb_memory.h (modified) (1 diff)
-
Makefile (modified) (3 diffs)
-
PROBE/Makefile (modified) (5 diffs)
-
PROBE/PT_buildtree.cxx (modified) (10 diffs)
-
PROBE/PT_debug.cxx (modified) (7 diffs)
-
PROBE/PT_etc.cxx (modified) (4 diffs)
-
PROBE/PT_family.cxx (modified) (12 diffs)
-
PROBE/PT_findEx.cxx (modified) (4 diffs)
-
PROBE/PT_io.cxx (modified) (7 diffs)
-
PROBE/PT_main.cxx (modified) (10 diffs)
-
PROBE/PT_match.cxx (modified) (14 diffs)
-
PROBE/PT_new_design.cxx (modified) (27 diffs)
-
PROBE/PT_prefixtree.cxx (modified) (16 diffs)
-
PROBE/needs_libs (modified) (1 diff)
-
PROBE/probe.h (modified) (6 diffs)
-
PROBE/probe_tree.h (modified) (5 diffs)
-
PROBE/pt_prototypes.h (modified) (6 diffs)
-
SERVERCNTRL/servercntrl.cxx (modified) (1 diff)
-
SL/Makefile (modified) (1 diff)
-
SL/PTCLEAN (copied) (copied from branches/dev/SL/PTCLEAN) (1 prop)
-
SL/PTCLEAN/Makefile (modified) (2 diffs)
-
SL/PTCLEAN/ptclean.cxx (modified) (2 diffs)
-
SL/PTCLEAN/ptclean.h (modified) (1 diff)
-
SOURCE_TOOLS/dep.4dummy (modified) (2 diffs)
-
SOURCE_TOOLS/dep.alltargets (modified) (1 diff)
-
SOURCE_TOOLS/dep.libtargets (modified) (1 diff)
-
SOURCE_TOOLS/generate_all_links.sh (modified) (1 diff)
-
TOOLS/arb_probe.cxx (modified) (17 diffs)
-
TOOLS/arb_test.cxx (modified) (4 diffs)
-
UNIT_TESTER/TestEnvironment.cxx (modified) (5 diffs)
-
UNIT_TESTER/run (modified) (1 prop)
-
UNIT_TESTER/run/TEST_gpt.arb.expected (copied) (copied from branches/dev/UNIT_TESTER/run/TEST_gpt.arb.expected)
-
UNIT_TESTER/run/TEST_gpt.arb.pt.expected (copied) (copied from branches/dev/UNIT_TESTER/run/TEST_gpt.arb.pt.expected)
-
UNIT_TESTER/run/TEST_gpt_src.arb (copied) (copied from branches/dev/UNIT_TESTER/run/TEST_gpt_src.arb)
-
UNIT_TESTER/run/TEST_pt.arb (deleted)
-
UNIT_TESTER/run/TEST_pt_cleaned_expected.arb (copied) (copied from branches/dev/UNIT_TESTER/run/TEST_pt_cleaned_expected.arb) (3 diffs)
-
UNIT_TESTER/run/TEST_pt_src.arb (copied) (copied from branches/dev/UNIT_TESTER/run/TEST_pt_src.arb)
-
UNIT_TESTER/run/tools/arb_replace.in (copied) (copied from branches/dev/UNIT_TESTER/run/tools/arb_replace.in)
-
UNIT_TESTER/run/tools/gene_probe.arb (deleted)
-
UNIT_TESTER/run/tools/gene_probe_expected.arb (deleted)
-
UNIT_TESTER/test_unit.h (modified) (2 diffs)
-
lib/arb_tcp_org.dat (modified) (1 diff)
-
util/arb_srclst.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ARBDB/ad_prot.h
r8040 r8041 184 184 #ifdef UNIT_TESTS 185 185 #define TEST_SERVER_ID (-666) 186 #define TEST_GENESERVER_ID (-667) 186 187 #endif 187 188 … … 393 394 GB_ERROR GB_set_undo_mem(GBDATA *gbd, long memsize); 394 395 396 /* admap.cxx */ 397 bool GB_supports_mapfile(void); 398 395 399 /* adquery.cxx */ 396 400 const char *GB_get_GBDATA_path(GBDATA *gbd); -
trunk/ARBDB/ad_save_load.cxx
r8037 r8041 1297 1297 1298 1298 // #define TEST_AUTO_UPDATE // uncomment to auto-update binary and quicksave testfiles (needed once after changing ascii testfile or modify_db()) 1299 #define TEST_copy(src, dst) TEST_ASSERT(system(GBS_global_string("cp '%s' '%s'", src, dst)) == 0)1300 1299 1301 1300 #define TEST_loadsave_CLEANUP() TEST_ASSERT(system("rm -f [ab]2[ab]*.* master.* slave.* renamed.* fast.* fast2b.* TEST_loadsave.ARF") == 0) … … 1373 1372 1374 1373 #if defined(TEST_AUTO_UPDATE) 1375 TEST_ copy("a2b.a00", "TEST_loadsave_quick.a00");1374 TEST_COPY_FILE("a2b.a00", "TEST_loadsave_quick.a00"); 1376 1375 #endif // TEST_AUTO_UPDATE 1377 1376 -
trunk/ARBDB/admap.cxx
r7667 r8041 674 674 } 675 675 676 bool GB_supports_mapfile() { 677 #if (MEMORY_TEST == 1) 678 return false; 679 #else 680 return true; 681 #endif 682 } 683 676 684 int gb_is_valid_mapfile(const char *path, gb_map_header *mheader, int verbose) { 677 685 /* Test whether mapfile is valid -
trunk/ARBDB/adsocket.cxx
r8036 r8041 1194 1194 GB_ULONG usedmemsize = (MIN(net_memsize, max_malloc)*95)/100; // arb uses max. 95 % of available memory (was 70% in the past) 1195 1195 1196 #if defined(DEBUG) 1196 #if defined(DEBUG) && 0 1197 1197 printf("- memsize(real) = %20lu k\n", memsize); 1198 1198 printf("- memsize(net) = %20lu k\n", net_memsize); 1199 1199 printf("- memsize(max_malloc) = %20lu k\n", max_malloc); 1200 printf("- memsize(used by ARB) = %20lu k\n", usedmemsize); 1200 1201 #endif // DEBUG 1201 printf("- memsize(used by ARB) = %20lu k\n", usedmemsize);1202 1202 1203 1203 arb_assert(usedmemsize != 0); -
trunk/ARBDB/adtcp.cxx
r8036 r8041 304 304 // AISC_MKPT_PROMOTE:#ifdef UNIT_TESTS 305 305 // AISC_MKPT_PROMOTE:#define TEST_SERVER_ID (-666) 306 // AISC_MKPT_PROMOTE:#define TEST_GENESERVER_ID (-667) 306 307 // AISC_MKPT_PROMOTE:#endif 307 308 … … 317 318 const char *GBS_ptserver_tag(int id) { 318 319 #ifdef UNIT_TESTS 319 if (id == TEST_SERVER_ID) { 320 return "ARB_TEST_PT_SERVER"; 321 } 320 if (id == TEST_SERVER_ID) return "ARB_TEST_PT_SERVER"; 321 if (id == TEST_GENESERVER_ID) return "ARB_TEST_PT_SERVER_GENE"; 322 322 #endif // UNIT_TESTS 323 323 gb_assert(id >= 0); -
trunk/ARBDB/gb_memory.h
r7201 r8041 27 27 #if defined(UNIT_TESTS) 28 28 #undef MEMORY_TEST 29 #define MEMORY_TEST 0 // test mmapped-DB version in unittests 29 #define MEMORY_TEST 0 // test mmapped-DB version in unittests (recommended setting) 30 30 // #define MEMORY_TEST 1 // test DEBUG DB version in unittests 31 31 #endif -
trunk/Makefile
r8039 r8041 1039 1039 SERVERCNTRL/SERVERCNTRL.a \ 1040 1040 SL/HELIX/HELIX.a \ 1041 SL/PTCLEAN/PTCLEAN.a \ 1041 1042 1042 1043 ARCHS_PROBE_LINK = \ … … 1843 1844 PHYLO/PHYLO.test \ 1844 1845 PRIMER_DESIGN/PRIMER_DESIGN.test \ 1845 PROBE/PROBE.test \1846 1846 PROBE_DESIGN/PROBE_DESIGN.test \ 1847 1847 ptpan/PROBE.test \ … … 1911 1911 CONVERTALN/CONVERTALN.test \ 1912 1912 SL/SEQIO/SEQIO.test \ 1913 SL/PTCLEAN/PTCLEAN.test \ 1914 PROBE/PROBE.test \ 1913 1915 1914 1916 TESTED_UNITS_MANUAL = \ -
trunk/PROBE/Makefile
r7937 r8041 27 27 28 28 proto: 29 ../AISC_MKPTPS/aisc_mkpt - G -E -z -A -w pt_prototypes.h $(OBJECTS:.o=.cxx) probe_tree.h >pt_prototypes.h.tmp29 ../AISC_MKPTPS/aisc_mkpt -P -G -E -z -A -w pt_prototypes.h $(OBJECTS:.o=.cxx) probe_tree.h >pt_prototypes.h.tmp 30 30 ../SOURCE_TOOLS/mv_if_diff pt_prototypes.h.tmp pt_prototypes.h 31 31 … … 57 57 PT_buildtree.o: $(ARBHOME)/INCLUDE/arb_assert.h 58 58 PT_buildtree.o: $(ARBHOME)/INCLUDE/arb_core.h 59 PT_buildtree.o: $(ARBHOME)/INCLUDE/arb_defs.h 59 60 PT_buildtree.o: $(ARBHOME)/INCLUDE/arb_error.h 60 61 PT_buildtree.o: $(ARBHOME)/INCLUDE/arb_msg.h … … 73 74 PT_buildtree.o: $(ARBHOME)/INCLUDE/static_assert.h 74 75 PT_buildtree.o: $(ARBHOME)/INCLUDE/test_global.h 76 PT_buildtree.o: $(ARBHOME)/INCLUDE/test_unit.h 75 77 76 78 PT_debug.o: probe.h … … 202 204 PT_main.o: $(ARBHOME)/INCLUDE/arb_assert.h 203 205 PT_main.o: $(ARBHOME)/INCLUDE/arb_core.h 206 PT_main.o: $(ARBHOME)/INCLUDE/arb_defs.h 204 207 PT_main.o: $(ARBHOME)/INCLUDE/arb_error.h 205 208 PT_main.o: $(ARBHOME)/INCLUDE/arb_msg.h … … 218 221 PT_main.o: $(ARBHOME)/INCLUDE/PT_server.h 219 222 PT_main.o: $(ARBHOME)/INCLUDE/PT_server_prototypes.h 223 PT_main.o: $(ARBHOME)/INCLUDE/ptclean.h 220 224 PT_main.o: $(ARBHOME)/INCLUDE/server.h 221 225 PT_main.o: $(ARBHOME)/INCLUDE/servercntrl.h -
trunk/PROBE/PT_buildtree.cxx
r7937 r8041 13 13 #include "probe_tree.h" 14 14 #include "pt_prototypes.h" 15 #include "arb_defs.h" 15 16 16 17 #include <arb_progress.h> … … 18 19 #include <unistd.h> 19 20 20 POS_TREE *build_pos_tree (POS_TREE *pt, int anfangs_pos, int apos, int RNS_nr, unsigned int end) 21 { 22 static POS_TREE *pthelp, *pt_next; 23 unsigned int i, j; 24 int height = 0, anfangs_apos_ref, anfangs_rpos_ref, RNS_nr_ref; 25 pthelp = pt; 26 i = anfangs_pos; 27 while (PT_read_type(pthelp) == PT_NT_NODE) { // now we got an inner node 28 if ((pt_next = PT_read_son_stage_1(psg.ptmain, pthelp, (PT_BASES)psg.data[RNS_nr].data[i])) == NULL) { 29 // there is no son of that type -> simply add the new son to that path // 30 if (pthelp == pt) { // now we create a new root structure (size will change) 31 PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr].data[i], anfangs_pos, apos, RNS_nr); 32 return pthelp; // return the new root 33 } 34 else { 35 PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr].data[i], anfangs_pos, apos, RNS_nr); 36 return pt; // return the old root 37 } 21 // AISC_MKPT_PROMOTE: class DataLoc; 22 23 static POS_TREE *build_pos_tree(POS_TREE *const root, const DataLoc& loc) { 24 POS_TREE *at = root; 25 int height = 0; 26 27 while (PT_read_type(at) == PT_NT_NODE) { // now we got an inner node 28 POS_TREE *pt_next = PT_read_son_stage_1(at, loc[height]); 29 if (!pt_next) { // there is no son of that type -> simply add the new son to that path // 30 bool atRoot = (at == root); 31 PT_create_leaf(&at, loc[height], loc); 32 return atRoot ? at : root; // inside tree return old root, otherwise new root has been created 38 33 } 39 34 else { // go down the tree 40 pthelp= pt_next;35 at = pt_next; 41 36 height++; 42 i++; 43 if (i >= end) { // end of sequence reached -> change node to chain and add 44 // should never be reached, because of the terminal symbol 45 // of each sequence 46 if (PT_read_type(pthelp) == PT_NT_CHAIN) 47 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos); 37 38 if (loc.is_shorther_than(height)) { 39 // end of sequence reached -> change node to chain and add 40 // should never be reached, because of the terminal symbol of each sequence (@@@ this IS reached - even with unittestdb) 41 if (PT_read_type(at) == PT_NT_CHAIN) { 42 PT_add_to_chain(at, loc); 43 } 48 44 // if type == node then forget it 49 return pt; 50 } 51 } 52 } 53 // type == leaf or chain 54 if (PT_read_type(pthelp) == PT_NT_CHAIN) { // old chain reached 55 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos); 56 return pt; 57 } 58 anfangs_rpos_ref = PT_read_rpos(psg.ptmain, pthelp); // change leave to node and create two sons 59 anfangs_apos_ref = PT_read_apos(psg.ptmain, pthelp); 60 RNS_nr_ref = PT_read_name(psg.ptmain, pthelp); 61 j = anfangs_rpos_ref + height; 62 63 while (psg.data[RNS_nr].data[i] == psg.data[RNS_nr_ref].data[j]) { // creates nodes until sequences are different 64 // type != nt_node 65 if (PT_read_type(pthelp) == PT_NT_CHAIN) { // break 66 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos); 67 return pt; 45 return root; 46 } 47 } 48 } 49 50 // type == leaf or chain 51 if (PT_read_type(at) == PT_NT_CHAIN) { // old chain reached 52 PT_add_to_chain(at, loc); 53 return root; 54 } 55 56 // change leave to node and create two sons 57 58 const DataLoc loc_ref(at); 59 60 while (loc[height] == loc_ref[height]) { // creates nodes until sequences are different 61 // type != nt_node 62 if (PT_read_type(at) == PT_NT_CHAIN) { 63 PT_add_to_chain(at, loc); 64 return root; 68 65 } 69 66 if (height >= PT_POS_TREE_HEIGHT) { 70 if (PT_read_type(pthelp) == PT_NT_LEAF) { 71 pthelp = PT_leaf_to_chain(psg.ptmain, pthelp); 72 } 73 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos); 74 return pt; 75 } 76 if (((i + 1) >= end) && (j + 1 >= (unsigned)(psg.data[RNS_nr_ref].size))) { // end of both sequences 77 return pt; 78 } 79 pthelp = PT_change_leaf_to_node(psg.ptmain, pthelp); // change tip to node and append two new leafs 80 if (i + 1 >= end) { // end of source sequence reached 81 pthelp = PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr_ref].data[j], 82 anfangs_rpos_ref, anfangs_apos_ref, RNS_nr_ref); 83 return pt; 84 } 85 if (j + 1 >= (unsigned)(psg.data[RNS_nr_ref].size)) { // end of reference sequence 86 pthelp = PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr].data[i], anfangs_pos, apos, RNS_nr); 87 return pt; 88 } 89 pthelp = PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr].data[i], anfangs_rpos_ref, anfangs_apos_ref, RNS_nr_ref); 90 // dummy leaf just to create a new node; may become a chain 91 i++; 92 j++; 67 if (PT_read_type(at) == PT_NT_LEAF) { 68 at = PT_leaf_to_chain(at); 69 } 70 PT_add_to_chain(at, loc); 71 return root; 72 } 73 74 bool loc_done = loc.is_shorther_than(height+1); 75 bool ref_done = loc_ref.is_shorther_than(height+1); 76 77 if (ref_done && loc_done) return root; // end of both sequences 78 79 at = PT_change_leaf_to_node(at); // change tip to node and append two new leafs 80 if (loc_done) { // end of source sequence reached 81 PT_create_leaf(&at, loc_ref[height], loc_ref); 82 return root; 83 } 84 if (ref_done) { // end of reference sequence 85 PT_create_leaf(&at, loc[height], loc); 86 return root; 87 } 88 at = PT_create_leaf(&at, loc[height], loc_ref); // dummy leaf just to create a new node; may become a chain 93 89 height++; 94 90 } 91 92 93 95 94 if (height >= PT_POS_TREE_HEIGHT) { 96 if (PT_read_type( pthelp) == PT_NT_LEAF)97 pthelp = PT_leaf_to_chain(psg.ptmain, pthelp);98 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos);99 return pt;100 }101 if (PT_read_type(pthelp) == PT_NT_CHAIN) {102 pthelp = PT_add_to_chain(psg.ptmain, pthelp, RNS_nr, apos, anfangs_pos);95 if (PT_read_type(at) == PT_NT_LEAF) at = PT_leaf_to_chain(at); 96 PT_add_to_chain(at, loc); 97 return root; 98 } 99 if (PT_read_type(at) == PT_NT_CHAIN) { 100 // not covered by test - but looks similar to case in top-loop 101 PT_add_to_chain(at, loc); 103 102 } 104 103 else { 105 pthelp = PT_change_leaf_to_node(psg.ptmain, pthelp); // Blatt loeschen 106 PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr].data[i], anfangs_pos, apos, RNS_nr); // zwei neue Blaetter 107 PT_create_leaf(psg.ptmain, &pthelp, (PT_BASES)psg.data[RNS_nr_ref].data[j], anfangs_rpos_ref, anfangs_apos_ref, RNS_nr_ref); 108 } 109 return pt; 110 } 104 at = PT_change_leaf_to_node(at); // delete leaf 105 PT_create_leaf(&at, loc[height], loc); // two new leafs 106 PT_create_leaf(&at, loc_ref[height], loc_ref); 107 } 108 return root; 109 } 110 111 111 112 112 inline void get_abs_align_pos(char *seq, int &pos) … … 147 147 } 148 148 149 long PTD_save_partial_tree(FILE *out, P TM2 *ptmain, POS_TREE * node, char *partstring, int partsize, long pos, long *ppos, ARB_ERROR& error) {149 long PTD_save_partial_tree(FILE *out, POS_TREE * node, char *partstring, int partsize, long pos, long *ppos, ARB_ERROR& error) { 150 150 if (partsize) { 151 POS_TREE *son = PT_read_son( ptmain,node, (PT_BASES)partstring[0]);151 POS_TREE *son = PT_read_son(node, (PT_BASES)partstring[0]); 152 152 if (son) { 153 pos = PTD_save_partial_tree(out, ptmain,son, partstring+1, partsize-1, pos, ppos, error);153 pos = PTD_save_partial_tree(out, son, partstring+1, partsize-1, pos, ppos, error); 154 154 } 155 155 } 156 156 else { 157 PTD_clear_fathers( ptmain,node);157 PTD_clear_fathers(node); 158 158 long r_pos; 159 159 int blocked; … … 165 165 fflush(stdout); 166 166 #endif 167 r_pos = PTD_write_leafs_to_disk(out, ptmain,node, pos, ppos, &blocked, error);167 r_pos = PTD_write_leafs_to_disk(out, node, pos, ppos, &blocked, error); 168 168 if (r_pos > pos) pos = r_pos; 169 169 } … … 221 221 psg.ptmain->stage1 = 1; // enter stage 1 222 222 223 pt = PT_create_leaf( psg.ptmain, NULL, PT_N, 0, 0, 0); // create main node224 pt = PT_change_leaf_to_node(p sg.ptmain, pt);223 pt = PT_create_leaf(NULL, PT_N, DataLoc(0, 0, 0)); // create main node 224 pt = PT_change_leaf_to_node(pt); 225 225 psg.stat.cut_offs = 0; // statistic information 226 226 GB_begin_transaction(psg.gb_main); … … 267 267 268 268 int abs_align_pos = psize-1; 269 for (int j = psg.data[i]. size- 1; j >= 0; j--, abs_align_pos--) {269 for (int j = psg.data[i].get_size() - 1; j >= 0; j--, abs_align_pos--) { 270 270 get_abs_align_pos(align_abs, abs_align_pos); // may result in neg. abs_align_pos (seems to happen if sequences are short < 214bp ) 271 271 if (abs_align_pos < 0) break; // -> in this case abort 272 272 273 if (partsize && (*partstring != psg.data[i]. data[j] || strncmp(partstring, psg.data[i].data+j, partsize))) continue;274 if (ptd_string_shorter_than(psg.data[i]. data+j, 9)) continue;275 276 pt = build_pos_tree(pt, j, abs_align_pos, i, psg.data[i].size);273 if (partsize && (*partstring != psg.data[i].get_data()[j] || strncmp(partstring, psg.data[i].get_data()+j, partsize))) continue; 274 if (ptd_string_shorter_than(psg.data[i].get_data()+j, 9)) continue; 275 276 pt = build_pos_tree(pt, DataLoc(i, abs_align_pos, j)); 277 277 } 278 278 free(align_abs); … … 280 280 ++data_progress; 281 281 } 282 pos = PTD_save_partial_tree(out, p sg.ptmain, pt, partstring, partsize, pos, &last_obj, error);282 pos = PTD_save_partial_tree(out, pt, partstring, partsize, pos, &last_obj, error); 283 283 if (error) break; 284 284 … … 292 292 if (!error) { 293 293 if (partsize) { 294 pos = PTD_save_partial_tree(out, p sg.ptmain, pt, NULL, 0, pos, &last_obj, error);294 pos = PTD_save_partial_tree(out, pt, NULL, 0, pos, &last_obj, error); 295 295 #ifdef PTM_DEBUG 296 296 PTM_debug_mem(); … … 377 377 } 378 378 else { 379 error = PTD_read_leafs_from_disk(tname, psg.ptmain,&psg.pt);379 error = PTD_read_leafs_from_disk(tname, &psg.pt); 380 380 fclose(in); 381 381 } … … 385 385 } 386 386 387 // -------------------------------------------------------------------------------- 388 389 #ifdef UNIT_TESTS 390 #ifndef TEST_UNIT_H 391 #include <test_unit.h> 392 #endif 393 394 int main(int argc, const char*argv[]); 395 void NOTEST_SLOW_maybe_build_tree() { 396 // does only test sth if DB is present. 397 398 const char *dbarg = "-D" "extra_pt_src.arb"; 399 const char *testDB = dbarg+2; 400 const char *resultPT = "extra_pt_src.arb.pt"; 401 const char *expectedPT = "extra_pt_src.arb_expected.pt"; 402 bool exists = GB_is_regularfile(testDB); 403 404 if (exists) { 405 const char *argv[] = { 406 "fake_pt_server", 407 "-build", 408 dbarg, 409 }; 410 411 #if 1 412 // build 413 int res = main(ARRAY_ELEMS(argv), argv); 414 TEST_ASSERT_EQUAL(res, EXIT_SUCCESS); 415 #endif 416 417 // #define TEST_AUTO_UPDATE 418 #if defined(TEST_AUTO_UPDATE) 419 TEST_COPY_FILE(resultPT, expectedPT); 420 #else // !defined(TEST_AUTO_UPDATE) 421 TEST_ASSERT_FILES_EQUAL(resultPT, expectedPT); 422 #endif 423 } 424 } 425 426 #endif // UNIT_TESTS 427 428 // -------------------------------------------------------------------------------- -
trunk/PROBE/PT_debug.cxx
r7812 r8041 47 47 basecnt = 0; 48 48 for (i=PT_QU; i<PT_B_MAX; i++) { 49 if ((pt_help = PT_read_son(p sg.ptmain, pt, (PT_BASES)i)))49 if ((pt_help = PT_read_son(pt, (PT_BASES)i))) 50 50 { 51 51 basecnt++; … … 61 61 ptds->chains[height]++; 62 62 psg.height = 0; 63 PT_forwhole_chain(p sg.ptmain, pt, PT_chain_count());63 PT_forwhole_chain(pt, PT_chain_count()); 64 64 if (psg.height >= DEBUG_MAX_CHAIN_SIZE) psg.height = DEBUG_MAX_CHAIN_SIZE; 65 65 ptds->chainsizes[psg.height][height]++; … … 68 68 if (ptds->chaincount<20) { 69 69 printf("\n\n\n\n"); 70 PT_forwhole_chain(p sg.ptmain, pt, PTD_chain_print());70 PT_forwhole_chain(pt, PTD_chain_print()); 71 71 } 72 72 break; … … 140 140 struct probe_input_data& data = psg.data[leaf.name]; 141 141 142 PT_BASES b = (PT_BASES)data. data[leaf.rpos];143 144 printf("%s[%c] %s apos=%i rpos=%i\n", prefix, PT_BASES_2_char(b), data. name, leaf.apos, leaf.rpos);142 PT_BASES b = (PT_BASES)data.get_data()[leaf.rpos]; 143 144 printf("%s[%c] %s apos=%i rpos=%i\n", prefix, PT_BASES_2_char(b), data.get_name(), leaf.apos, leaf.rpos); 145 145 return 0; 146 146 } … … 152 152 switch (PT_read_type(pt)) { 153 153 case PT_NT_NODE: 154 for (int i = PT_ N; i<PT_B_MAX; i++) {154 for (int i = PT_QU; i<PT_B_MAX; i++) { 155 155 PT_BASES b = PT_BASES(i); 156 POS_TREE *son = PT_read_son(p sg.ptmain, pt, b);156 POS_TREE *son = PT_read_son(pt, b); 157 157 if (son) { 158 char *subPrefix = GBS_global_string_copy("%s%c", prefix, PT_BASES_2_char(b));158 char *subPrefix = GBS_global_string_copy("%s%c", prefix, b == PT_QU ? '.' : PT_BASES_2_char(b)); 159 159 PT_dump_POS_TREE_recursive(son, subPrefix); 160 160 free(subPrefix); … … 163 163 break; 164 164 case PT_NT_LEAF: { 165 PT_dump_leaf dump_leaf(prefix); 166 dump_leaf(DataLoc(psg.ptmain, pt)); 167 break; 168 } 169 case PT_NT_CHAIN: 170 PT_forwhole_chain(psg.ptmain, pt, PT_dump_leaf(prefix)); 171 break; 165 char *subPrefix = GBS_global_string_copy("{l} %s", prefix); 166 PT_dump_leaf dump_leaf(subPrefix); 167 dump_leaf(DataLoc(pt)); 168 free(subPrefix); 169 break; 170 } 171 case PT_NT_CHAIN: { 172 char *subPrefix = GBS_global_string_copy("{c} %s", prefix); 173 PT_forwhole_chain(pt, PT_dump_leaf(subPrefix)); 174 free(subPrefix); 175 break; 176 } 172 177 default: 173 178 printf("%s [unhandled]\n", prefix); … … 183 188 // Debug function for all stages 184 189 #if defined(DEBUG) 185 long i;186 PTM2 *ptmain = psg.ptmain;187 190 if (!node) printf("Zero node\n"); 188 PT_READ_PNTR(&node->data, i); 189 printf("node father 0x%lx\n", i); 191 192 { 193 long i; 194 PT_READ_PNTR(&node->data, i); 195 printf("node father 0x%lx\n", i); 196 } 197 190 198 switch (PT_read_type(node)) { 191 case PT_NT_LEAF: 192 printf("leaf %i:%i,%i\n", PT_read_name(ptmain, node), 193 PT_read_rpos(ptmain, node), PT_read_apos(ptmain, node)); 194 break; 199 case PT_NT_LEAF: { 200 DataLoc loc(node); 201 printf("leaf %i:%i,%i\n", loc.name, loc.rpos, loc.apos); 202 break; 203 } 195 204 case PT_NT_NODE: 196 for ( i = 0; i < PT_B_MAX; i++) {197 printf("%6li:0x%p\n", i, PT_read_son( ptmain,node, (PT_BASES)i));205 for (long i = 0; i < PT_B_MAX; i++) { 206 printf("%6li:0x%p\n", i, PT_read_son(node, (PT_BASES)i)); 198 207 } 199 208 break; 200 209 case PT_NT_CHAIN: 201 210 printf("chain:\n"); 202 PT_forwhole_chain( ptmain,node, PTD_chain_print());211 PT_forwhole_chain(node, PTD_chain_print()); 203 212 break; 204 213 case PT_NT_SAVED: -
trunk/PROBE/PT_etc.cxx
r7986 r8041 72 72 } 73 73 74 const char *virt_name(PT_probematch *ml) 74 const char *virt_name(PT_probematch *ml) 75 75 { 76 76 // get the name with a virtual function 77 77 if (gene_flag) { 78 const gene_struct *gs = get_gene_struct_by_internal_gene_name(psg.data[ml->name]. name);78 const gene_struct *gs = get_gene_struct_by_internal_gene_name(psg.data[ml->name].get_name()); 79 79 return gs ? gs->get_arb_species_name() : "<cantResolveName>"; 80 80 } 81 81 else { 82 pt_assert(psg.data[ml->name]. name);83 return psg.data[ml->name]. name;84 } 85 } 86 87 const char *virt_fullname(PT_probematch * ml) 82 pt_assert(psg.data[ml->name].get_name()); 83 return psg.data[ml->name].get_name(); 84 } 85 } 86 87 const char *virt_fullname(PT_probematch * ml) 88 88 { 89 89 if (gene_flag) { 90 const gene_struct *gs = get_gene_struct_by_internal_gene_name(psg.data[ml->name]. name);90 const gene_struct *gs = get_gene_struct_by_internal_gene_name(psg.data[ml->name].get_name()); 91 91 return gs ? gs->get_arb_gene_name() : "<cantResolveGeneFullname>"; 92 92 } 93 93 else { 94 return psg.data[ml->name]. fullname ? psg.data[ml->name].fullname: "<undefinedFullname>";94 return psg.data[ml->name].get_fullname() ? psg.data[ml->name].get_fullname() : "<undefinedFullname>"; 95 95 } 96 96 } … … 163 163 // clear 'is_group' 164 164 for (int i = 0; i < psg.data_count; i++) { 165 psg.data[i]. is_group = 0; // Note: probes are designed for species with is_group == 1165 psg.data[i].set_group_state(0); // Note: probes are designed for species with is_group == 1 166 166 } 167 167 locs->group_count = 0; … … 212 212 const char *checksum = get_list_part(checksums, coff); 213 213 // if sequence checksum changed since pt server was updated -> not found 214 found = atol(checksum) == psg.data[idx]. checksum;214 found = atol(checksum) == psg.data[idx].get_checksum(); 215 215 } 216 216 else { … … 219 219 220 220 if (found) { 221 psg.data[idx]. is_group = 1; // mark221 psg.data[idx].set_group_state(1); // mark 222 222 locs->group_count++; 223 223 } -
trunk/PROBE/PT_family.cxx
r7933 r8041 22 22 inline void aisc_link(dll_public *dll, PT_family_list *family) { aisc_link(reinterpret_cast<dllpublic_ext*>(dll), reinterpret_cast<dllheader_ext*>(family)); } 23 23 24 25 class HitCounter { 26 int count; // Counter for matches 27 double rel_count; // match_count / (seq_len - probe_len + 1) 28 29 public: 30 HitCounter() : count(0), rel_count(0.0) {} 31 32 void inc() { count++; } 33 void calc_rel_match(int max_poss_matches) { 34 rel_count = max_poss_matches>0 ? double(count)/max_poss_matches : 0; 35 } 36 37 bool less_abs(const HitCounter& other) const { return count < other.count; } 38 bool less_rel(const HitCounter& other) const { return rel_count < other.rel_count; } 39 40 int get_match_count() const { return count; } 41 const double& get_rel_match_count() const { return rel_count; } 42 }; 43 44 class FamilyStat : virtual Noncopyable { 45 size_t size; 46 HitCounter *famstat; 47 48 public: 49 FamilyStat(size_t size_) : size(size_), famstat(new HitCounter[size]) { } 50 ~FamilyStat() { delete [] famstat; } 51 52 void calc_rel_matches(int probe_len, int sequence_length) { 53 for (size_t i = 0; i < size; i++) { 54 int max_poss_matches = std::min(psg.data[i].get_size(), sequence_length) - probe_len + 1; 55 famstat[i].calc_rel_match(max_poss_matches); 56 } 57 } 58 59 const HitCounter& hits(size_t idx) const { pt_assert(idx<size); return famstat[idx]; } 60 61 void count_match(size_t idx) { famstat[idx].inc(); } 62 63 bool less_abs(int a, int b) const { return famstat[a].less_abs(famstat[b]); } 64 bool less_rel(int a, int b) const { return famstat[a].less_rel(famstat[b]); } 65 }; 66 24 67 class ProbeTraversal { 25 68 static Range range; 26 69 27 static void count_match(const DataLoc& match) {28 if (range.contains(match)) {29 ++psg.data[match.name].stat.match_count;30 }31 }32 33 // ----------------------------------------34 35 70 const char *probe; 36 71 int height; 37 72 int needed_positions; 38 73 int accept_mismatches; 74 75 FamilyStat& fam_stat; 76 77 void count_match(const DataLoc& match) const { 78 if (range.contains(match)) { 79 fam_stat.count_match(match.name); 80 } 81 } 39 82 40 83 bool at_end() const { return *probe == PT_QU; } … … 55 98 56 99 void match_rest_and_mark(const DataLoc& loc) { 57 do match_one_char(psg.data[loc.name]. data[loc.rpos+height]); while (match_possible());100 do match_one_char(psg.data[loc.name].get_data()[loc.rpos+height]); while (match_possible()); 58 101 if (did_match()) count_match(loc); 59 102 } … … 69 112 range = Range(-1, -1, -1); 70 113 } 71 72 ProbeTraversal(const char *probe_, int needed_positions_, int accept_mismatches_ )114 115 ProbeTraversal(const char *probe_, int needed_positions_, int accept_mismatches_, FamilyStat& fam_stat_) 73 116 : probe(probe_), 74 117 height(0), 75 118 needed_positions(needed_positions_), 76 accept_mismatches(accept_mismatches_) 119 accept_mismatches(accept_mismatches_), 120 fam_stat(fam_stat_) 77 121 { } 78 122 … … 100 144 if (PT_read_type(pt) == PT_NT_NODE) { 101 145 for (int base = PT_N; base < PT_B_MAX; base++) { 102 POS_TREE *pt_son = PT_read_son(p sg.ptmain, pt, (PT_BASES)base);146 POS_TREE *pt_son = PT_read_son(pt, (PT_BASES)base); 103 147 if (pt_son && !at_end()) { 104 148 ProbeTraversal sub(*this); … … 112 156 } 113 157 else { 114 PT_withall_tips(p sg.ptmain, pt, *this); // calls operator()158 PT_withall_tips(pt, *this); // calls operator() 115 159 } 116 160 } … … 123 167 if (PT_read_type(pt) == PT_NT_NODE) { 124 168 for (int base = PT_N; base < PT_B_MAX; base++) { 125 POS_TREE *pt_son = PT_read_son(p sg.ptmain, pt, (PT_BASES)base);169 POS_TREE *pt_son = PT_read_son(pt, (PT_BASES)base); 126 170 if (pt_son) mark_all(pt_son); 127 171 } 128 172 } 129 173 else { 130 PT_withall_tips(psg.ptmain, pt, *this); // calls operator() 131 } 132 } 133 134 135 static void clear_statistic() { 136 //! Clear all information in psg.data[i].stat 137 138 for (int i = 0; i < psg.data_count; i++) { 139 memset((char *) &psg.data[i].stat, 0, sizeof(probe_statistic)); 140 } 141 } 142 143 144 145 static void make_match_statistic(int probe_len, int sequence_length) { 146 //! Calculate the statistic information for the family 147 148 // compute statistic for all species in family 149 for (int i = 0; i < psg.data_count; i++) { 150 int all_len = std::min(psg.data[i].size, sequence_length) - probe_len + 1; 151 if (all_len <= 0) { 152 psg.data[i].stat.rel_match_count = 0; 153 } 154 else { 155 psg.data[i].stat.rel_match_count = psg.data[i].stat.match_count / (double) (all_len); 156 } 174 PT_withall_tips(pt, *this); // calls operator() 157 175 } 158 176 } 159 177 160 178 struct cmp_probe_abs { 161 bool operator()(const struct probe_input_data* a, const struct probe_input_data* b) {162 return b->stat.match_count < a->stat.match_count;163 }179 const FamilyStat& fam_stat; 180 cmp_probe_abs(const FamilyStat& fam_stat_) : fam_stat(fam_stat_) {} 181 bool operator()(int a, int b) { return fam_stat.less_abs(b, a); } 164 182 }; 165 183 166 184 struct cmp_probe_rel { 167 bool operator()(const struct probe_input_data* a, const struct probe_input_data* b) {168 return b->stat.rel_match_count < a->stat.rel_match_count;169 }170 }; 171 172 static int make_PT_family_list(PT_family *ffinder ) {185 const FamilyStat& fam_stat; 186 cmp_probe_rel(const FamilyStat& fam_stat_) : fam_stat(fam_stat_) {} 187 bool operator()(int a, int b) { return fam_stat.less_rel(b, a); } 188 }; 189 190 static int make_PT_family_list(PT_family *ffinder, const FamilyStat& famStat) { 173 191 //! Make sorted list of family members 174 192 193 // destroy old list 194 while (ffinder->fl) destroy_PT_family_list(ffinder->fl); 195 175 196 // Sort the data 176 std::vector<struct probe_input_data*> my_list; 177 my_list.resize(psg.data_count); 178 179 for (int i = 0; i < psg.data_count; i++) { 180 my_list[i] = &psg.data[i]; 181 } 197 std::vector<int> sorted; 198 sorted.resize(psg.data_count); 199 200 for (int i = 0; i < psg.data_count; i++) sorted[i] = i; 182 201 183 202 bool sort_all = ffinder->sort_max == 0 || ffinder->sort_max >= psg.data_count; … … 185 204 if (ffinder->sort_type == 0) { 186 205 if (sort_all) { 187 std::sort( my_list.begin(), my_list.end(), cmp_probe_abs());206 std::sort(sorted.begin(), sorted.end(), cmp_probe_abs(famStat)); 188 207 } 189 208 else { 190 std::partial_sort( my_list.begin(), my_list.begin() + ffinder->sort_max, my_list.begin() + psg.data_count, cmp_probe_abs());209 std::partial_sort(sorted.begin(), sorted.begin() + ffinder->sort_max, sorted.begin() + psg.data_count, cmp_probe_abs(famStat)); 191 210 } 192 211 } 193 212 else { 194 213 if (sort_all) { 195 std::sort( my_list.begin(), my_list.begin() + psg.data_count, cmp_probe_rel());214 std::sort(sorted.begin(), sorted.begin() + psg.data_count, cmp_probe_rel(famStat)); 196 215 } 197 216 else { 198 std::partial_sort(my_list.begin(), my_list.begin() + ffinder->sort_max, my_list.begin() + psg.data_count, cmp_probe_rel()); 199 } 200 } 201 202 // destroy old list 203 while (ffinder->fl) destroy_PT_family_list(ffinder->fl); 217 std::partial_sort(sorted.begin(), sorted.begin() + ffinder->sort_max, sorted.begin() + psg.data_count, cmp_probe_rel(famStat)); 218 } 219 } 204 220 205 221 // build new list … … 208 224 int end = (sort_all) ? psg.data_count : ffinder->sort_max; 209 225 for (int i = 0; i < end; i++) { 210 if (my_list[i]->stat.match_count != 0) { 226 probe_input_data& pid = psg.data[sorted[i]]; 227 const HitCounter& ps = famStat.hits(sorted[i]); 228 229 if (ps.get_match_count() != 0) { 211 230 PT_family_list *fl = create_PT_family_list(); 212 231 213 fl->name = strdup( my_list[i]->name);214 fl->matches = my_list[i]->stat.match_count;215 fl->rel_matches = my_list[i]->stat.rel_match_count;232 fl->name = strdup(pid.get_name()); 233 fl->matches = ps.get_match_count(); 234 fl->rel_matches = ps.get_rel_match_count(); 216 235 217 236 aisc_link(&ffinder->pfl, fl); … … 263 282 int sequence_len = probe_compress_sequence(sequence, species->size); 264 283 265 clear_statistic();266 267 284 // if find_type > 0 -> search only probes starting with 'A' (quick but less accurate) 268 285 char last_first_c = ffinder->find_type ? PT_A : PT_T; … … 270 287 ProbeTraversal::restrictMatchesToRegion(ffinder->range_start, ffinder->range_end, probe_len); 271 288 289 FamilyStat famStat(psg.data_count); 290 272 291 // Note: code depends on order of ../AWTC/awtc_next_neighbours.hxx@FF_complement_dep 273 292 for (int cmode = 1; cmode <= 8; cmode *= 2) { … … 290 309 for (char *probe = sequence; probe < last_probe; ++probe) { 291 310 if (probe_is_ok(probe, probe_len, first_c, second_c)) { 292 ProbeTraversal(probe, probe_len, mismatch_nr ).mark_matching(psg.pt);311 ProbeTraversal(probe, probe_len, mismatch_nr, famStat).mark_matching(psg.pt); 293 312 } 294 313 } … … 298 317 } 299 318 300 make_match_statistic(ffinder->pr_len, sequence_len);301 make_PT_family_list(ffinder );319 famStat.calc_rel_matches(ffinder->pr_len, sequence_len); 320 make_PT_family_list(ffinder, famStat); 302 321 303 322 ProbeTraversal::unrestrictMatchesToRegion(); -
trunk/PROBE/PT_findEx.cxx
r7415 r8041 21 21 case PT_NT_NODE: { 22 22 for (int i=PT_A; i<PT_B_MAX; ++i) { 23 POS_TREE *son = PT_read_son( psg.ptmain,node, PT_BASES(i));23 POS_TREE *son = PT_read_son(node, PT_BASES(i)); 24 24 if (son) { 25 25 probe[0] = PT_BASES(i); // write leftmost probe into result … … 37 37 case PT_NT_LEAF: { 38 38 // here the probe-tree is cut off, because only one species matches 39 int pos = PT_read_rpos(psg.ptmain, node) + height; 40 int name = PT_read_name(psg.ptmain, node); 41 if (pos + restlen >= psg.data[name].size) 39 DataLoc loc(node); 40 int pos = loc.rpos + height; 41 int name = loc.name; 42 43 if (pos + restlen >= psg.data[name].get_size()) 42 44 break; // at end-of-sequence -> no probe with wanted length here 43 45 44 46 pt_assert(probe[restlen] == 0); 45 const char *seq_data = psg.data[name]. data;47 const char *seq_data = psg.data[name].get_data(); 46 48 for (int r = 0; r<restlen; ++r) { 47 49 int data = seq_data[pos+r]; … … 70 72 switch (PT_read_type(node)) { 71 73 case PT_NT_NODE: { 72 POS_TREE *son = PT_read_son( psg.ptmain,node, PT_BASES(probe[0]));74 POS_TREE *son = PT_read_son(node, PT_BASES(probe[0])); 73 75 bool found = (son != 0) && findNextProbe(son, probe+1, restlen-1, height+1); 74 76 … … 77 79 if (!found) { 78 80 for (int i=probe[0]+1; !found && i<PT_B_MAX; ++i) { 79 son = PT_read_son( psg.ptmain,node, PT_BASES(i));81 son = PT_read_son(node, PT_BASES(i)); 80 82 if (son) { 81 83 probe[0] = PT_BASES(i); // change probe -
trunk/PROBE/PT_io.cxx
r7933 r8041 71 71 } 72 72 73 ARB_ERROR probe_read_data_base(const char *name ) { // goes to header: __ATTR__USERESULT73 ARB_ERROR probe_read_data_base(const char *name, bool readOnly) { // goes to header: __ATTR__USERESULT 74 74 ARB_ERROR error; 75 75 GB_set_verbose(); … … 77 77 psg.gb_shell = new GB_shell; 78 78 79 GBDATA *gb_main = GB_open(name, "r");79 GBDATA *gb_main = GB_open(name, readOnly ? "r" : "rw"); 80 80 if (!gb_main) error = GB_await_error(); 81 81 else { … … 195 195 } 196 196 197 char *probe_ read_alignment(int j, int *psize){197 char *probe_input_data::read_alignment(int *psize) const { 198 198 char *buffer = 0; 199 GBDATA *gb_species = psg.data[j].gbd;199 GBDATA *gb_species = get_gbdata(); 200 200 GB_transaction ta(gb_species); 201 201 GBDATA *gb_ali = GB_entry(gb_species, psg.alignment_name); … … 206 206 } 207 207 return buffer; 208 } 209 210 char *probe_read_alignment(int j, int *psize) { 211 return psg.data[j].read_alignment(psize); 212 } 213 214 GB_ERROR probe_input_data::init(GBDATA *gb_species) { 215 GB_ERROR error = NULL; 216 GBDATA *gb_ali = GB_entry(gb_species, psg.alignment_name); 217 GBDATA *gb_data = gb_ali ? GB_entry(gb_ali, "data") : NULL; 218 219 if (!gb_data) { 220 error = GBS_global_string("Species '%s' has no data in '%s'\n", GBT_read_name(gb_species), psg.alignment_name); 221 } 222 else { 223 int hsize; 224 char *sdata = probe_read_string_append_point(gb_data, &hsize); 225 226 if (!sdata) { 227 error = GBS_global_string("Could not read data in '%s' for species '%s'\n(Reason: %s)\n", 228 psg.alignment_name, GBT_read_name(gb_species), GB_await_error()); 229 } 230 else { 231 name = strdup(GBT_read_name(gb_species)); 232 233 fullname = GBT_read_string(gb_species, "full_name"); 234 if (!fullname) fullname = strdup(""); 235 236 gbd = gb_species; 237 238 set_checksum(GB_checksum(sdata, hsize, 1, ".-")); 239 int csize = probe_compress_sequence(sdata, hsize); 240 241 set_data(GB_memdup(sdata, csize), csize); 242 free(sdata); 243 } 244 } 245 246 return error; 208 247 } 209 248 … … 230 269 int icount = GB_number_of_subentries(psg.gb_species_data); 231 270 232 psg.data = (probe_input_data *)calloc(sizeof(probe_input_data), icount);271 psg.data = new probe_input_data[icount]; 233 272 psg.data_count = 0; 234 273 … … 246 285 probe_input_data& pid = psg.data[count]; 247 286 248 pid.name = strdup(GBT_read_name(gb_species)); 249 pid.fullname = GBT_read_string(gb_species, "full_name"); 250 251 if (!pid.fullname) pid.fullname = strdup(""); 252 253 pid.is_group = 1; 254 pid.gbd = gb_species; 255 256 GBDATA *gb_ali = GB_entry(gb_species, psg.alignment_name); 257 GBDATA *gb_data = gb_ali ? GB_entry(gb_ali, "data") : NULL; 258 if (!gb_data) { 259 fprintf(stderr, "Species '%s' has no data in '%s'\n", pid.name, psg.alignment_name); 287 GB_ERROR error = pid.init(gb_species); 288 if (error) { 289 fputs(error, stderr); 290 fputc('\n', stderr); 260 291 data_missing++; 261 292 } 262 293 else { 263 int hsize; 264 char *data = probe_read_string_append_point(gb_data, &hsize); 265 266 if (!data) { 267 GB_ERROR error = GB_await_error(); 268 fprintf(stderr, "Could not read data in '%s' for species '%s'\n(Reason: %s)\n", 269 psg.alignment_name, pid.name, error); 270 data_missing++; 271 } 272 else { 273 pid.checksum = GB_checksum(data, hsize, 1, ".-"); 274 int size = probe_compress_sequence(data, hsize); 275 276 pid.data = GB_memdup(data, size); 277 pid.size = size; 278 279 free(data); 280 count++; 281 } 282 294 count++; 283 295 } 284 296 progress.inc(); … … 306 318 psg.namehash = GBS_create_hash(psg.data_count, GB_MIND_CASE); 307 319 for (i=0; i<psg.data_count; i++) { 308 GBS_write_hash(psg.namehash, psg.data[i]. name, i+1);320 GBS_write_hash(psg.namehash, psg.data[i].get_name(), i+1); 309 321 } 310 322 unsigned int max_size; 311 323 max_size = 0; 312 324 for (i = 0; i < psg.data_count; i++) { // get max sequence len 313 max_size = std::max(max_size, (unsigned)(psg.data[i]. size));314 psg.char_count += psg.data[i]. size;325 max_size = std::max(max_size, (unsigned)(psg.data[i].get_size())); 326 psg.char_count += psg.data[i].get_size(); 315 327 } 316 328 psg.max_size = max_size; -
trunk/PROBE/PT_main.cxx
r7415 r8041 16 16 17 17 #include <arbdbt.h> 18 #include <arb_defs.h> 18 19 #include <servercntrl.h> 19 20 #include <server.h> … … 21 22 #include <struct_man.h> 22 23 #include <ut_valgrinded.h> 24 #include <ptclean.h> 23 25 24 26 #include <unistd.h> … … 42 44 43 45 ARB_ERROR pt_init_main_struct(PT_main *, const char *filename) { // __ATTR__USERESULT 44 ARB_ERROR error = probe_read_data_base(filename );46 ARB_ERROR error = probe_read_data_base(filename, true); 45 47 if (!error) { 46 48 GB_begin_transaction(psg.gb_main); … … 67 69 // shutdown server 68 70 aisc_server_shutdown(psg.com_so); 69 PT_exit( EXIT_SUCCESS); // never returns70 return 0;71 PT_exit(); 72 exit(EXIT_SUCCESS); 71 73 } 72 74 … … 98 100 if (psg_initialized) { 99 101 if (psg.gb_main) { 100 int count = GB_number_of_subentries(psg.gb_species_data); 101 for (int i = 0; i < count; ++i) { 102 free(psg.data[i].data); 103 free(psg.data[i].name); 104 free(psg.data[i].fullname); 105 } 106 free(psg.data); 102 delete [] psg.data; 107 103 108 104 GB_close(psg.gb_main); … … 131 127 } 132 128 133 void PT_exit( int exitcode) { // goes to header: __ATTR__NORETURN129 void PT_exit() { 134 130 // unique exit point to ensure cleanup 135 131 if (aisc_main) destroy_PT_main(aisc_main); 136 132 if (psg_initialized) PT_exit_psg(); 137 133 PTM_finally_free_all_mem(); 138 exit(exitcode);139 134 } 140 135 … … 220 215 const char *map_str = GB_read_char_pntr(map_ptr_str); 221 216 222 parse_names_into_gene_struct(map_str, all_gene_structs);217 error = parse_names_into_gene_struct(map_str, all_gene_structs).deliver(); 223 218 224 219 // build indices : … … 309 304 if (update_reason) { 310 305 printf("- updating postree (Reason: %s)", update_reason); 311 char *build_cmd = GBS_global_string_copy("%s -build -D%s", exename, arbdb_name); 312 make_valgrinded_call(build_cmd); 313 error = GB_system(build_cmd); 314 free(build_cmd); 306 307 const char *build_step[] = { 308 "build_clean", 309 "build_map", 310 "build", 311 }; 312 313 for (size_t s = 0; !error && s<ARRAY_ELEMS(build_step); s++) { 314 if (s == 1 && !GB_supports_mapfile()) continue; // skip useless step 315 316 char *build_cmd = GBS_global_string_copy("%s -%s -D%s", exename, build_step[s], arbdb_name); 317 make_valgrinded_call(build_cmd); 318 error = GB_system(build_cmd); 319 free(build_cmd); 320 } 321 315 322 if (error) error = GBS_global_string("Failed to update postree (Reason: %s)", error.deliver()); 316 323 } … … 364 371 char *pt_name = GBS_global_string_copy("%s.pt", params->db_server); 365 372 366 if (strcmp(command, "-build") == 0) { // build command 373 if (strcmp(command, "-build_clean") == 0) { // cleanup source DB 374 error = probe_read_data_base(params->db_server, false); 375 if (!error) { 376 pt_assert(psg.gb_main); 377 error = prepare_ptserver_database(psg.gb_main, PTSERVER); 378 if (!error) { 379 const char *mode = "bf"; // save PT-server database withOUT! Fastload file 380 error = GB_save_as(psg.gb_main, params->db_server, mode); 381 } 382 } 383 } 384 else if (strcmp(command, "-build_map") == 0) { // create a clean mapfile for source DB 385 if (GB_supports_mapfile()) { 386 error = probe_read_data_base(params->db_server, false); 387 if (!error) { 388 pt_assert(psg.gb_main); 389 const char *mode = "bfm"; // save PT-server database with Fastload file 390 error = GB_save_as(psg.gb_main, params->db_server, mode); 391 } 392 } 393 else { 394 error = "Invalid invocation of -build_map (your ARB version does not support mapfiles)"; 395 } 396 } 397 else if (strcmp(command, "-build") == 0) { // build command 367 398 error = pt_init_main_struct(aisc_main, params->db_server); 368 399 if (error) error = GBS_global_string("Gave up (Reason: %s)", error.deliver()); … … 477 508 478 509 free_arb_params(params); 479 PT_exit(exitcode); 480 } 510 PT_exit(); 511 return exitcode; 512 } -
trunk/PROBE/PT_match.cxx
r7986 r8041 67 67 pos = matchLoc.rpos+psg.height; 68 68 height = psg.height; 69 while ((base=probe[height]) && (ref = psg.data[matchLoc.name]. data[pos])) {69 while ((base=probe[height]) && (ref = psg.data[matchLoc.name].get_data()[pos])) { 70 70 if (ref == PT_N || base == PT_N) { 71 71 // @@@ Warning: dupped code also counts PT_QU as mismatch! … … 124 124 int base; 125 125 int error; 126 int name, pos, rpos;127 126 PT_probematch *ml; 128 127 … … 135 134 } 136 135 if (PT_read_type(pt) == PT_NT_LEAF) { 137 name = PT_read_name(psg.ptmain, pt); 138 pos = PT_read_apos(psg.ptmain, pt); 139 rpos = PT_read_rpos(psg.ptmain, pt); 136 DataLoc loc(pt); 140 137 141 138 // @@@ dupped code from PT_store_match_in::operator() 142 139 ml = create_PT_probematch(); 143 140 144 ml->name = name;145 ml->b_pos = pos;141 ml->name = loc.name; 142 ml->b_pos = loc.apos; 146 143 ml->g_pos = -1; 147 ml->rpos = rpos;144 ml->rpos = loc.rpos; 148 145 ml->mismatches = psg.mismatches; 149 146 ml->wmismatches = psg.wmismatches; … … 158 155 if (PT_read_type(pt) == PT_NT_CHAIN) { 159 156 psg.probe = 0; 160 if (PT_forwhole_chain(p sg.ptmain, pt, PT_store_match_in(locs))) {157 if (PT_forwhole_chain(pt, PT_store_match_in(locs))) { 161 158 error = 1; 162 159 return 1; … … 165 162 else { 166 163 for (base = PT_QU; base< PT_B_MAX; base++) { 167 error = read_names_and_pos(locs, PT_read_son(p sg.ptmain, pt, (PT_BASES)base));164 error = read_names_and_pos(locs, PT_read_son(pt, (PT_BASES)base)); 168 165 if (error) return error; 169 166 } … … 197 194 if (PT_read_type(pt) == PT_NT_NODE && probe[height]) { 198 195 for (i=PT_N; i<PT_B_MAX; i++) { 199 if ((pthelp = PT_read_son(p sg.ptmain, pt, (PT_BASES)i))) {196 if ((pthelp = PT_read_son(pt, (PT_BASES)i))) { 200 197 new_N_mis = N_mismatches; 201 198 base = probe[height]; … … 232 229 // @@@ code here is duplicate of code in PT_store_match_in::operator() 233 230 234 pos = PT_read_rpos(psg.ptmain, pt) + height; 235 name = PT_read_name(psg.ptmain, pt); 231 DataLoc loc(pt); 232 pos = loc.rpos + height; 233 name = loc.name; 236 234 237 235 // @@@ recursive use of strlen with constant result (argh!) 238 if (pos + (int)(strlen(probe+height)) >= psg.data[name]. size) // end of sequence236 if (pos + (int)(strlen(probe+height)) >= psg.data[name].get_size()) // end of sequence 239 237 return 0; 240 238 241 239 while ((base = probe[height])) { 242 i = psg.data[name]. data[pos];240 i = psg.data[name].get_data()[pos]; 243 241 if (i == PT_N || base == PT_N || i == PT_QU || base == PT_QU) { 244 242 psg.N_mismatches = psg.N_mismatches + 1; … … 260 258 psg.probe = probe; 261 259 psg.height = height; 262 PT_forwhole_chain(p sg.ptmain, pt, PT_store_match_in(locs)); // @@@ why ignore result260 PT_forwhole_chain(pt, PT_store_match_in(locs)); // @@@ why ignore result 263 261 return 0; 264 262 } … … 444 442 pt_build_pos_to_weight((PT_MATCH_TYPE)locs->sort_by, probestring); 445 443 446 if (psg.deep >= 0) { 447 get_info_about_probe(locs, probestring, psg.pt, 0, 0.0, 0, 0); 448 } 449 else { 450 ptnd_new_match(locs, probestring); 451 } 444 pt_assert(psg.deep >= 0); // deep < 0 was used till [8011] to trigger "new match" (feature unused) 445 get_info_about_probe(locs, probestring, psg.pt, 0, 0.0, 0, 0); 446 452 447 if (locs->pm_reversed) { 453 448 psg.reversed = 1; 454 rev_pro = reverse_probe(probestring, 0);449 rev_pro = reverse_probe(probestring, 0); 455 450 complement_probe(rev_pro, 0); 456 451 freeset(locs->pm_csequence, psg.main_probe = strdup(rev_pro)); 457 if (psg.deep >= 0) { 458 get_info_about_probe(locs, rev_pro, psg.pt, 0, 0.0, 0, 0); 459 } 460 else { 461 ptnd_new_match(locs, rev_pro); 462 } 452 453 get_info_about_probe(locs, rev_pro, psg.pt, 0, 0.0, 0, 0); 463 454 free(rev_pro); 464 455 } … … 564 555 pr_pos--, al_pos--) 565 556 { 566 if (!psg.data[ml->name]. data[al_pos]) break;567 ref[pr_pos] = psg.data[ml->name]. data[al_pos];557 if (!psg.data[ml->name].get_data()[al_pos]) break; 558 ref[pr_pos] = psg.data[ml->name].get_data()[al_pos]; 568 559 } 569 560 ref[9] = '-'; … … 572 563 573 564 for (int pr_pos = 0, al_pos = ml->rpos; 574 pr_pos < pr_len && al_pos < psg.data[ml->name]. size;565 pr_pos < pr_len && al_pos < psg.data[ml->name].get_size(); 575 566 pr_pos++, al_pos++) 576 567 { 577 568 int a = ml->sequence[pr_pos]; 578 int b = psg.data[ml->name]. data[al_pos];569 int b = psg.data[ml->name].get_data()[al_pos]; 579 570 if (a == b) { 580 571 ref[pr_pos+10] = '='; … … 593 584 594 585 for (int pr_pos = 0, al_pos = ml->rpos+pr_len; 595 pr_pos < 9 && al_pos < psg.data[ml->name]. size;586 pr_pos < 9 && al_pos < psg.data[ml->name].get_size(); 596 587 pr_pos++, al_pos++) 597 588 { 598 ref[pr_pos+11+pr_len] = psg.data[ml->name]. data[al_pos];589 ref[pr_pos+11+pr_len] = psg.data[ml->name].get_data()[al_pos]; 599 590 } 600 591 ref[10+pr_len] = '-'; … … 684 675 685 676 for (; ml; ml = ml->next) { 686 probe_input_data& pid = psg.data[ml->name]; 687 GBDATA *gb_pos = GB_entry(pid.gbd, "abspos"); 688 689 if (gb_pos) { 690 long gene_pos = GB_read_int(gb_pos); 691 ml->g_pos = ml->b_pos; 692 ml->b_pos += gene_pos; 677 long gene_pos = psg.data[ml->name].get_abspos(); 678 if (gene_pos >= 0) { 679 ml->g_pos = ml->b_pos; 680 ml->b_pos += gene_pos; 693 681 } 694 682 else { 695 683 fprintf(stderr, "Error in gene-pt-server: gene w/o position info\n"); 696 pt_assert( gb_pos);684 pt_assert(0); 697 685 } 698 686 } … … 796 784 for (i = 0; i < psg.data_count; i++) 797 785 { 798 GBS_strcat(memfile, psg.data[i]. name);786 GBS_strcat(memfile, psg.data[i].get_name()); 799 787 GBS_chrcat(memfile, (char)1); 800 788 } -
trunk/PROBE/PT_new_design.cxx
r7811 r8041 54 54 } 55 55 } 56 struct ptnd_loop_com { 56 57 static struct ptnd_loop_com { 57 58 PT_pdc *pdc; 58 59 PT_local *locs; 59 60 PT_probeparts *parts; 60 61 int mishits; 61 int new_match; // match or design the probe: 1 match 0 design62 62 double sum_bonds; // sum of bond of longest non mismatch string 63 63 double dt; // sum of mismatches … … 193 193 // count all mishits for a probe 194 194 195 // @@@ dupped code is in ptnd_count_mishits and ptnd_count_mishits2196 195 char *probe = psg.probe; 197 196 psg.abs_pos.announce(probeLoc.apos); … … 199 198 const probe_input_data& pid = psg.data[probeLoc.name]; 200 199 201 if (pid.is_group) return 0; // don't count group or neverminds 202 if (probe) { 203 int rpos = probeLoc.rpos + psg.height; 204 while (*probe && pid.data[rpos]) { 205 if (pid.data[rpos] != *(probe)) return 0; 206 probe++; 207 rpos++; 208 } 209 } 210 ptnd.mishits++; 200 if (pid.outside_group()) { 201 if (probe) { 202 int rpos = probeLoc.rpos + psg.height; 203 while (*probe && pid.get_data()[rpos]) { 204 if (pid.get_data()[rpos] != *(probe)) return 0; 205 probe++; 206 rpos++; 207 } 208 } 209 ptnd.mishits++; 210 } 211 211 return 0; 212 212 } … … 215 215 static int ptnd_count_mishits2(POS_TREE *pt) { 216 216 //! go down the tree to chains and leafs; count the species that are in the non member group 217 int base;218 int name;219 int mishits = 0;220 221 217 if (pt == NULL) 222 218 return 0; 219 223 220 if (PT_read_type(pt) == PT_NT_LEAF) { 224 name = PT_read_name(psg.ptmain, pt); 225 int apos = PT_read_apos(psg.ptmain, pt); 226 227 // @@@ dupped code from ptnd_chain_count_mishits::operator(): 228 psg.abs_pos.announce(apos); 229 if (!psg.data[name].is_group) return 1; 230 return 0; 231 } 232 else if (PT_read_type(pt) == PT_NT_CHAIN) { 221 DataLoc loc(pt); 222 psg.abs_pos.announce(loc.apos); 223 return psg.data[loc.name].outside_group(); 224 } 225 226 if (PT_read_type(pt) == PT_NT_CHAIN) { 233 227 psg.probe = 0; 234 228 ptnd.mishits = 0; 235 PT_forwhole_chain(p sg.ptmain, pt, ptnd_chain_count_mishits());229 PT_forwhole_chain(pt, ptnd_chain_count_mishits()); 236 230 return ptnd.mishits; 237 231 } 238 else {239 for (base = PT_QU; base< PT_B_MAX; base++) {240 mishits += ptnd_count_mishits2(PT_read_son(psg.ptmain, pt, (PT_BASES)base));241 }242 return mishits;243 }232 233 int mishits = 0; 234 for (int base = PT_QU; base< PT_B_MAX; base++) { 235 mishits += ptnd_count_mishits2(PT_read_son(pt, (PT_BASES)base)); 236 } 237 return mishits; 244 238 } 245 239 … … 409 403 static int ptnd_count_mishits(char *probe, POS_TREE *pt, int height) { 410 404 //! search down the tree to find matching species for the given probe 411 int name;412 405 int i; 413 406 POS_TREE *pthelp; 414 int pos;415 407 int mishits; 416 408 … … 420 412 for (i=PT_A; i<PT_B_MAX; i++) { 421 413 if (i != *probe) continue; 422 if ((pthelp = PT_read_son(p sg.ptmain, pt, (PT_BASES)i)))414 if ((pthelp = PT_read_son(pt, (PT_BASES)i))) 423 415 mishits += ptnd_count_mishits(probe+1, pthelp, height+1); 424 416 } … … 427 419 if (*probe) { 428 420 if (PT_read_type(pt) == PT_NT_LEAF) { 429 pos = PT_read_rpos(psg.ptmain, pt) + height; 430 name = PT_read_name(psg.ptmain, pt); 431 432 // @@@ dupped code from ptnd_chain_count_mishits::operator() 433 if (pos + (int)(strlen(probe)) >= psg.data[name].size) // after end 421 const DataLoc loc(pt); 422 int pos = loc.rpos+height; 423 424 if (pos + (int)(strlen(probe)) >= psg.data[loc.name].get_size()) // after end 434 425 return 0; 435 426 436 427 while (*probe) { 437 if (psg.data[ name].data[pos++] != *(probe++))428 if (psg.data[loc.name].get_data()[pos++] != *(probe++)) 438 429 return 0; 439 430 } … … 443 434 psg.height = height; 444 435 ptnd.mishits = 0; 445 PT_forwhole_chain(p sg.ptmain, pt, ptnd_chain_count_mishits());436 PT_forwhole_chain(pt, ptnd_chain_count_mishits()); 446 437 return ptnd.mishits; 447 438 } … … 482 473 } 483 474 484 static void ptnd_check_bonds(PT_pdc *pdc , int match) {475 static void ptnd_check_bonds(PT_pdc *pdc) { 485 476 /*! check the average bond size. 486 477 * … … 501 492 tprobe->sum_bonds = sbond; 502 493 } 503 match = match;504 494 } 505 495 … … 628 618 } 629 619 630 static void ptnd_check_part_inc_dt(PT_pdc *pdc, PT_probeparts *parts, 631 const DataLoc& matchLoc, 632 double dt, double sum_bonds) 633 { 620 static void ptnd_check_part_inc_dt(PT_pdc *pdc, PT_probeparts *parts, const DataLoc& matchLoc, double dt, double sum_bonds) { 634 621 //! test the probe parts, search the longest non mismatch string 635 622 … … 649 636 while (start>=0) { 650 637 if (pos<0) break; // out of sight 651 h = ptnd_check_split(ptnd.pdc, probe, start, psg.data[matchLoc.name]. data[pos]);638 h = ptnd_check_split(ptnd.pdc, probe, start, psg.data[matchLoc.name].get_data()[pos]); 652 639 if (h>0.0 && !split) return; // there is a longer part matching this 653 640 dt -= h; … … 664 651 if (pos >= PERC_SIZE) return; // out of observation 665 652 tprobe->perc[pos] ++; 666 if (ptnd.new_match) { // save the result in probematch667 PT_probematch *match;668 if (psg.data[matchLoc.name].match) {669 if (psg.data[matchLoc.name].match->dt < ndt) return;670 // there is a better hit for that sequence671 match = psg.data[matchLoc.name].match;672 }673 else {674 match = create_PT_probematch();675 aisc_link(&ptnd.locs->ppm, match);676 psg.data[matchLoc.name].match = match;677 }678 match->name = matchLoc.name;679 match->b_pos = matchLoc.apos - parts->start; // that's not correct !!!680 match->rpos = matchLoc.rpos-parts->start;681 match->N_mismatches = -1; // there are no mismatches in this mode682 match->mismatches = -1;683 match->wmismatches = dt; // only weighted mismatches (maybe)684 match->dt = ndt;685 match->sequence = psg.main_probe;686 match->reversed = psg.reversed;687 }688 653 } 689 654 static int ptnd_check_inc_mode(PT_pdc *pdc, PT_probeparts *parts, double dt, double sum_bonds) … … 705 670 706 671 int operator() (const DataLoc& partLoc) { 707 char *probe = psg.probe; 708 int height = psg.height; 709 double sbond = ptnd.sum_bonds; 710 double dt = ptnd.dt; 711 double h = 1.0; 712 int pos; 713 int base; 714 715 if (!ptnd.new_match && psg.data[partLoc.name].is_group) return 0; // don't count group or neverminds 716 if (probe) { 717 pos = partLoc.rpos+psg.height; 718 while (probe[height] && (base = psg.data[partLoc.name].data[pos])) { 719 if (!split && (h = ptnd_check_split(ptnd.pdc, probe, height, base) < 0.0)) { 720 dt -= h; 721 split = 1; 672 if (psg.data[partLoc.name].outside_group()) { 673 char *probe = psg.probe; 674 int height = psg.height; 675 double sbond = ptnd.sum_bonds; 676 double dt = ptnd.dt; 677 double h = 1.0; 678 int pos; 679 int base; 680 681 if (probe) { 682 pos = partLoc.rpos+psg.height; 683 while (probe[height] && (base = psg.data[partLoc.name].get_data()[pos])) { 684 if (!split && (h = ptnd_check_split(ptnd.pdc, probe, height, base) < 0.0)) { 685 dt -= h; 686 split = 1; 687 } 688 else { 689 dt += h; 690 sbond += ptnd_check_max_bond(ptnd.pdc, probe[height]) - h; 691 } 692 height++; pos++; 722 693 } 723 else { 724 dt += h; 725 sbond += ptnd_check_max_bond(ptnd.pdc, probe[height]) - h; 726 } 727 height++; pos++; 728 } 729 } 730 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, partLoc, dt, sbond); 694 } 695 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, partLoc, dt, sbond); 696 } 731 697 return 0; 732 698 } … … 739 705 740 706 int base; 741 int name, apos, rpos;742 743 707 if (pt == NULL) 744 708 return; 745 709 if (PT_read_type(pt) == PT_NT_LEAF) { 746 710 // @@@ dupped code is in ptnd_chain_check_part::operator() 747 name = PT_read_name(psg.ptmain, pt); 748 if (!ptnd.new_match && psg.data[name].is_group) return; 749 rpos = PT_read_rpos(psg.ptmain, pt); 750 apos = PT_read_apos(psg.ptmain, pt); 751 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, DataLoc(name, apos, rpos), dt, sum_bonds); 711 DataLoc loc(pt); 712 if (psg.data[loc.name].outside_group()) { 713 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, loc, dt, sum_bonds); 714 } 752 715 } 753 716 else if (PT_read_type(pt) == PT_NT_CHAIN) { … … 755 718 ptnd.dt = dt; 756 719 ptnd.sum_bonds = sum_bonds; 757 PT_forwhole_chain(p sg.ptmain, pt, ptnd_chain_check_part(0));720 PT_forwhole_chain(pt, ptnd_chain_check_part(0)); 758 721 } 759 722 else { 760 723 for (base = PT_QU; base< PT_B_MAX; base++) { 761 ptnd_check_part_all(PT_read_son(p sg.ptmain, pt, (PT_BASES)base), dt, sum_bonds);724 ptnd_check_part_all(PT_read_son(pt, (PT_BASES)base), dt, sum_bonds); 762 725 } 763 726 } … … 765 728 static void ptnd_check_part(char *probe, POS_TREE *pt, int height, double dt, double sum_bonds, int split) { 766 729 //! search down the tree to find matching species for the given probe 767 int name;730 int pos; 768 731 int i; 769 732 POS_TREE *pthelp; 770 int rpos, apos, pos;771 733 double ndt, nsum_bonds, h; 772 734 int nsplit; … … 778 740 if (split && ptnd_check_inc_mode(ptnd.pdc, ptnd.parts, dt, sum_bonds)) return; 779 741 for (i=PT_A; i<PT_B_MAX; i++) { 780 if ((pthelp = PT_read_son(p sg.ptmain, pt, (PT_BASES)i)))742 if ((pthelp = PT_read_son(pt, (PT_BASES)i))) 781 743 { 782 744 nsplit = split; … … 810 772 if (PT_read_type(pt) == PT_NT_LEAF) { 811 773 // @@@ dupped code is in ptnd_chain_check_part::operator() 812 name = PT_read_name(psg.ptmain, pt); 813 if (!ptnd.new_match && psg.data[name].is_group) return; 814 rpos = PT_read_rpos(psg.ptmain, pt); 815 apos = PT_read_apos(psg.ptmain, pt); 816 pos = rpos + height; 817 if (pos + (int)(strlen(probe+height)) >= psg.data[name].size) // after end 818 return; 819 while (probe[height] && (ref = psg.data[name].data[pos])) { 820 if (split) { 821 h = ptnd_check_split(ptnd.pdc, probe, height, ref); 822 if (h<0.0) dt -= h; else dt += h; 823 } else if ((h = ptnd_check_split(ptnd.pdc, probe, height, 824 ref)) < 0.0) { 825 dt -= h; 826 split = 1; 774 const DataLoc loc(pt); 775 if (psg.data[loc.name].outside_group()) { 776 pos = loc.rpos + height; 777 if (pos + (int)(strlen(probe+height)) >= psg.data[loc.name].get_size()) // after end 778 return; 779 while (probe[height] && (ref = psg.data[loc.name].get_data()[pos])) { 780 if (split) { 781 h = ptnd_check_split(ptnd.pdc, probe, height, ref); 782 if (h<0.0) dt -= h; else dt += h; 783 } 784 else if ((h = ptnd_check_split(ptnd.pdc, probe, height, ref)) < 0.0) { 785 dt -= h; 786 split = 1; 787 } 788 else { 789 dt += h; 790 sum_bonds += ptnd_check_max_bond(ptnd.pdc, probe[height]) - h; 791 } 792 height++; pos++; 827 793 } 828 else { 829 dt += h; 830 sum_bonds += ptnd_check_max_bond(ptnd.pdc, probe[height]) - h; 831 } 832 height++; pos++; 833 } 834 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, DataLoc(name, apos, rpos), dt, sum_bonds); 794 ptnd_check_part_inc_dt(ptnd.pdc, ptnd.parts, loc, dt, sum_bonds); 795 } 835 796 return; 836 797 } … … 840 801 ptnd.dt = dt; 841 802 ptnd.sum_bonds = sum_bonds; 842 PT_forwhole_chain(p sg.ptmain, pt, ptnd_chain_check_part(split));803 PT_forwhole_chain(pt, ptnd_chain_check_part(split)); 843 804 return; 844 805 } … … 895 856 } 896 857 897 inline void PT_incr_hash(GB_HASH *hash, c har *sequence, int len) {858 inline void PT_incr_hash(GB_HASH *hash, const char *sequence, int len) { 898 859 char c = sequence[len]; 899 sequence[len] = 0;860 const_cast<char*>(sequence)[len] = 0; 900 861 901 862 pt_assert(strlen(sequence) == (size_t)len); … … 903 864 GBS_incr_hash(hash, sequence); 904 865 905 sequence[len] = c;906 } 907 908 static void ptnd_add_sequence_to_hash(PT_pdc *pdc, GB_HASH *hash, c har *sequence, int seq_len, int probe_len, char *prefix, int prefix_len) {866 const_cast<char*>(sequence)[len] = c; 867 } 868 869 static void ptnd_add_sequence_to_hash(PT_pdc *pdc, GB_HASH *hash, const char *sequence, int seq_len, int probe_len, char *prefix, int prefix_len) { 909 870 int pos; 910 871 if (*prefix) { // partition search, else very large hash tables (>60 mbytes) … … 946 907 int used_idx = 0; 947 908 for (int name = 0; name < psg.data_count; name++) { 948 if (psg.data[name].i s_group == 1) {909 if (psg.data[name].inside_group()) { 949 910 group_idx[used_idx++] = name; // store marked group indices 950 unsigned long size = psg.data[name]. size;911 unsigned long size = psg.data[name].get_size(); 951 912 datasize += size; 952 913 if (datasize<size) datasize = ULONG_MAX; // avoid overflow! … … 1002 963 for (int g = 0; g<group_count; ++g) { 1003 964 int name = group_idx[g]; 1004 long possible_tprobes = psg.data[name]. size-pdc->probelen+1;965 long possible_tprobes = psg.data[name].get_size()-pdc->probelen+1; 1005 966 GB_HASH *hash_one = GBS_create_hash(possible_tprobes*hash_multiply, GB_MIND_CASE); // count tprobe occurrences for one group/sequence 1006 ptnd_add_sequence_to_hash(pdc, hash_one, psg.data[name]. data, psg.data[name].size, pdc->probelen, partstring, partsize);967 ptnd_add_sequence_to_hash(pdc, hash_one, psg.data[name].get_data(), psg.data[name].get_size(), pdc->probelen, partstring, partsize); 1007 968 GBS_hash_do_loop(hash_one, ptnd_collect_hash, hash_outer); // merge hash_one into hash 1008 969 #if defined(DEBUG) … … 1049 1010 // IDP probe design 1050 1011 1051 PT_local *locs = (PT_local*)pdc->mh.parent->parent;1052 ptnd.new_match = 0; 1053 ptnd.locs = locs;1054 ptnd.pdc = pdc;1012 PT_local *locs = (PT_local*)pdc->mh.parent->parent; 1013 1014 ptnd.locs = locs; 1015 ptnd.pdc = pdc; 1055 1016 1056 1017 const char *error; … … 1083 1044 ptnd_first_check(pdc); 1084 1045 ptnd_check_position(pdc); 1085 ptnd_check_bonds(pdc , ptnd.new_match);1046 ptnd_check_bonds(pdc); 1086 1047 ptnd_cp_tprobe_2_probepart(pdc); 1087 1048 ptnd_duplicate_probepart(pdc); … … 1097 1058 } 1098 1059 1099 void ptnd_new_match(PT_local * locs, char *probestring)1100 {1101 PT_pdc *pdc = locs->pdc;1102 PT_tprobes *tprobe;1103 1104 ptnd.locs = locs;1105 ptnd.pdc = pdc;1106 ptnd.new_match = 1;1107 1108 if (!pdc) return; // no config1109 1110 tprobe = create_PT_tprobes();1111 tprobe->sequence = strdup(probestring);1112 1113 aisc_link(&pdc->ptprobes, tprobe);1114 ptnd_check_bonds(pdc, ptnd.new_match);1115 ptnd_cp_tprobe_2_probepart(pdc);1116 ptnd_duplicate_probepart(pdc);1117 ptnd_sort_parts(pdc);1118 ptnd_remove_duplicated_probepart(pdc);1119 ptnd_check_probepart(pdc);1120 1121 while (pdc->parts) destroy_PT_probeparts(pdc->parts);1122 while ((tprobe = pdc->tprobes)) destroy_PT_tprobes(tprobe);1123 } -
trunk/PROBE/PT_prefixtree.cxx
r7812 r8041 204 204 } 205 205 206 POS_TREE *PT_add_to_chain(PTM2 *ptmain, POS_TREE *node, int name, int apos, int rpos) // stage1 207 { // insert at the beginning of list 208 static char buffer[100]; 206 POS_TREE *PT_add_to_chain(POS_TREE *node, const DataLoc& loc) { // stage1 207 // insert at the beginning of list 208 209 char *data = (&node->data) + psg.ptmain->mode; 210 data += (node->flags&1) ? 4 : 2; 211 209 212 unsigned long old_first; 210 char *data;211 int mainapos; // TODO: mainapos isn't used212 data = (&node->data) + ptmain->mode;213 if (node->flags&1) {214 PT_READ_INT(data, mainapos);215 data += 4;216 }217 else {218 PT_READ_SHORT(data, mainapos);219 data += 2;220 }221 213 PT_READ_PNTR(data, old_first); // create a new list element 222 char *p; 223 p = buffer; 214 215 static char buffer[100]; 216 char *p = buffer; 217 224 218 PT_WRITE_PNTR(p, old_first); 225 219 p += sizeof(PT_PNTR); 226 PT_WRITE_NAT(p, name); 227 PT_WRITE_NAT(p, rpos); 228 PT_WRITE_NAT(p, apos); 220 221 PT_WRITE_NAT(p, loc.name); 222 PT_WRITE_NAT(p, loc.rpos); 223 PT_WRITE_NAT(p, loc.apos); 224 229 225 int size = p - buffer; 230 p = (char *)PTM_get_mem(size);226 p = (char *)PTM_get_mem(size); 231 227 memcpy(p, buffer, size); 232 228 PT_WRITE_PNTR(data, p); … … 235 231 } 236 232 237 238 POS_TREE *PT_change_leaf_to_node(PTM2 * /* ptmain */, POS_TREE *node) // stage 1 239 { 233 POS_TREE *PT_change_leaf_to_node(POS_TREE *node) { // stage 1 234 if (PT_GET_TYPE(node) != PT_NT_LEAF) PT_CORE; 235 240 236 long i; 241 POS_TREE *father, *new_elem;242 if (PT_GET_TYPE(node) != PT_NT_LEAF) PT_CORE;243 237 PT_READ_PNTR((&node->data), i); 244 father=(POS_TREE *)i; 245 new_elem = (POS_TREE *)PTM_get_mem(PT_EMPTY_NODE_SIZE); 238 239 POS_TREE *father = (POS_TREE *)i; 240 POS_TREE *new_elem = (POS_TREE *)PTM_get_mem(PT_EMPTY_NODE_SIZE); 246 241 if (father) PT_change_father(father, node, new_elem); 247 242 PTM_free_mem((char *)node, PT_LEAF_SIZE(node)); 248 243 PT_SET_TYPE(new_elem, PT_NT_NODE, 0); 249 244 PT_WRITE_PNTR((&(new_elem->data)), (long)father); 245 250 246 return new_elem; 251 247 } 252 248 253 POS_TREE *PT_leaf_to_chain(PTM2 *ptmain, POS_TREE *node) // stage 1 254 { 249 POS_TREE *PT_leaf_to_chain(POS_TREE *node) { // stage 1 250 if (PT_GET_TYPE(node) != PT_NT_LEAF) PT_CORE; 251 255 252 long i; 256 int apos, rpos, name;257 POS_TREE *father, *new_elem;258 int chain_size;259 char *data;260 if (PT_GET_TYPE(node) != PT_NT_LEAF) PT_CORE;261 253 PT_READ_PNTR((&node->data), i); 262 father=(POS_TREE *)i; 263 name = PT_read_name(ptmain, node); // backup name,264 apos = PT_read_apos(ptmain, node); // apos,265 rpos = PT_read_rpos(ptmain, node); // rpos 266 chain_size= PT_EMPTY_CHAIN_SIZE;267 if ( apos>PT_SHORT_SIZE) chain_size+=2;268 269 new_elem = (POS_TREE *)PTM_get_mem(chain_size);254 255 POS_TREE *father = (POS_TREE *)i; 256 const DataLoc loc(node); 257 258 int chain_size = PT_EMPTY_CHAIN_SIZE; 259 if (loc.apos>PT_SHORT_SIZE) chain_size += 2; 260 261 POS_TREE *new_elem = (POS_TREE *)PTM_get_mem(chain_size); 270 262 PT_change_father(father, node, new_elem); 271 263 PTM_free_mem((char *)node, PT_LEAF_SIZE(node)); 272 264 PT_SET_TYPE(new_elem, PT_NT_CHAIN, 0); 273 PT_WRITE_PNTR((&new_elem->data), (long)father); // father 274 data = (&new_elem->data)+sizeof(PT_PNTR); 275 if (apos>PT_SHORT_SIZE) { // mainapos 276 PT_WRITE_INT(data, apos); // . 277 data+=4; new_elem->flags|=1; // . 278 } 279 else { // . 280 PT_WRITE_SHORT(data, apos); // . 281 data+=2; // . 282 } 283 PT_WRITE_PNTR(data, NULL); // first element 284 PT_add_to_chain(ptmain, new_elem, name, apos, rpos); 265 PT_WRITE_PNTR((&new_elem->data), (long)father); 266 267 char *data = (&new_elem->data)+sizeof(PT_PNTR); 268 if (loc.apos>PT_SHORT_SIZE) { 269 PT_WRITE_INT(data, loc.apos); 270 data+=4; 271 new_elem->flags|=1; 272 } 273 else { 274 PT_WRITE_SHORT(data, loc.apos); 275 data+=2; 276 } 277 PT_WRITE_PNTR(data, NULL); 278 PT_add_to_chain(new_elem, loc); 279 285 280 return new_elem; 286 281 } 287 282 288 POS_TREE * 289 PT_create_leaf(PTM2 *ptmain, POS_TREE ** pfather, PT_BASES base, int rpos, int apos, int name) // stage 1 290 { 291 POS_TREE *father, *node, *new_elemfather; 292 int base2; 293 int leafsize; 294 char *dest; 283 POS_TREE *PT_create_leaf(POS_TREE ** pfather, PT_BASES base, const DataLoc& loc) { // stage 1 284 POS_TREE *father, *node, *new_elemfather; 285 int base2; 286 int leafsize; 287 char *dest; 295 288 leafsize = PT_EMPTY_LEAF_SIZE; 296 if (rpos>PT_SHORT_SIZE) leafsize+=2; 297 if (apos>PT_SHORT_SIZE) leafsize+=2; 298 if (name>PT_SHORT_SIZE) leafsize+=2; 299 node = (POS_TREE *) PTM_get_mem(leafsize); 289 290 if (loc.rpos>PT_SHORT_SIZE) leafsize += 2; 291 if (loc.apos>PT_SHORT_SIZE) leafsize += 2; 292 if (loc.name>PT_SHORT_SIZE) leafsize += 2; 293 node = (POS_TREE *) PTM_get_mem(leafsize); 300 294 if (base >= PT_B_MAX) 301 *(int *) 0 = 0;295 *(int *) 0 = 0; 302 296 if (pfather) { 303 297 int oldfathersize; … … 341 335 PT_SET_TYPE(node, PT_NT_LEAF, 0); 342 336 dest = (&node->data) + sizeof(PT_PNTR); 343 if ( name>PT_SHORT_SIZE) {344 PT_WRITE_INT(dest, name);337 if (loc.name>PT_SHORT_SIZE) { 338 PT_WRITE_INT(dest, loc.name); 345 339 node->flags |= 1; 346 340 dest += 4; 347 341 } 348 342 else { 349 PT_WRITE_SHORT(dest, name);343 PT_WRITE_SHORT(dest, loc.name); 350 344 dest += 2; 351 345 } 352 if ( rpos>PT_SHORT_SIZE) {353 PT_WRITE_INT(dest, rpos);346 if (loc.rpos>PT_SHORT_SIZE) { 347 PT_WRITE_INT(dest, loc.rpos); 354 348 node->flags |= 2; 355 349 dest += 4; 356 350 } 357 351 else { 358 PT_WRITE_SHORT(dest, rpos);352 PT_WRITE_SHORT(dest, loc.rpos); 359 353 dest += 2; 360 354 } 361 if ( apos>PT_SHORT_SIZE) {362 PT_WRITE_INT(dest, apos);355 if (loc.apos>PT_SHORT_SIZE) { 356 PT_WRITE_INT(dest, loc.apos); 363 357 node->flags |= 4; 364 358 dest += 4; 365 359 } 366 360 else { 367 PT_WRITE_SHORT(dest, apos);361 PT_WRITE_SHORT(dest, loc.apos); 368 362 dest += 2; 369 363 } 370 364 if (base == PT_QU) 371 return PT_leaf_to_chain( ptmain,node);365 return PT_leaf_to_chain(node); 372 366 return node; 373 367 } 374 375 368 376 369 // ------------------------------------ 377 370 // functions for stage 1: save 378 371 379 void PTD_clear_fathers(PTM2 *ptmain, POS_TREE * node) // stage 1 380 { 381 POS_TREE *sons; 382 int i; 383 PT_NODE_TYPE type = PT_read_type(node); 384 if (type == PT_NT_SAVED) return; 385 PT_WRITE_PNTR((&node->data), NULL); 386 if (type == PT_NT_NODE) { 387 for (i = PT_QU; i < PT_B_MAX; i++) { 388 sons = PT_read_son(ptmain, node, (PT_BASES)i); 389 if (sons) 390 PTD_clear_fathers(ptmain, sons); 372 void PTD_clear_fathers(POS_TREE * node) { // stage 1 373 PT_NODE_TYPE type = PT_read_type(node); 374 if (type != PT_NT_SAVED) { 375 PT_WRITE_PNTR((&node->data), NULL); 376 if (type == PT_NT_NODE) { 377 for (int i = PT_QU; i < PT_B_MAX; i++) { 378 POS_TREE *sons = PT_read_son(node, (PT_BASES)i); 379 if (sons) PTD_clear_fathers(sons); 380 } 391 381 } 392 382 } … … 445 435 } 446 436 447 long PTD_write_tip_to_disk(FILE * out, P TM2 * /* ptmain */, POS_TREE * node, long pos)437 long PTD_write_tip_to_disk(FILE * out, POS_TREE * node, long pos) 448 438 { 449 439 int size, cnt; … … 490 480 } 491 481 492 ARB_ERROR ptd_write_chain_entries(FILE * out, long *ppos, PTM2 * /* ptmain */,char ** entry_tab, int n_entries, int mainapos) { // __ATTR__USERESULT482 ARB_ERROR ptd_write_chain_entries(FILE * out, long *ppos, char ** entry_tab, int n_entries, int mainapos) { // __ATTR__USERESULT 493 483 ARB_ERROR error; 494 484 int lastname = 0; … … 530 520 531 521 532 long PTD_write_chain_to_disk(FILE * out, P TM2 *ptmain, POS_TREE * node, long pos, ARB_ERROR& error) {522 long PTD_write_chain_to_disk(FILE * out, POS_TREE * node, long pos, ARB_ERROR& error) { 533 523 char *data; 534 524 long oldpos = pos; … … 536 526 pos++; 537 527 int mainapos; 538 data = (&node->data) + p tmain->mode;528 data = (&node->data) + psg.ptmain->mode; 539 529 540 530 if (node->flags&1) { … … 556 546 char **entry_tab = (char **)GB_calloc(sizeof(char *), n_entries); 557 547 ptd_set_chain_references((char *)first_entry, entry_tab); 558 error = ptd_write_chain_entries(out, &pos, ptmain,entry_tab, n_entries, mainapos);548 error = ptd_write_chain_entries(out, &pos, entry_tab, n_entries, mainapos); 559 549 free(entry_tab); 560 550 } … … 593 583 } 594 584 595 long PTD_write_node_to_disk(FILE * out, P TM2 *ptmain, POS_TREE * node, long *r_poss, long pos) {585 long PTD_write_node_to_disk(FILE * out, POS_TREE * node, long *r_poss, long pos) { 596 586 int i, size; // Save node after all descendends are already saved 597 587 POS_TREE *sons; … … 606 596 607 597 for (i = PT_QU; i < PT_B_MAX; i++) { // free all sons 608 sons = PT_read_son( ptmain,node, (PT_BASES)i);598 sons = PT_read_son(node, (PT_BASES)i); 609 599 if (sons) { 610 600 int memsize; … … 759 749 } 760 750 761 long PTD_write_leafs_to_disk(FILE * out, P TM2 *ptmain, POS_TREE * node, long pos, long *pnodepos, int *pblock, ARB_ERROR& error) {751 long PTD_write_leafs_to_disk(FILE * out, POS_TREE * node, long pos, long *pnodepos, int *pblock, ARB_ERROR& error) { 762 752 // returns new pos when son is written 0 otherwise 763 753 // pnodepos is set to last object … … 778 768 else if (type == PT_NT_LEAF) { 779 769 *pnodepos = pos; 780 pos = PTD_write_tip_to_disk(out, ptmain,node, pos);770 pos = PTD_write_tip_to_disk(out, node, pos); 781 771 } 782 772 else if (type == PT_NT_CHAIN) { 783 773 *pnodepos = pos; 784 pos = PTD_write_chain_to_disk(out, ptmain,node, pos, error);774 pos = PTD_write_chain_to_disk(out, node, pos, error); 785 775 } 786 776 else if (type == PT_NT_NODE) { … … 788 778 o_pos = pos; 789 779 for (i = PT_QU; i < PT_B_MAX && !error; i++) { // save all sons 790 sons = PT_read_son( ptmain,node, (PT_BASES)i);780 sons = PT_read_son(node, (PT_BASES)i); 791 781 r_poss[i] = 0; 792 782 if (sons) { 793 r_pos = PTD_write_leafs_to_disk(out, ptmain,sons, pos, &(r_poss[i]), &(block[0]), error);783 r_pos = PTD_write_leafs_to_disk(out, sons, pos, &(r_poss[i]), &(block[0]), error); 794 784 if (r_pos>pos) { // really saved ???? 795 785 son_size[i] = r_pos-pos; … … 813 803 else { // now i can write my data 814 804 *pnodepos = pos; 815 if (!error) pos = PTD_write_node_to_disk(out, ptmain,node, r_poss, pos);805 if (!error) pos = PTD_write_node_to_disk(out, node, r_poss, pos); 816 806 } 817 807 } … … 824 814 825 815 826 ARB_ERROR PTD_read_leafs_from_disk(const char *fname, P TM2 *ptmain, POS_TREE **pnode) { // __ATTR__USERESULT816 ARB_ERROR PTD_read_leafs_from_disk(const char *fname, POS_TREE **pnode) { // __ATTR__USERESULT 827 817 GB_ERROR error = NULL; 828 818 char *buffer = GB_map_file(fname, 0); … … 892 882 pt_assert(i >= 0); 893 883 894 *pnode = (POS_TREE *)(i+buffer); 895 ptmain->mode = 0; 896 ptmain->data_start = buffer; 884 *pnode = (POS_TREE *)(i+buffer); 885 886 psg.ptmain->mode = 0; 887 psg.ptmain->data_start = buffer; 897 888 } 898 889 } -
trunk/PROBE/needs_libs
r6865 r8041 4 4 SERVERCNTRL/SERVERCNTRL.a 5 5 SL/HELIX/HELIX.a 6 SL/PTCLEAN/PTCLEAN.a 6 7 -
trunk/PROBE/probe.h
r7986 r8041 50 50 #define FINDANSWER 52 // private msg type: find result answer 51 51 52 extern int gene_flag; // if 'gene_flag' == 1 -> we are a gene pt server 52 53 extern ULONG physical_memory; 53 54 struct Hs_struct; … … 100 101 // Probe search 101 102 102 struct probe_statistic { 103 int match_count; // Counter for matches 104 double rel_match_count; // match_count / (seq_len - probe_len + 1) 105 }; 106 107 struct probe_input_data { // every taxa's own data 108 char *data; // sequence 109 long checksum; 110 int size; 103 class probe_input_data : virtual Noncopyable { // every taxa's own data 104 105 char *data; // sequence 106 long checksum; // checksum of sequence 107 int size; 108 111 109 char *name; 112 110 char *fullname; 113 111 GBDATA *gbd; 114 112 115 // probe design 116 int is_group; // -1: nevermind, 0: no group, 1: group 117 118 // probe design (match) 119 PT_probematch *match; // best hit for PT_new_design 120 121 // find family 122 probe_statistic stat; 123 124 int next; 113 bool group; // probe_design: whether species is in group 114 115 // obsolete methods below @@@ remove them 116 GBDATA *get_gbdata() const { return gbd; } 117 void set_data(char *assign, int size_) { pt_assert(!data); data = assign; size = size_; } 118 void set_checksum(long cs) { checksum = cs; } 119 120 public: 121 122 probe_input_data() 123 : data(0), 124 checksum(0), 125 size(0), 126 name(0), 127 fullname(0), 128 gbd(0), 129 group(false) 130 {} 131 ~probe_input_data() { 132 free(data); 133 free(name); 134 free(fullname); 135 } 136 137 GB_ERROR init(GBDATA *gbd_); 138 139 const char *get_data() const { return data; } 140 char *read_alignment(int *psize) const; 141 142 const char *get_name() const { return name; } 143 const char *get_fullname() const { return fullname; } 144 long get_checksum() const { return checksum; } 145 int get_size() const { return size; } 146 147 bool inside_group() const { return group; } 148 bool outside_group() const { return !group; } 149 150 void set_group_state(bool isGroupMember) { group = isGroupMember; } 151 152 long get_abspos() const { 153 pt_assert(gene_flag); // only legal in gene-ptserver 154 GBDATA *gb_pos = GB_entry(get_gbdata(), "abspos"); 155 if (gb_pos) return GB_read_int(gb_pos); 156 return -1; 157 } 158 159 private: 125 160 }; 126 161 … … 198 233 GB_HASH *namehash; // name to int 199 234 235 int data_count; 200 236 struct probe_input_data *data; // the internal database 201 237 … … 203 239 BI_ecoli_ref *bi_ecoli; 204 240 205 int data_count;206 241 int max_size; // maximum sequence len 207 242 long char_count; // number of all 'acgtuACGTU' … … 284 319 }; 285 320 286 extern int gene_flag; // if 'gene_flag' == 1 -> we are a gene pt server287 288 321 struct ltByArbName { 289 322 bool operator()(const gene_struct *gs1, const gene_struct *gs2) const { … … 313 346 #error probe.h included twice 314 347 #endif 348 349 -
trunk/PROBE/probe_tree.h
r7933 r8041 411 411 // calculate the index of the pointer in a node 412 412 413 inline POS_TREE *PT_read_son(P TM2 *ptmain, POS_TREE *node, PT_BASES base)413 inline POS_TREE *PT_read_son(POS_TREE *node, PT_BASES base) 414 414 { 415 long i; 416 UINT sec; 417 UINT offset; 415 long i; 416 UINT sec; 417 UINT offset; 418 PTM2 *ptmain = psg.ptmain; 418 419 if (ptmain->stage3) { // stage 3 no father 419 420 if (node->flags & IS_SINGLE_BRANCH_NODE) { … … 503 504 } 504 505 505 inline POS_TREE *PT_read_son_stage_1(PTM2 *ptmain, POS_TREE *node, PT_BASES base) 506 { 507 long i; 506 inline POS_TREE *PT_read_son_stage_1(POS_TREE *node, PT_BASES base) { 508 507 if (!((1<<base) & node->flags)) return NULL; // bit not set 509 508 base = (PT_BASES)PT_count_bits[base][node->flags]; 510 PT_READ_PNTR((&node->data)+sizeof(PT_PNTR)*base+ptmain->mode, i); 511 return (POS_TREE *)(i+ptmain->data_start); // ptmain->data_start == 0x00 in stage 1 509 long i; 510 PT_READ_PNTR((&node->data)+sizeof(PT_PNTR)*base+psg.ptmain->mode, i); 511 return (POS_TREE *)(i+psg.ptmain->data_start); // psg.ptmain->data_start == 0x00 in stage 1 512 512 } 513 513 … … 517 517 } 518 518 519 inline int PT_read_name(PTM2 *ptmain, POS_TREE *node)520 {521 int i;522 if (node->flags&1) {523 PT_READ_INT((&node->data)+ptmain->mode, i);524 }525 else {526 PT_READ_SHORT((&node->data)+ptmain->mode, i);527 }528 pt_assert(i >= 0);529 return i;530 }531 532 inline int PT_read_rpos(PTM2 *ptmain, POS_TREE *node)533 {534 int i;535 char *data = (&node->data)+2+ptmain->mode;536 if (node->flags&1) data+=2;537 if (node->flags&2) {538 PT_READ_INT(data, i);539 }540 else {541 PT_READ_SHORT(data, i);542 }543 pt_assert(i >= 0);544 return i;545 }546 547 inline int PT_read_apos(PTM2 *ptmain, POS_TREE *node)548 {549 int i;550 char *data = (&node->data)+ptmain->mode+4; // father 4 name 2 rpos 2551 if (node->flags&1) data+=2;552 if (node->flags&2) data+=2;553 if (node->flags&4) {554 PT_READ_INT(data, i);555 }556 else {557 PT_READ_SHORT(data, i);558 }559 pt_assert(i >= 0);560 return i;561 }562 563 519 struct DataLoc { 564 int name; 520 int name; // index into psg.data[], aka as species id 565 521 int apos; 566 int rpos; 522 int rpos; // position in data 567 523 568 524 void init(const char ** data, int pos) { 569 525 *data = PT_READ_CHAIN_ENTRY(*data, pos, &name, &apos, &rpos); 570 526 } 571 void init(PTM2 *ptmain, POS_TREE *pt) { 572 pt_assert(PT_read_type(pt) == PT_NT_LEAF); 573 574 name = PT_read_name(ptmain, pt); 575 apos = PT_read_apos(ptmain, pt); 576 rpos = PT_read_rpos(ptmain, pt); 527 void init(POS_TREE *node) { 528 pt_assert(PT_read_type(node) == PT_NT_LEAF); 529 char *data = (&node->data)+psg.ptmain->mode; 530 if (node->flags&1) { PT_READ_INT(data, name); data += 4; } else { PT_READ_SHORT(data, name); data += 2; } 531 if (node->flags&2) { PT_READ_INT(data, rpos); data += 4; } else { PT_READ_SHORT(data, rpos); data += 2; } 532 if (node->flags&4) { PT_READ_INT(data, apos); data += 4; } else { PT_READ_SHORT(data, apos); data += 2; } 533 534 pt_assert(name >= 0); 535 pt_assert(apos >= 0); 536 pt_assert(rpos >= 0); 577 537 } 578 538 579 539 DataLoc(int name_, int apos_, int rpos_) : name(name_), apos(apos_), rpos(rpos_) {} 580 DataLoc(const char ** data, int pos) { 581 name = 0; 582 init(data, pos); 583 } 584 DataLoc(PTM2 *ptmain, POS_TREE *pt) { 585 init(ptmain, pt); 586 } 540 DataLoc(POS_TREE *pt) { init(pt); } 541 DataLoc(const char ** data, int pos) { name = 0; init(data, pos); } 542 543 const probe_input_data& get_pid() const { pt_assert(name >= 0 && name<psg.data_count); return psg.data[name]; } 544 const char *get_data() const { return get_pid().get_data(); } 545 PT_BASES operator[](int offset) const { return PT_BASES(get_data()[rpos+offset]); } 546 547 int restlength() const { return get_pid().get_size()-rpos; } 548 bool is_shorther_than(int offset) const { return offset >= restlength(); } 587 549 588 550 #if defined(DEBUG) 589 551 void dump(FILE *fp) const { 590 fprintf(fp, " apos=%6i rpos=%6i name=%6i='%s'\n", apos, rpos, name, psg.data[name]. name);552 fprintf(fp, " apos=%6i rpos=%6i name=%6i='%s'\n", apos, rpos, name, psg.data[name].get_name()); 591 553 fflush(fp); 592 554 } … … 595 557 596 558 template<typename T> 597 int PT_forwhole_chain(P TM2 *ptmain, POS_TREE *node, T func) {559 int PT_forwhole_chain(POS_TREE *node, T func) { 598 560 pt_assert(PT_read_type(node) == PT_NT_CHAIN); 599 561 600 const char *data = (&node->data) + p tmain->mode;562 const char *data = (&node->data) + psg.ptmain->mode; 601 563 int pos; 602 564 … … 621 583 622 584 template<typename T> 623 int PT_withall_tips(P TM2 *ptmain, POS_TREE *node, T func) {585 int PT_withall_tips(POS_TREE *node, T func) { 624 586 // like PT_forwhole_chain, but also can handle leafs 625 587 PT_NODE_TYPE type = PT_read_type(node); 626 588 if (type == PT_NT_LEAF) { 627 return func(DataLoc( ptmain,node));589 return func(DataLoc(node)); 628 590 } 629 591 630 592 pt_assert(type == PT_NT_CHAIN); 631 return PT_forwhole_chain( ptmain,node, func);593 return PT_forwhole_chain(node, func); 632 594 } 633 595 -
trunk/PROBE/pt_prototypes.h
r7986 r8041 13 13 14 14 /* PT_buildtree.cxx */ 15 POS_TREE *build_pos_tree(POS_TREE *pt, int anfangs_pos, int apos, int RNS_nr, unsigned int end); 16 long PTD_save_partial_tree(FILE *out, PTM2 *ptmain, POS_TREE *node, char *partstring, int partsize, long pos, long *ppos, ARB_ERROR &error); 15 16 class DataLoc; 17 18 long PTD_save_partial_tree(FILE *out, POS_TREE *node, char *partstring, int partsize, long pos, long *ppos, ARB_ERROR &error); 17 19 ARB_ERROR enter_stage_1_build_tree(PT_main *, char *tname) __ATTR__USERESULT; 18 20 ARB_ERROR enter_stage_3_load_tree(PT_main *, const char *tname) __ATTR__USERESULT; … … 40 42 int compress_data(char *probestring); 41 43 void PT_base_2_string(char *id_string, long len); 42 ARB_ERROR probe_read_data_base(const char *name ) __ATTR__USERESULT;44 ARB_ERROR probe_read_data_base(const char *name, bool readOnly) __ATTR__USERESULT; 43 45 int probe_compress_sequence(char *seq, int seqsize); 44 46 char *probe_read_alignment(int j, int *psize); … … 53 55 void PT_init_psg(void); 54 56 void PT_exit_psg(void); 55 void PT_exit( int exitcode) __ATTR__NORETURN;57 void PT_exit(void); 56 58 GB_ERROR PT_init_map(void) __ATTR__USERESULT; 57 59 … … 76 78 char *get_design_hinfo(PT_tprobes *tprobe); 77 79 int PT_start_design(PT_pdc *pdc, int dummy_1x); 78 void ptnd_new_match(PT_local *locs, char *probestring);79 80 80 81 /* PT_prefixtree.cxx */ … … 88 89 PTM2 *PT_init(void); 89 90 void PT_change_father(POS_TREE *father, POS_TREE *source, POS_TREE *dest); 90 POS_TREE *PT_add_to_chain(P TM2 *ptmain, POS_TREE *node, int name, int apos, int rpos);91 POS_TREE *PT_change_leaf_to_node(P TM2 *, POS_TREE *node);92 POS_TREE *PT_leaf_to_chain(P TM2 *ptmain, POS_TREE *node);93 POS_TREE *PT_create_leaf(P TM2 *ptmain, POS_TREE **pfather, PT_BASES base, int rpos, int apos, int name);94 void PTD_clear_fathers(P TM2 *ptmain, POS_TREE *node);91 POS_TREE *PT_add_to_chain(POS_TREE *node, const DataLoc &loc); 92 POS_TREE *PT_change_leaf_to_node(POS_TREE *node); 93 POS_TREE *PT_leaf_to_chain(POS_TREE *node); 94 POS_TREE *PT_create_leaf(POS_TREE **pfather, PT_BASES base, const DataLoc &loc); 95 void PTD_clear_fathers(POS_TREE *node); 95 96 void PTD_put_longlong(FILE *out, ULONG i); 96 97 void PTD_put_int(FILE *out, ULONG i); 97 98 void PTD_put_short(FILE *out, ULONG i); 98 99 void PTD_set_object_to_saved_status(POS_TREE *node, long pos, int size); 99 long PTD_write_tip_to_disk(FILE *out, P TM2 *, POS_TREE *node, long pos);100 long PTD_write_tip_to_disk(FILE *out, POS_TREE *node, long pos); 100 101 int ptd_count_chain_entries(char *entry); 101 102 void ptd_set_chain_references(char *entry, char **entry_tab); 102 ARB_ERROR ptd_write_chain_entries(FILE *out, long *ppos, PTM2 *,char **entry_tab, int n_entries, int mainapos) __ATTR__USERESULT;103 long PTD_write_chain_to_disk(FILE *out, P TM2 *ptmain, POS_TREE *node, long pos, ARB_ERROR &error);103 ARB_ERROR ptd_write_chain_entries(FILE *out, long *ppos, char **entry_tab, int n_entries, int mainapos) __ATTR__USERESULT; 104 long PTD_write_chain_to_disk(FILE *out, POS_TREE *node, long pos, ARB_ERROR &error); 104 105 void PTD_debug_nodes(void); 105 long PTD_write_node_to_disk(FILE *out, P TM2 *ptmain, POS_TREE *node, long *r_poss, long pos);106 long PTD_write_leafs_to_disk(FILE *out, P TM2 *ptmain, POS_TREE *node, long pos, long *pnodepos, int *pblock, ARB_ERROR &error);107 ARB_ERROR PTD_read_leafs_from_disk(const char *fname, P TM2 *ptmain, POS_TREE **pnode) __ATTR__USERESULT;106 long PTD_write_node_to_disk(FILE *out, POS_TREE *node, long *r_poss, long pos); 107 long PTD_write_leafs_to_disk(FILE *out, POS_TREE *node, long pos, long *pnodepos, int *pblock, ARB_ERROR &error); 108 ARB_ERROR PTD_read_leafs_from_disk(const char *fname, POS_TREE **pnode) __ATTR__USERESULT; 108 109 109 110 /* PT_debug.cxx */ … … 113 114 114 115 /* probe_tree.h */ 115 template <typename T >int PT_forwhole_chain(P TM2 *ptmain, POS_TREE *node, T func);116 template <typename T >int PT_withall_tips(P TM2 *ptmain, POS_TREE *node, T func);116 template <typename T >int PT_forwhole_chain(POS_TREE *node, T func); 117 template <typename T >int PT_withall_tips(POS_TREE *node, T func); 117 118 118 119 #else -
trunk/SERVERCNTRL/servercntrl.cxx
r7811 r8041 153 153 154 154 if (!error) { 155 #if defined(DEBUG) 156 printf("Starting server (cmd='%s')\n", command); 157 #endif // DEBUG 155 printf("[Starting server (cmd='%s')]\n", command); 158 156 if (!gbmain || GBCMC_system(gbmain, command)) system(command); 159 157 if (do_sleep) sleep(delay); -
trunk/SL/Makefile
r7801 r8041 1 1 2 2 ARCHS_ALL = \ 3 PTCLEAN/PTCLEAN.dummy \ 3 4 ALIVIEW/ALIVIEW.dummy \ 4 5 AP_TREE/AP_TREE.dummy \ -
trunk/SL/PTCLEAN
-
Property
svn:ignore set
to
*.bak
*.gcno
-
Property
svn:ignore set
to
-
trunk/SL/PTCLEAN/Makefile
r7993 r8041 33 33 ptclean.o: ptclean.h 34 34 ptclean.o: $(ARBHOME)/INCLUDE/ad_prot.h 35 ptclean.o: $(ARBHOME)/INCLUDE/ad_t_prot.h 35 36 ptclean.o: $(ARBHOME)/INCLUDE/arb_assert.h 36 37 ptclean.o: $(ARBHOME)/INCLUDE/arb_core.h … … 40 41 ptclean.o: $(ARBHOME)/INCLUDE/arbdb.h 41 42 ptclean.o: $(ARBHOME)/INCLUDE/arbdb_base.h 43 ptclean.o: $(ARBHOME)/INCLUDE/arbdbt.h 42 44 ptclean.o: $(ARBHOME)/INCLUDE/arbtools.h 43 45 ptclean.o: $(ARBHOME)/INCLUDE/attributes.h -
trunk/SL/PTCLEAN/ptclean.cxx
r7993 r8041 11 11 12 12 #include "ptclean.h" 13 #include <arbdb.h> 13 #include <arbdbt.h> 14 15 #define pt_assert(cond) arb_assert(cond) 14 16 15 17 // using namespace std; 16 18 17 GB_ERROR clean_ptserver_database(GBDATA *gb_main, Servertype type) { 18 fprintf(stderr, "********* clean_ptserver_database does not delete anything yet\n"); 19 // return "test-error"; 20 return NULL; 19 class EntryTempMarker : virtual Noncopyable { 20 // marks all entries of DB as 'temp', that are of no use for PTSERVER 21 // (Note: 'temp' entries will not be saved) 22 23 GBDATA *gb_main; 24 GB_transaction ta; 25 Servertype type; 26 char *ali_name; 27 28 enum Need { 29 NONE, 30 ALL, 31 SOME_OF_ROOT, 32 SOME_OF_PRESETS, 33 SOME_OF_SPECIES_DATA, 34 SOME_OF_EXTENDED_DATA, 35 SOME_OF_SPECIES, 36 SOME_OF_EXTENDED, 37 SOME_OF_ALI_CONTAINER, // below species or SAI 38 }; 39 40 Need data_needed(GBDATA *gbd, const char *keyname, Need from) const { 41 switch (from) { 42 case SOME_OF_ROOT: 43 if (strcmp(keyname, "__SYSTEM__") == 0) return ALL; 44 if (strcmp(keyname, "genom_db") == 0) return ALL; 45 if (strcmp(keyname, "gene_map") == 0) return ALL; 46 if (strcmp(keyname, "species_data") == 0) return SOME_OF_SPECIES_DATA; 47 if (strcmp(keyname, "extended_data") == 0) return SOME_OF_EXTENDED_DATA; 48 if (strcmp(keyname, "presets") == 0) return SOME_OF_PRESETS; 49 break; 50 51 case SOME_OF_SPECIES_DATA: 52 if (strcmp(keyname, "species") == 0) return SOME_OF_SPECIES; 53 break; 54 55 case SOME_OF_EXTENDED_DATA: 56 if (strcmp(keyname, "extended") == 0) { 57 const char *sainame = GBT_read_name(gbd); 58 if (strcmp(sainame, "ECOLI") == 0) return SOME_OF_EXTENDED; // only "need" ECOLI 59 } 60 break; 61 62 case SOME_OF_SPECIES: 63 case SOME_OF_EXTENDED: 64 if (from == SOME_OF_SPECIES) { 65 if (strcmp(keyname, "abspos") == 0) return ALL; 66 } 67 if (strcmp(keyname, "name") == 0) return ALL; 68 if (strcmp(keyname, "acc") == 0) return ALL; 69 if (strcmp(keyname, "full_name") == 0) return ALL; 70 if (strcmp(keyname, ali_name) == 0) return SOME_OF_ALI_CONTAINER; 71 break; 72 73 case SOME_OF_PRESETS: 74 if (strcmp(keyname, "use") == 0) return ALL; 75 break; 76 77 case SOME_OF_ALI_CONTAINER: 78 if (strcmp(keyname, "data") == 0) return ALL; 79 break; 80 81 case NONE: pt_assert(0); break; 82 case ALL: pt_assert(0); break; 83 } 84 85 return NONE; 86 } 87 88 GB_ERROR mark_child(GBDATA *gb_entry, const char *keyname, Need from) { 89 GB_ERROR error = 0; 90 Need need = data_needed(gb_entry, keyname, from); 91 switch (need) { 92 case NONE: error = GB_set_temporary(gb_entry); break; 93 case ALL: pt_assert(!GB_is_temporary(gb_entry)); break; 94 default: error = mark_subentries(gb_entry, need); break; 95 } 96 return error; 97 } 98 GB_ERROR mark_subentries(GBDATA *gb_father, Need from) { 99 GB_ERROR error = 0; 100 if (!GB_is_temporary(gb_father)) { 101 for (GBDATA *gb_child = GB_child(gb_father); gb_child && !error; gb_child = GB_nextChild(gb_child)) { 102 const char *key = GB_read_key_pntr(gb_child); 103 error = mark_child(gb_child, key, from); 104 } 105 } 106 return error; 107 } 108 109 public: 110 EntryTempMarker(Servertype type_, GBDATA *gb_main_) 111 : gb_main(gb_main_), 112 ta(gb_main), 113 type(type_), 114 ali_name(GBT_get_default_alignment(gb_main)) 115 {} 116 ~EntryTempMarker() { free(ali_name); } 117 118 GB_ERROR mark_unwanted_entries() { return mark_subentries(gb_main, SOME_OF_ROOT); } 119 }; 120 121 inline GB_ERROR clean_ptserver_database(GBDATA *gb_main, Servertype type) { 122 return EntryTempMarker(type, gb_main).mark_unwanted_entries(); 21 123 } 22 124 125 GB_ERROR prepare_ptserver_database(GBDATA *gb_main, Servertype type) { 126 GB_ERROR error = GB_request_undo_type(gb_main, GB_UNDO_NONE); 127 if (!error) { 128 GB_push_my_security(gb_main); 129 error = clean_ptserver_database(gb_main, type); 130 if (!error) { 131 // @@@ calculate bp and checksums 132 } 133 GB_pop_my_security(gb_main); 134 } 135 return error; 136 } 23 137 // -------------------------------------------------------------------------------- 24 138 … … 29 143 30 144 void TEST_ptclean() { 31 GB_shell shell; 32 GBDATA *gb_main = GB_open("TEST_pt_src.arb", "rw"); 145 GB_shell shell; 146 GBDATA *gb_main = GB_open("TEST_pt_src.arb", "rw"); 147 const char *saveas = "TEST_pt_cleaned.arb"; 33 148 34 149 TEST_ASSERT(gb_main); 35 TEST_ASSERT_NO_ERROR( clean_ptserver_database(gb_main, PTSERVER));36 TEST_ASSERT_NO_ERROR(GB_save_as(gb_main, "TEST_pt_cleaned.arb", "a"));150 TEST_ASSERT_NO_ERROR(prepare_ptserver_database(gb_main, PTSERVER)); 151 TEST_ASSERT_NO_ERROR(GB_save_as(gb_main, saveas, "a")); 37 152 GB_close(gb_main); 38 153 39 #define TEST_AUTO_UPDATE154 // #define TEST_AUTO_UPDATE 40 155 #if defined(TEST_AUTO_UPDATE) 41 156 TEST_COPY_FILE("TEST_pt_cleaned.arb", "TEST_pt_cleaned_expected.arb"); 42 157 #else 43 TEST_ASSERT_ FILES_EQUAL("TEST_pt_cleaned.arb", "TEST_pt_cleaned_expected.arb");158 TEST_ASSERT_TEXTFILES_EQUAL("TEST_pt_cleaned.arb", "TEST_pt_cleaned_expected.arb"); 44 159 #endif 160 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(GB_unlink(saveas)); 45 161 } 46 162 -
trunk/SL/PTCLEAN/ptclean.h
r7993 r8041 22 22 }; 23 23 24 GB_ERROR clean_ptserver_database(GBDATA *gb_main, Servertype type);24 GB_ERROR prepare_ptserver_database(GBDATA *gb_main, Servertype type); 25 25 26 26 #else -
trunk/SOURCE_TOOLS/dep.4dummy
r7935 r8041 24 24 PHYLO/PHYLO.dummy: AWT/AWT.dummy SL/MATRIX/MATRIX.dummy 25 25 PRIMER_DESIGN/PRIMER_DESIGN.dummy: AWT/AWT.dummy 26 PROBE/PROBE.dummy: PROBE_COM/PROBE_COM.dummy SERVERCNTRL/SERVERCNTRL.dummy SL/HELIX/HELIX.dummy 26 PROBE/PROBE.dummy: PROBE_COM/PROBE_COM.dummy SERVERCNTRL/SERVERCNTRL.dummy SL/HELIX/HELIX.dummy SL/PTCLEAN/PTCLEAN.dummy 27 27 PROBE_DESIGN/PROBE_DESIGN.dummy: SERVERCNTRL/SERVERCNTRL.dummy SL/TREEDISP/TREEDISP.dummy 28 28 RNA3D/RNA3D.dummy: AWT/AWT.dummy GL/glAW/glAW.dummy GL/glpng/glpng.dummy SL/HELIX/HELIX.dummy … … 48 48 SL/NEIGHBOURJOIN/NEIGHBOURJOIN.dummy: ARBDB/ARBDB.dummy 49 49 SL/PRONUC/PRONUC.dummy: ARBDB/ARBDB.dummy 50 SL/PTCLEAN/PTCLEAN.dummy: ARBDB/ARBDB.dummy 50 51 SL/REFENTRIES/REFENTRIES.dummy: WINDOW/WINDOW.dummy 51 52 SL/REGEXPR/REGEXPR.dummy: ARBDB/ARBDB.dummy -
trunk/SOURCE_TOOLS/dep.alltargets
r7935 r8041 48 48 SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a 49 49 SL/PRONUC/PRONUC.a 50 SL/PTCLEAN/PTCLEAN.a 50 51 SL/REFENTRIES/REFENTRIES.a 51 52 SL/REGEXPR/REGEXPR.a -
trunk/SOURCE_TOOLS/dep.libtargets
r7935 r8041 48 48 SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a 49 49 SL/PRONUC/PRONUC.a 50 SL/PTCLEAN/PTCLEAN.a 50 51 SL/REFENTRIES/REFENTRIES.a 51 52 SL/REGEXPR/REGEXPR.a -
trunk/SOURCE_TOOLS/generate_all_links.sh
r7916 r8041 278 278 symlink_file ../SL/PRONUC/AP_pro_a_nucs.hxx INCLUDE/AP_pro_a_nucs.hxx && 279 279 symlink_file ../SL/PRONUC/iupac.h INCLUDE/iupac.h && 280 symlink_file ../SL/PTCLEAN/ptclean.h INCLUDE/ptclean.h && 280 281 symlink_file ../SL/REFENTRIES/refentries.h INCLUDE/refentries.h && 281 282 symlink_file ../SL/REGEXPR/RegExpr.hxx INCLUDE/RegExpr.hxx && -
trunk/TOOLS/arb_probe.cxx
r7986 r8041 319 319 320 320 #ifdef UNIT_TESTS 321 const int minServerID = TEST_ SERVER_ID;321 const int minServerID = TEST_GENESERVER_ID; 322 322 #else // !UNIT_TESTS 323 323 const int minServerID = 0; … … 326 326 P.SERVERID = getInt("serverid", 0, minServerID, 100, "Server Id, look into $ARBHOME/lib/arb_tcp.dat"); 327 327 #ifdef UNIT_TESTS 328 if (P.SERVERID<0) { arb_assert(P.SERVERID == TEST_SERVER_ID ); }328 if (P.SERVERID<0) { arb_assert(P.SERVERID == TEST_SERVER_ID || P.SERVERID == TEST_GENESERVER_ID); } 329 329 #endif 330 330 … … 455 455 #endif 456 456 457 static void test_setup() { 458 static bool setup = false; 459 if (!setup) { 460 TEST_SETUP_GLOBAL_ENVIRONMENT("ptserver"); // first call will recreate the test pt-server 461 setup = true; 462 } 457 static int test_setup(bool use_gene_ptserver) { 458 static bool setup[2] = { false, false }; 459 if (!setup[use_gene_ptserver]) { 460 TEST_SETUP_GLOBAL_ENVIRONMENT(use_gene_ptserver ? "ptserver_gene" : "ptserver"); // first call will recreate the test pt-server 461 setup[use_gene_ptserver] = true; 462 } 463 return use_gene_ptserver ? TEST_GENESERVER_ID : TEST_SERVER_ID; 463 464 } 464 465 465 466 void TEST_SLOW_variable_defaults_in_server() { 466 test_setup( );467 test_setup(false); 467 468 468 469 const char *server_tag = GBS_ptserver_tag(TEST_SERVER_ID); … … 524 525 // test probe design / match 525 526 526 #define TEST_PART1(fake_argc,fake_argv) \ 527 test_setup(); \ 528 TEST_ASSERT_EQUAL(true, parseCommandLine(fake_argc, fake_argv)); \ 529 P.SERVERID = TEST_SERVER_ID; \ 530 ARB_ERROR error; \ 531 char *answer = execute(error); \ 532 TEST_ASSERT_NO_ERROR(error.deliver()); \ 527 #define TEST_PART1(fake_argc,fake_argv) \ 528 int serverid = test_setup(use_gene_ptserver); \ 529 TEST_ASSERT_EQUAL(true, parseCommandLine(fake_argc, fake_argv)); \ 530 TEST_ASSERT((serverid == TEST_SERVER_ID)||(serverid == TEST_GENESERVER_ID)); \ 531 P.SERVERID = serverid; \ 532 ARB_ERROR error; \ 533 char *answer = execute(error); \ 534 TEST_ASSERT_NO_ERROR(error.deliver()) 533 535 534 536 … … 553 555 } while(0) 554 556 557 typedef const char *CCP; 555 558 void TEST_SLOW_match_probe() { 556 typedef const char *CCP;557 { 558 const char *arguments[] = { 559 " fake", // "program"-name559 bool use_gene_ptserver = false; 560 { 561 const char *arguments[] = { 562 "prgnamefake", 560 563 "matchsequence=UAUCGGAGAGUUUGA", 561 564 }; 562 CCP expected = " name---- fullname mis N_mis wmis pos rev 'UAUCGGAGAGUUUGA'\1"563 "BcSSSS00\1" " BcSSSS00 0 0 0.0 3 0 .......UU-===============-UCAAGUCGA\1";565 CCP expected = " name---- fullname mis N_mis wmis pos ecoli rev 'UAUCGGAGAGUUUGA'\1" 566 "BcSSSS00\1" " BcSSSS00 0 0 0.0 3 2 0 .......UU-===============-UCAAGUCGA\1"; 564 567 565 568 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected); … … 571 574 { 572 575 const char *arguments[] = { 573 " fake", // "program"-name576 "prgnamefake", 574 577 "matchsequence=CANCUCCUUUC", // contains 1 N 575 578 NULL // matchmismatches 576 579 }; 577 580 578 CCP expectd0 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUUC'\1" 579 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 0 CGGCUGGAU-==C========-U\1"; // only N-mismatch accepted 580 581 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUUC'\1" 582 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 0 CGGCUGGAU-==C========-U\1" 583 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 0 CGGCUGGAU-==C=======N-N\1" 584 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 0 AGAUUAAUA-=CC========-U\1"; 585 586 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUUC'\1" 587 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 0 CGGCUGGAU-==C========-U\1" 588 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 0 CGGCUGGAU-==C=======N-N\1" 589 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 0 CGGCUGGAU-==C======NN-N\1" 590 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 0 AGAUUAAUA-=CC========-U\1"; 581 CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1" 582 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 162 0 CGGCUGGAU-==C========-U\1" ""; // only N-mismatch accepted 583 584 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1" 585 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 162 0 CGGCUGGAU-==C========-U\1" 586 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 162 0 CGGCUGGAU-==C=======N-N\1" 587 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 162 0 AGAUUAAUA-=CC========-U\1"; 588 589 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1" 590 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 162 0 CGGCUGGAU-==C========-U\1" 591 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 162 0 CGGCUGGAU-==C=======N-N\1" 592 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 162 0 CGGCUGGAU-==C======NN-N\1" 593 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 162 0 AGAUUAAUA-=CC========-U\1"; 594 595 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); 596 arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1); 597 arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2); 598 } 599 { 600 const char *arguments[] = { 601 "prgnamefake", 602 "matchsequence=UCACCUCCUUUC", // contains no N 603 NULL // matchmismatches 604 }; 605 606 CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 607 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" 608 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 161 0 GCGGCUGGA-===========N-N\1"; 609 610 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 611 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" 612 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 161 0 GCGGCUGGA-===========N-N\1" 613 "DlcTolu2\1" " DlcTolu2 0 2 0.0 175 161 0 GCGGCUGGA-==========NN-N\1" ""; 614 615 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 616 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" 617 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 161 0 GCGGCUGGA-===========N-N\1" 618 "DlcTolu2\1" " DlcTolu2 0 2 0.0 175 161 0 GCGGCUGGA-==========NN-N\1" 619 "ClfPerfr\1" " ClfPerfr 2 0 0.0 175 161 0 AAGAUUAAU-A=C=========-U\1" ""; 591 620 592 621 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); … … 594 623 arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2); 595 624 } 596 { 597 const char *arguments[] = {598 "fake", // "program"-name599 "matchsequence=UCACCUCCUUUC", // contains no N 600 NULL // matchmismatches601 };602 603 CCP expectd0 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1"604 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1"605 " PbcAcet2\1" " PbcAcet2 0 1 0.0 175 0 GCGGCUGGA-===========N-N\1" "";606 607 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1" 608 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1"609 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 0 GCGGCUGGA-===========N-N\1" 610 "DlcTolu2\1" " DlcTolu2 0 2 0.0 175 0 GCGGCUGGA-==========NN-N\1" "";611 612 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1"613 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1"614 " PbcAcet2\1" " PbcAcet2 0 1 0.0 175 0 GCGGCUGGA-===========N-N\1"615 " DlcTolu2\1" " DlcTolu2 0 2 0.0 175 0 GCGGCUGGA-==========NN-N\1"616 "ClfPerfr\1" " ClfPerfr 2 0 0.0 175 0 AAGAUUAAU-A=C=========-U\1" "";625 626 // ---------------------------------------------- 627 // do not accept any N-matches as match 628 629 { 630 const char *arguments[] = { 631 "prgnamefake", 632 "matchsequence=CANCUCCUUUC", // contains 1 N 633 NULL, // matchmismatches 634 "matchacceptN=0", 635 }; 636 637 CCP expectd0 = ""; // nothing matches 638 639 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1" 640 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 162 0 CGGCUGGAU-==C========-U\1" ""; 641 642 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1" 643 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 162 0 CGGCUGGAU-==C========-U\1" 644 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 162 0 CGGCUGGAU-==C=======N-N\1" 645 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 162 0 AGAUUAAUA-=CC========-U\1" ""; 617 646 618 647 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); … … 620 649 arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2); 621 650 } 622 623 // ---------------------------------------------- 624 // do not accept any N-matches as match 625 626 { 627 const char *arguments[] = { 628 "fake", // "program"-name 629 "matchsequence=CANCUCCUUUC", // contains 1 N 630 NULL, // matchmismatches 631 "matchacceptN=0", 632 }; 633 634 CCP expectd0 = ""; // nothing matches 635 636 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUUC'\1" 637 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 0 CGGCUGGAU-==C========-U\1" ""; 638 639 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUUC'\1" 640 "BcSSSS00\1" " BcSSSS00 0 1 0.0 176 0 CGGCUGGAU-==C========-U\1" 641 "PbcAcet2\1" " PbcAcet2 0 2 0.0 176 0 CGGCUGGAU-==C=======N-N\1" 642 "ClfPerfr\1" " ClfPerfr 1 1 0.0 176 0 AGAUUAAUA-=CC========-U\1" ""; 643 644 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); 645 arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1); 646 arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2); 647 } 648 { 649 const char *arguments[] = { 650 "fake", // "program"-name 651 { 652 const char *arguments[] = { 653 "prgnamefake", 651 654 "matchsequence=UCACCUCCUUUC", // contains no N 652 655 NULL, // matchmismatches … … 654 657 }; 655 658 656 CCP expectd0 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1"657 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1" "";658 659 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1"660 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1"661 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 0 GCGGCUGGA-===========N-N\1" "";662 663 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'UCACCUCCUUUC'\1"664 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 0 GCGGCUGGA-============-U\1"665 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 0 GCGGCUGGA-===========N-N\1"666 "DlcTolu2\1" " DlcTolu2 0 2 0.0 175 0 GCGGCUGGA-==========NN-N\1"667 "ClfPerfr\1" " ClfPerfr 2 0 0.0 175 0 AAGAUUAAU-A=C=========-U\1" "";659 CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 660 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" ""; 661 662 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 663 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" 664 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 161 0 GCGGCUGGA-===========N-N\1" ""; 665 666 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1" 667 "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U\1" 668 "PbcAcet2\1" " PbcAcet2 0 1 0.0 175 161 0 GCGGCUGGA-===========N-N\1" 669 "DlcTolu2\1" " DlcTolu2 0 2 0.0 175 161 0 GCGGCUGGA-==========NN-N\1" 670 "ClfPerfr\1" " ClfPerfr 2 0 0.0 175 161 0 AAGAUUAAU-A=C=========-U\1" ""; 668 671 669 672 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); … … 677 680 { 678 681 const char *arguments[] = { 679 " fake", // "program"-name682 "prgnamefake", 680 683 "matchsequence=CANCUCCUUNC", // contains 2 N 681 684 NULL, // matchmismatches … … 684 687 }; 685 688 686 CCP expectd0 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUNC'\1" 687 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 0 CGGCUGGAU-==C======U=-U\1" ""; 689 CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1" 690 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 162 0 CGGCUGGAU-==C======U=-U\1" ""; 691 692 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1" 693 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 162 0 CGGCUGGAU-==C======U=-U\1" 694 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 162 0 CGGCUGGAU-==C=======N-N\1" 695 "PbcAcet2\1" " PbcAcet2 0 3 0.0 176 162 0 CGGCUGGAU-==C======UN-N\1" 696 "ClfPerfr\1" " ClfPerfr 1 2 0.0 176 162 0 AGAUUAAUA-=CC======U=-U\1" ""; 688 697 689 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUNC'\1" 690 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 0 CGGCUGGAU-==C======U=-U\1" 691 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 0 CGGCUGGAU-==C=======N-N\1" 692 "PbcAcet2\1" " PbcAcet2 0 3 0.0 176 0 CGGCUGGAU-==C======UN-N\1" 693 "ClfPerfr\1" " ClfPerfr 1 2 0.0 176 0 AGAUUAAUA-=CC======U=-U\1" ""; 694 695 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'CANCUCCUUNC'\1" 696 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 0 CGGCUGGAU-==C======U=-U\1" 697 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 0 CGGCUGGAU-==C=======N-N\1" 698 "PbcAcet2\1" " PbcAcet2 0 3 0.0 176 0 CGGCUGGAU-==C======UN-N\1" 699 "ClfPerfr\1" " ClfPerfr 1 2 0.0 176 0 AGAUUAAUA-=CC======U=-U\1" ""; 698 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1" 699 "BcSSSS00\1" " BcSSSS00 0 2 0.0 176 162 0 CGGCUGGAU-==C======U=-U\1" 700 "DlcTolu2\1" " DlcTolu2 0 3 0.0 176 162 0 CGGCUGGAU-==C=======N-N\1" 701 "PbcAcet2\1" " PbcAcet2 0 3 0.0 176 162 0 CGGCUGGAU-==C======UN-N\1" 702 "ClfPerfr\1" " ClfPerfr 1 2 0.0 176 162 0 AGAUUAAUA-=CC======U=-U\1" ""; 700 703 701 704 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); … … 709 712 { 710 713 const char *arguments[] = { 711 " fake", // "program"-name714 "prgnamefake", 712 715 "matchsequence=CANCNCNNUNC", // contains 5N 713 716 NULL, // matchmismatches … … 717 720 }; 718 721 719 CCP expectd0 = " name---- fullname mis N_mis wmis pos rev 'CANCNCNNUNC'\1"720 "BcSSSS00\1" " BcSSSS00 0 5 0.0 176 0 CGGCUGGAU-==C=U=CU=U=-U\1" "";721 722 CCP expectd1 = " name---- fullname mis N_mis wmis pos rev 'CANCNCNNUNC'\1"723 "BcSSSS00\1" " BcSSSS00 0 5 0.0 176 0 CGGCUGGAU-==C=U=CU=U=-U\1"724 "DlcTolu2\1" " DlcTolu2 0 6 0.0 176 0 CGGCUGGAU-==C=U=CU==N-N\1"725 "PbcAcet2\1" " PbcAcet2 0 6 0.0 176 0 CGGCUGGAU-==C=U=CU=UN-N\1"726 "LgtLytic\1" " LgtLytic 1 5 0.0 31 0 GUCGAACGG-==G=A=AG=CU-AGCUUGCUA\1"727 "ClfPerfr\1" " ClfPerfr 1 5 0.0 111 0 CGGCUGGAU-==U=AUAA=G=-AGCGAUUGG\1"; // one hit is truncated here722 CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1" 723 "BcSSSS00\1" " BcSSSS00 0 5 0.0 176 162 0 CGGCUGGAU-==C=U=CU=U=-U\1" ""; 724 725 CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1" 726 "BcSSSS00\1" " BcSSSS00 0 5 0.0 176 162 0 CGGCUGGAU-==C=U=CU=U=-U\1" 727 "DlcTolu2\1" " DlcTolu2 0 6 0.0 176 162 0 CGGCUGGAU-==C=U=CU==N-N\1" 728 "PbcAcet2\1" " PbcAcet2 0 6 0.0 176 162 0 CGGCUGGAU-==C=U=CU=UN-N\1" 729 "LgtLytic\1" " LgtLytic 1 5 0.0 31 26 0 GUCGAACGG-==G=A=AG=CU-AGCUUGCUA\1" 730 "ClfPerfr\1" " ClfPerfr 1 5 0.0 111 99 0 CGGCUGGAU-==U=AUAA=G=-AGCGAUUGG\1"; // one hit is truncated here 728 731 729 CCP expectd2 = " name---- fullname mis N_mis wmis pos rev 'CANCNCNNUNC'\1"730 "VbrFurni\1" " VbrFurni 2 5 0.0 40 0 CGGCAGCGA-==A=AUUGAA=-CUUCGGGGG\1"731 "HllHalod\1" " HllHalod 2 5 0.0 45 0 AAACGAUGG-A=G=UUGC=U=-CAGGCGUCG\1"732 "VblVulni\1" " VblVulni 2 5 0.0 49 0 AGCACAGAG-A=A=UUGU=U=-UCGGGUGGC\1"733 "LgtLytic\1" " LgtLytic 2 5 0.0 101 0 GGGGAAACU-==AGCUAA=A=-CGCAUAAUC\1"734 "ClfPerfr\1" " ClfPerfr 2 5 0.0 172 0 AGGAAGAUU-A=UAC=CC=C=-UUUCU\1" ""; // many hits are truncated here732 CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1" 733 "VbrFurni\1" " VbrFurni 2 5 0.0 40 35 0 CGGCAGCGA-==A=AUUGAA=-CUUCGGGGG\1" 734 "HllHalod\1" " HllHalod 2 5 0.0 45 40 0 AAACGAUGG-A=G=UUGC=U=-CAGGCGUCG\1" 735 "VblVulni\1" " VblVulni 2 5 0.0 49 44 0 AGCACAGAG-A=A=UUGU=U=-UCGGGUGGC\1" 736 "LgtLytic\1" " LgtLytic 2 5 0.0 101 89 0 GGGGAAACU-==AGCUAA=A=-CGCAUAAUC\1" 737 "ClfPerfr\1" " ClfPerfr 2 5 0.0 172 158 0 AGGAAGAUU-A=UAC=CC=C=-UUUCU\1"; // many hits are truncated here 735 738 736 739 arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0); 737 740 arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1); 738 741 arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2); 742 } 743 } 744 745 void TEST_SLOW_match_geneprobe() { 746 bool use_gene_ptserver = true; 747 { 748 const char *arguments[] = { 749 "prgnamefake", 750 "matchsequence=NNUCNN", 751 "matchacceptN=4", 752 "matchlimitN=5", 753 }; 754 CCP expectd = " organism genename------- mis N_mis wmis pos gpos rev 'NNUCNN'\1" 755 "genome2\1" " genome2 gene3 0 4 0.0 2 1 0 .........-UU==GG-UUGAUC\1" 756 "genome2\1" " genome2 joined1 0 4 0.0 2 1 0 .........-UU==GG-UUGAUCCUG\1" 757 "genome2\1" " genome2 gene2 0 4 0.0 10 4 0 ......GUU-GA==CU-GCCA\1" 758 "genome2\1" " genome2 intergene_19_65 0 4 0.0 31 12 0 GGUUACUGC-AU==GG-UGUUCGCCU\1" 759 "genome1\1" " genome1 intergene_17_65 0 4 0.0 31 14 0 GGUUACUGC-UA==GG-UGUUCGCCU\1" 760 "genome2\1" " genome2 intergene_19_65 0 4 0.0 38 19 0 GCAUUCGGU-GU==GC-CUAAGCACU\1" 761 "genome1\1" " genome1 intergene_17_65 0 4 0.0 38 21 0 GCUAUCGGU-GU==GC-CUAAGCCAU\1" 762 "genome1\1" " genome1 intergene_17_65 0 4 0.0 56 39 0 AGCCAUGCG-AG==AU-AUGUA\1" ""; 763 764 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); 765 } 766 { 767 const char *arguments[] = { 768 "prgnamefake", 769 "matchsequence=NGGUUN", 770 "matchacceptN=2", 771 "matchlimitN=3", 772 }; 773 CCP expectd = " organism genename------- mis N_mis wmis pos gpos rev 'NGGUUN'\1" 774 "genome1\1" " genome1 joined1 0 2 0.0 5 2 0 ........C-U====G-AUCCUGC\1" 775 "genome2\1" " genome2 intergene_19_65 0 2 0.0 21 2 0 ........G-A====A-CUGCAUUCG\1" 776 "genome1\1" " genome1 intergene_17_65 0 2 0.0 21 4 0 ......CAG-A====A-CUGCUAUCG\1" 777 "genome2\1" " genome2 gene3 0 2 0.0 5 4 0 ......UUU-C====G-AUC\1" 778 "genome2\1" " genome2 joined1 0 2 0.0 5 4 0 ......UUU-C====G-AUCCUGCCA\1" ""; 779 780 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); 781 } 782 783 { 784 const char *arguments[] = { 785 "prgnamefake", 786 "matchsequence=UGAUCCU", // exists in data 787 }; 788 CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UGAUCCU'\1" 789 "genome1\1" " genome1 gene2 0 0 0.0 9 1 0 .........-=======-GC\1" 790 "genome2\1" " genome2 gene2 0 0 0.0 9 3 0 .......GU-=======-GCCA\1" ""; 791 792 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // @@@ defect: probe exists as well in 'joined1' (of both genomes) 793 } 794 { 795 const char *arguments[] = { 796 "prgnamefake", 797 "matchsequence=GAUCCU", 798 }; 799 CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'GAUCCU'\1" 800 "genome2\1" " genome2 gene2 0 0 0.0 10 4 0 ......GUU-======-GCCA\1" ""; 801 802 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // @@@ defect: probe is part of above probe, but reports less hits 803 } 804 { 805 const char *arguments[] = { 806 "prgnamefake", 807 "matchsequence=UUUCGG", // exists only in genome2 808 }; 809 CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UUUCGG'\1" 810 "genome2\1" " genome2 gene3 0 0 0.0 2 1 0 .........-======-UUGAUC\1" 811 "genome2\1" " genome2 joined1 0 0 0.0 2 1 0 .........-======-UUGAUCCUG\1" ""; 812 813 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // @@@ defect: also exists in genome2/gene1 814 } 815 { 816 const char *arguments[] = { 817 "prgnamefake", 818 "matchsequence=AUCCUG", 819 }; 820 CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'AUCCUG'\1" 821 "genome2\1" " genome2 gene2 0 0 0.0 11 5 0 .....GUUG-======-CCA\1" ""; 822 823 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // @@@ defect: exists in 'gene2' and 'joined1' of both genomes 824 } 825 { 826 const char *arguments[] = { 827 "prgnamefake", 828 "matchsequence=UUGAUCCUGC", 829 }; 830 CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UUGAUCCUGC'\1" 831 "genome2\1" " genome2 gene2 0 0 0.0 8 2 0 ........G-==========-CA\1" 832 "genome1\1" " genome1 joined1 0 0 0.0 8 5 0 .....CUGG-==========-\1" ""; 833 834 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // @@@ defect: also exists in 'genome2/joined1' 739 835 } 740 836 } … … 773 869 774 870 void TEST_SLOW_design_probe() { 871 bool use_gene_ptserver = false; 775 872 const char *arguments[] = { 776 " fake", // "program"-name873 "prgnamefake", 777 874 "designnames=ClnCorin#CltBotul#CPPParap#ClfPerfr", 778 875 "designmintargets=100", … … 787 884 "Min Group Hits 100%\n" 788 885 "Target le apos ecol grps G+C 4GC+2AT Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n" 789 "CGAAAGGAAGAUUAAUAC 18 A= 94 944 33.3 48.0 GUAUUAAUCUUCCUUUCG | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"790 "GAAAGGAAGAUUAAUACC 18 A+ 1 954 33.3 48.0 GGUAUUAAUCUUCCUUUC | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"791 "UCAAGUCGAGCGAUGAAG 18 B= 18 1 84 50.0 54.0 CUUCAUCGCUCGACUUGA | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"792 "AUCAAGUCGAGCGAUGAA 18 B- 1 1 74 44.4 52.0 UUCAUCGCUCGACUUGAU | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3,\n";886 "CGAAAGGAAGAUUAAUAC 18 A= 94 82 4 33.3 48.0 GUAUUAAUCUUCCUUUCG | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 887 "GAAAGGAAGAUUAAUACC 18 A+ 1 83 4 33.3 48.0 GGUAUUAAUCUUCCUUUC | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 888 "UCAAGUCGAGCGAUGAAG 18 B= 18 17 4 50.0 54.0 CUUCAUCGCUCGACUUGA | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 889 "AUCAAGUCGAGCGAUGAA 18 B- 1 16 4 44.4 52.0 UUCAUCGCUCGACUUGAU | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3,\n"; 793 890 794 891 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected); … … 804 901 805 902 const char *arguments_loc[] = { 806 " fake", // "program"-name903 "prgnamefake", 807 904 // "designnames=Stsssola#Stsssola", // @@@ crashes the ptserver 808 905 "designnames=CPPParap#PsAAAA00", … … 823 920 824 921 void TEST_SLOW_match_designed_probe() { 922 bool use_gene_ptserver = false; 825 923 const char *arguments[] = { 826 " fake", // "program"-name924 "prgnamefake", 827 925 "matchsequence=UCAAGUCGAGCGAUGAAG", 828 926 }; 829 const char *expected = 830 " name---- fullname mis N_mis wmis pos rev 'UCAAGUCGAGCGAUGAAG'\1" 831 "ClnCorin\1" " ClnCorin 0 0 0.0 18 0 .GAGUUUGA-==================-UUCCUUCGG\1" 832 "CltBotul\1" " CltBotul 0 0 0.0 18 0 ........A-==================-CUUCUUCGG\1" 833 "CPPParap\1" " CPPParap 0 0 0.0 18 0 AGAGUUUGA-==================-UUCCUUCGG\1" 834 "ClfPerfr\1" " ClfPerfr 0 0 0.0 18 0 AGAGUUUGA-==================-UUUCCUUCG\1"; 927 CCP expected = " name---- fullname mis N_mis wmis pos ecoli rev 'UCAAGUCGAGCGAUGAAG'\1" 928 "ClnCorin\1" " ClnCorin 0 0 0.0 18 17 0 .GAGUUUGA-==================-UUCCUUCGG\1" 929 "CltBotul\1" " CltBotul 0 0 0.0 18 17 0 ........A-==================-CUUCUUCGG\1" 930 "CPPParap\1" " CPPParap 0 0 0.0 18 17 0 AGAGUUUGA-==================-UUCCUUCGG\1" 931 "ClfPerfr\1" " ClfPerfr 0 0 0.0 18 17 0 AGAGUUUGA-==================-UUUCCUUCG\1"; 835 932 836 933 TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected); -
trunk/TOOLS/arb_test.cxx
r8037 r8041 66 66 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(GB_unlink("ascii2bin.ARF")); 67 67 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(GB_unlink("ascii2bin2.ARF")); 68 }69 70 void TEST_SLOW_arb_gene_probe() {71 const char *genome = "tools/gene_probe.arb";72 const char *out = "tools/gene_probe_out.arb";73 const char *expected = "tools/gene_probe_expected.arb";74 75 TEST_RUN_TOOL(GBS_global_string("arb_gene_probe %s %s", genome, out));76 TEST_ASSERT_FILES_EQUAL(out, expected);77 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(GB_unlink(out));78 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(GB_unlink("tools/gene_probe_out.ARM"));79 68 } 80 69 … … 181 170 182 171 void TEST_arb_replace() { 183 const char *infile = "tools/ gene_probe.arb";172 const char *infile = "tools/arb_replace.in"; 184 173 const char *file1 = "tools/arb_replace_1.out"; 185 174 const char *file2 = "tools/arb_replace_2.out"; … … 299 288 " matchsequence=UAUCGGAGAGUUUGA", 300 289 301 " name---- fullname mis N_mis wmis pos rev 'UAUCGGAGAGUUUGA'" 302 "BcSSSS00" 303 " BcSSSS00 0 0 0.0 3 0 .......UU-===============-UCAAGUCGA" 304 ); 290 /* ---- */ " name---- fullname mis N_mis wmis pos ecoli rev 'UAUCGGAGAGUUUGA'\1" 291 "BcSSSS00\1" " BcSSSS00 0 0 0.0 3 2 0 .......UU-===============-UCAAGUCGA\1" 292 ); 305 293 306 294 TEST_STDOUT_EQUALS("arb_probe" … … 317 305 "Min Group Hits 100%\n" 318 306 "Target le apos ecol grps G+C 4GC+2AT Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n" 319 "CGAAAGGAAGAUUAAUAC 18 A= 94 944 33.3 48.0 GUAUUAAUCUUCCUUUCG | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"320 "GAAAGGAAGAUUAAUACC 18 A+ 1 954 33.3 48.0 GGUAUUAAUCUUCCUUUC | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"321 "UCAAGUCGAGCGAUGAAG 18 B= 18 1 84 50.0 54.0 CUUCAUCGCUCGACUUGA | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n"322 "AUCAAGUCGAGCGAUGAA 18 B- 1 1 74 44.4 52.0 UUCAUCGCUCGACUUGAU | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3,\n"307 "CGAAAGGAAGAUUAAUAC 18 A= 94 82 4 33.3 48.0 GUAUUAAUCUUCCUUUCG | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 308 "GAAAGGAAGAUUAAUACC 18 A+ 1 83 4 33.3 48.0 GGUAUUAAUCUUCCUUUC | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 309 "UCAAGUCGAGCGAUGAAG 18 B= 18 17 4 50.0 54.0 CUUCAUCGCUCGACUUGA | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n" 310 "AUCAAGUCGAGCGAUGAA 18 B- 1 16 4 44.4 52.0 UUCAUCGCUCGACUUGAU | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3,\n" 323 311 ); 324 312 } -
trunk/UNIT_TESTER/TestEnvironment.cxx
r7819 r8041 270 270 // ptserver 271 271 272 static void test_ptserver_activate(bool start ) {273 const char *server_tag = GBS_ptserver_tag( TEST_SERVER_ID);272 static void test_ptserver_activate(bool start, int serverid) { 273 const char *server_tag = GBS_ptserver_tag(serverid); 274 274 if (start) { 275 275 TEST_ASSERT_NO_ERROR(arb_look_and_start_server(AISC_MAGIC_NUMBER, server_tag, 0)); … … 290 290 switch (mode) { 291 291 case SETUP: { 292 test_ptserver_activate(false );// first kill pt-server (otherwise we may test an outdated pt-server)293 TEST_ASSERT_NO_ERROR(GB_system(" touchTEST_pt.arb")); // force rebuild294 test_ptserver_activate(true );292 test_ptserver_activate(false, TEST_SERVER_ID); // first kill pt-server (otherwise we may test an outdated pt-server) 293 TEST_ASSERT_NO_ERROR(GB_system("cp TEST_pt_src.arb TEST_pt.arb")); // force rebuild 294 test_ptserver_activate(true, TEST_SERVER_ID); 295 295 TEST_ASSERT_FILES_EQUAL("TEST_pt.arb.pt.expected", "TEST_pt.arb.pt"); 296 296 TEST_ASSERT(GB_time_of_file("TEST_pt.arb.pt") >= GB_time_of_file("TEST_pt.arb")); … … 298 298 } 299 299 case CLEAN: { 300 test_ptserver_activate(false );300 test_ptserver_activate(false, TEST_SERVER_ID); 301 301 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(unlink("TEST_pt.arb.pt")); 302 302 break; … … 307 307 } 308 308 309 return NULL; 310 } 311 312 static Error ptserver_gene(Mode mode) { 313 // test-gene-ptserver is restarted and rebuild. 314 // This is done only once in the complete test suite. 315 // 316 // every unit-test using the test-gene-ptserver should simply call 317 // TEST_SETUP_GLOBAL_ENVIRONMENT("ptserver_gene"); 318 319 // #define TEST_AUTO_UPDATE 320 321 switch (mode) { 322 case SETUP: { 323 test_ptserver_activate(false, TEST_GENESERVER_ID); // first kill pt-server (otherwise we may test an outdated pt-server) 324 TEST_ASSERT_NO_ERROR(GB_system("arb_gene_probe TEST_gpt_src.arb TEST_gpt.arb")); // prepare gene-ptserver-db (forcing rebuild) 325 326 #if defined(TEST_AUTO_UPDATE) 327 TEST_COPY_FILE("TEST_gpt.arb", "TEST_gpt.arb.expected"); 328 #else // !defined(TEST_AUTO_UPDATE) 329 TEST_ASSERT_FILES_EQUAL("TEST_gpt.arb.expected", "TEST_gpt.arb"); 330 #endif 331 332 test_ptserver_activate(true, TEST_GENESERVER_ID); 333 334 #if defined(TEST_AUTO_UPDATE) 335 TEST_COPY_FILE("TEST_gpt.arb.pt", "TEST_gpt.arb.pt.expected"); 336 #else // !defined(TEST_AUTO_UPDATE) 337 TEST_ASSERT_FILES_EQUAL("TEST_gpt.arb.pt.expected", "TEST_gpt.arb.pt"); 338 #endif 339 340 TEST_ASSERT(GB_time_of_file("TEST_gpt.arb.pt") >= GB_time_of_file("TEST_gpt.arb")); 341 break; 342 } 343 case CLEAN: { 344 test_ptserver_activate(false, TEST_GENESERVER_ID); 345 TEST_ASSERT_ZERO_OR_SHOW_ERRNO(unlink("TEST_gpt.arb.pt")); 346 break; 347 } 348 case UNKNOWN: 349 env_assert(0); 350 break; 351 } 352 353 #undef TEST_AUTO_UPDATE 354 309 355 return NULL; 310 356 } … … 414 460 static FunInfo modules[] = { 415 461 FUNINFO(ptserver), 462 FUNINFO(ptserver_gene), 416 463 }; 417 464 -
trunk/UNIT_TESTER/run
-
Property
svn:ignore set
to
TEST_gpt.ARM
TEST_gpt.arb
TEST_pt.arb
*.ARF
TEST_pt.ARM
-
Property
svn:ignore set
to
-
trunk/UNIT_TESTER/run/TEST_pt_cleaned_expected.arb
r7993 r8041 2 2 genom_db %i 0 3 3 presets %% (% 4 alignment :6000 %% (%5 alignment_name :7600 "ali_mini"6 alignment_len :7000 %i 1877 aligned :7000 %i 18 alignment_write_security :7600 %i 09 alignment_type :7000 "rna"10 auto_format %i 011 alignment_rem "<NONE>"12 %) /*alignment*/13 14 key_data %% (%15 key %% (%16 key_name "name"17 key_type %i 1218 key_hidden %i 019 %) /*key*/20 21 key %% (%22 key_name "acc"23 key_type %i 1224 key_hidden %i 025 %) /*key*/26 27 key %% (%28 key_name "ali_mini"29 key_type %i 1530 key_hidden %i 031 %) /*key*/32 33 key %% (%34 key_name "ali_mini/data"35 key_type %i 1236 key_hidden %i 037 %) /*key*/38 39 %) /*key_data*/40 41 4 use "ali_mini" 42 5 %) /*presets*/ … … 246 209 extended %% (% 247 210 name :7000 "ECOLI" 248 errors %i 0249 211 acc "J01695" 250 212 full_name "Escherichia coli" … … 257 219 %) /*extended_data*/ 258 220 259 tree_data :7000 %% (%260 tree_ph_24306 %% (%261 tree "N0.03618,0.03618;N0.04082,0.06452;N0.0404,0.28364;N0.0473,0.2638;N0.06826,0.13072;N0.09494,0.11285;LHllHalod\ALLgtLytic\ALPslFlave\AN0.04416,0.07602;N0.02484,0.01242;LVbhChole\ALVblVulni\ALVbrFurni\AN0.13971,0.16265;N0.02,0.35135;N0.07947,0.09524;LClnCorin\ALCPPParap\ALCltBotul\ALClfPerfr\AN0.28846,0.2;N0.06844,0.10559;N0.06211,0.58369;N0.09357,0.06548;LAclPleur\ALPtVVVulg\ALPsAAAA00\ALDcdNodos\ALFrhhPhil\AN0.19802,0.06369;N0.04192,0.02516;LBcSSSS00\ALBl0LLL00\AN0.04516,0.04487;N0.03974,0.04516;N0.09717,0.10759;N0.10726,0.77778;LDlcTolu2\ALDsssDesu\ALStsssola\ALPbcAcet2\ALPbrPropi\A"262 nnodes %i 21263 remark "PRG=neighbor CORR=F84 FILTER=none PKG=phylip\n\nSun Aug 22 21:38:37 2010: Loaded from outtree\n\nTree loaded from 'outtree' on Sun Aug 22 21:38:37 2010\nSun Aug 22 22:01:06 2010: tree_ph_24306 saved to /home/ralf/data/db/ph_24306.tree\nSun Aug 22 22:02:33 2010: Loaded from /home/ralf/data/db/ph_24306.tree\n"264 security %i 0265 ruler %% (%266 size %f 0.1267 LIST %% (%268 ruler_y %f 0269 ruler_x %f 0270 text_x %f 0271 text_y %f 0272 %) /*LIST*/273 274 ruler_width %i 0275 %) /*ruler*/276 277 %) /*tree_ph_24306*/278 279 %) /*tree_data*/280 281 focus %% (%282 tree_name "tree_ph_24306"283 %) /*focus*/284 285 description "db for unit-test pt-server"286 checks %% (%287 check "fix gene_data"288 check "fix_dict_compress"289 check "del_mark_move_REF"290 check "duplicated_item_colors"291 %) /*checks*/292 293 tmp %% (%294 message %% (%295 pending %% (%296 %) /*pending*/297 298 %) /*message*/299 300 %) /*tmp*/301 -
trunk/UNIT_TESTER/test_unit.h
r8040 r8041 593 593 }; 594 594 595 #define TEST_COPY_FILE(src, dst) TEST_ASSERT(system(GBS_global_string("cp '%s' '%s'", src, dst)) == 0) 596 595 597 #define TEST_ASSERT_TEXTFILE_DIFFLINES(f1,f2,diff) TEST_ASSERT(arb_test::test_textfile_difflines(f1,f2, diff)) 596 598 #define TEST_ASSERT_TEXTFILE_DIFFLINES__BROKEN(f1,f2,diff) TEST_ASSERT__BROKEN(arb_test::test_textfile_difflines(f1,f2, diff)) … … 625 627 // -------------------------------------------------------------------------------- 626 628 627 #define TEST_SETUP_GLOBAL_ENVIRONMENT(modulename) TEST_ASSERT_NO_ERROR(GB_system( "../test_environment setup " modulename))629 #define TEST_SETUP_GLOBAL_ENVIRONMENT(modulename) TEST_ASSERT_NO_ERROR(GB_system(GBS_global_string("../test_environment setup %s", (modulename)))) 628 630 // cleanup is done (by Makefile.suite) after all unit tests have been run 629 631 -
trunk/lib/arb_tcp_org.dat
r6708 r8041 32 32 33 33 ARB_TEST_PT_SERVER localhost:3200 arb_pt_server -D$(ARBHOME)/UNIT_TESTER/run/TEST_pt.arb 34 34 ARB_TEST_PT_SERVER_GENE localhost:3201 arb_pt_server -D$(ARBHOME)/UNIT_TESTER/run/TEST_gpt.arb 35 35 36 36 #*********** Private Servers (for each user) ****************** -
trunk/util/arb_srclst.pl
r7997 r8041 168 168 qr/\/UNIT_TESTER\/run\/.*\.tree$/o, 169 169 qr/\/UNIT_TESTER\/run\/impexp\/.*\.exported$/o, 170 qr/\/UNIT_TESTER\/run\/TEST_.*\.pt$/o, # has to move to skipped_when_matchesFull (when merging test env)171 170 qr/\/UNIT_TESTER\/valgrind\/arb_valgrind_logged$/o, 172 171 qr/^\.\/etc\//o, … … 211 210 qr/^\.\/SOURCE_TOOLS\/valgrind2grep\.lst$/o, 212 211 qr/^\.\/TEMPLATES\/arb_build\.h$/o, 212 qr/^\.\/UNIT_TESTER\/run\/TEST_g?pt\.arb$/o, 213 qr/^\.\/UNIT_TESTER\/run\/.*\.ARM$/o, 214 qr/^\.\/UNIT_TESTER\/run\/.*\.ARF$/o, 213 215 qr/date\.xsl$/o, 214 216 );
