source: branches/profile/SL/TREE_WRITE/TreeWrite.h

Last change on this file was 10482, checked in by westram, 11 years ago
  • Tree IO (patch reintegrates branch 'tree')
    • added unit test (TreeReader, export/import consistency for most export-parameters combinations)
    • refactorings: moved more behavior into TreeReader; deny access to class internals
    • improved error messages/warnings
      • show error-position in input data when bailing out
      • warn about unused data behind tree
      • trees < 2 species produce error now
    • behavior
      • fixed export/import of bootstrap values (expect ':' as separator; avoiding misinterpretation of group names starting with digits)
      • auto-name unnamed nodes
      • supports bootstrap values specified as percent (e.g. '12.5%')
      • no longer interpret '' as escape sequence for a single '
      • no longer remove leading '_' from leaf-/groupnames (no idea why this was done)
    • fixes:
      • export+import of tree using double quotes often resulted in leaf-/groupnames enclosed in double-quotes (or more often failed to load completely)
      • name of root-node was lost after import.
      • better support for single-node subtrees, e.g. '(leafname)'. Nodes were skipped.
      • deadlock occurring when tree file was truncated somewhere in the middle.
      • leaks stuffed
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1// ============================================================ //
2//                                                              //
3//   File      : TreeWrite.h                                    //
4//   Purpose   :                                                //
5//                                                              //
6//   Institute of Microbiology (Technical University Munich)    //
7//   www.arb-home.de                                            //
8//                                                              //
9// ============================================================ //
10
11#ifndef TREEWRITE_H
12#define TREEWRITE_H
13
14#ifndef ARBDB_BASE_H
15#include <arbdb_base.h>
16#endif
17#ifndef NDS_H
18#include <nds.h>
19#endif
20
21typedef void        (*TREE_make_node_text_init)(GBDATA *gb_main);
22typedef const char *(*TREE_make_node_text)     (GBDATA *gb_main, GBDATA * gbd, enum NDS_Type mode, GBT_TREE *species, const char *tree_name);
23
24struct TREE_node_text_gen {
25    TREE_make_node_text_init init;                  // e.g. make_node_text_init() from AWT
26    TREE_make_node_text      gen;                   // e.g. make_node_text_nds() from AWT
27
28    TREE_node_text_gen(TREE_make_node_text_init init_, TREE_make_node_text gen_)
29        : init(init_)
30        , gen(gen_)
31    {}
32};
33
34enum TREE_node_quoting {
35    TREE_DISALLOW_QUOTES = 0, // don't use quotes
36    TREE_SINGLE_QUOTES   = 1, // use single quotes
37    TREE_DOUBLE_QUOTES   = 2, // use double quotes
38
39    TREE_FORCE_QUOTES  = 4, // force usage of quotes
40    TREE_FORCE_REPLACE = 8, // replace all problematic characters (default is to replace quotes in quoted labels)
41};
42
43GB_ERROR TREE_write_Newick(GBDATA *gb_main, const char *tree_name, const TREE_node_text_gen *node_gen, bool save_branchlengths, bool save_bootstraps, bool save_groupnames, bool pretty, TREE_node_quoting quoteMode, const char *path);
44GB_ERROR TREE_write_XML(GBDATA *gb_main, const char *db_name, const char *tree_name, const TREE_node_text_gen *node_gen, bool skip_folded, const char *path);
45GB_ERROR TREE_export_tree(GBDATA *gb_main, FILE *out, GBT_TREE *tree, bool triple_root, bool export_branchlens, bool use_double_quotes);
46
47#else
48#error TreeWrite.h included twice
49#endif // TREEWRITE_H
Note: See TracBrowser for help on using the repository browser.