| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : ps_my2ascii.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_node.hxx" |
|---|
| 13 | |
|---|
| 14 | // ==================================================== |
|---|
| 15 | // ==================================================== |
|---|
| 16 | |
|---|
| 17 | int main(int argc, char *argv[]) { |
|---|
| 18 | |
|---|
| 19 | // |
|---|
| 20 | // check arguments |
|---|
| 21 | // |
|---|
| 22 | if (argc < 3) { |
|---|
| 23 | printf("Missing arguments\n Usage %s <input database name> <output database name>\n", argv[0]); |
|---|
| 24 | exit(1); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | // |
|---|
| 28 | // open probe-set-database |
|---|
| 29 | // |
|---|
| 30 | PS_Node *root = new PS_Node(-1); |
|---|
| 31 | const char *input_DB_name = argv[1]; |
|---|
| 32 | PS_FileBuffer *ps_db_fb = new PS_FileBuffer(input_DB_name, PS_FileBuffer::READONLY); |
|---|
| 33 | |
|---|
| 34 | printf("Opening input-probe-set-database '%s'..\n", input_DB_name); |
|---|
| 35 | root->load(ps_db_fb); |
|---|
| 36 | printf("loaded database (enter to continue)\n"); |
|---|
| 37 | |
|---|
| 38 | // |
|---|
| 39 | // write as ASCII |
|---|
| 40 | // |
|---|
| 41 | const char *output_DB_name = argv[2]; |
|---|
| 42 | printf("writing probe-data to %s\n", output_DB_name); |
|---|
| 43 | ps_db_fb->reinit(output_DB_name, PS_FileBuffer::WRITEONLY); |
|---|
| 44 | char *buffer = (char *)malloc(512); |
|---|
| 45 | root->saveASCII(ps_db_fb, buffer); |
|---|
| 46 | printf("(enter to continue)\n"); |
|---|
| 47 | |
|---|
| 48 | // |
|---|
| 49 | // clean up |
|---|
| 50 | // |
|---|
| 51 | free(buffer); |
|---|
| 52 | delete ps_db_fb; |
|---|
| 53 | printf("(enter to continue)\n"); |
|---|
| 54 | |
|---|
| 55 | return 0; |
|---|
| 56 | } |
|---|