File: ps_merge_my_dbs.cxx

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (62 lines) | stat: -rw-r--r-- 2,119 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// =============================================================== //
//                                                                 //
//   File      : ps_merge_my_dbs.cxx                               //
//   Purpose   :                                                   //
//                                                                 //
//   Coded by Wolfram Foerster in October 2002                     //
//   Institute of Microbiology (Technical University Munich)       //
//   http://www.arb-home.de/                                       //
//                                                                 //
// =============================================================== //

#include "ps_tools.hxx"
#include "ps_database.hxx"

#include <sys/times.h>

//  ====================================================

int main(int argc,   char *argv[]) {

    if (argc < 3) {
        printf("Missing arguments\n Usage %s <output database name> <input database name> <input database name2> [[input3]...]\n", argv[0]);
        exit(1);
    }

    //
    // init database object
    //
    const char *input_DB_name = argv[2];
    struct tms before;
    times(&before);
    printf("Opening 1st input-probe-set-database '%s'..\n", input_DB_name);
    PS_Database *db = new PS_Database(input_DB_name, PS_Database::READONLY);
    db->load();
    PS_print_time_diff(&before, "(enter to continue)  ");

    //
    // merge in other databasefiles
    //
    for (int i = 3; i < argc; ++i) {
        input_DB_name = argv[i];
        printf("Appending input-probe-set-database '%s'..\n", input_DB_name);
        times(&before);
        db->merge(input_DB_name);
        PS_print_time_diff(&before);
    }
    printf("Merged databases (enter to continue)\n");

    //
    // write one big whole tree to file
    //
    const char *output_DB_name = argv[1];
    times(&before);
    printf("Writing output-probe-set-database '%s'..\n", output_DB_name);
    db->saveTo(output_DB_name);
    PS_print_time_diff(&before, "(enter to continue)  ");

    printf("cleaning up...\n");
    if (db) delete db;

    return 0;
}