1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : ps_merge_my_dbs.cxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Coded by Wolfram Foerster in October 2002 // |
---|
7 | // Institute of Microbiology (Technical University Munich) // |
---|
8 | // http://www.arb-home.de/ // |
---|
9 | // // |
---|
10 | // =============================================================== // |
---|
11 | |
---|
12 | #include "ps_tools.hxx" |
---|
13 | #include "ps_database.hxx" |
---|
14 | |
---|
15 | #include <sys/times.h> |
---|
16 | |
---|
17 | // ==================================================== |
---|
18 | |
---|
19 | int main(int argc, char *argv[]) { |
---|
20 | |
---|
21 | if (argc < 3) { |
---|
22 | printf("Missing arguments\n Usage %s <output database name> <input database name> <input database name2> [[input3]...]\n", argv[0]); |
---|
23 | exit(1); |
---|
24 | } |
---|
25 | |
---|
26 | // |
---|
27 | // init database object |
---|
28 | // |
---|
29 | const char *input_DB_name = argv[2]; |
---|
30 | struct tms before; |
---|
31 | times(&before); |
---|
32 | printf("Opening 1st input-probe-set-database '%s'..\n", input_DB_name); |
---|
33 | PS_Database *db = new PS_Database(input_DB_name, PS_Database::READONLY); |
---|
34 | db->load(); |
---|
35 | PS_print_time_diff(&before, "(enter to continue) "); |
---|
36 | |
---|
37 | // |
---|
38 | // merge in other databasefiles |
---|
39 | // |
---|
40 | for (int i = 3; i < argc; ++i) { |
---|
41 | input_DB_name = argv[i]; |
---|
42 | printf("Appending input-probe-set-database '%s'..\n", input_DB_name); |
---|
43 | times(&before); |
---|
44 | db->merge(input_DB_name); |
---|
45 | PS_print_time_diff(&before); |
---|
46 | } |
---|
47 | printf("Merged databases (enter to continue)\n"); |
---|
48 | |
---|
49 | // |
---|
50 | // write one big whole tree to file |
---|
51 | // |
---|
52 | const char *output_DB_name = argv[1]; |
---|
53 | times(&before); |
---|
54 | printf("Writing output-probe-set-database '%s'..\n", output_DB_name); |
---|
55 | db->saveTo(output_DB_name); |
---|
56 | PS_print_time_diff(&before, "(enter to continue) "); |
---|
57 | |
---|
58 | printf("cleaning up...\n"); |
---|
59 | if (db) delete db; |
---|
60 | |
---|
61 | return 0; |
---|
62 | } |
---|