inc/phyloTree.h

Go to the documentation of this file.
00001 /* phlyogenetic trees */
00002 
00003 
00004 #ifndef PHYLOTREE_H
00005 #define PHYLOTREE_H
00006 
00007 #include "linefile.h"
00008 
00009 struct phyloName
00010 {
00011     char *name;         /* name of this node */
00012     double length;      /* length of the branch to this node */
00013 };
00014 
00015 struct phyloTree
00016 {
00017     struct phyloTree *next;             /* next in single linked list */
00018     struct phyloTree *parent;           /* the parent of this node */
00019     struct phyloTree **edges;
00020     struct phyloName *ident;            /* the name and branch length */
00021     struct phyloTree *mark;             /* probably the favorite child */
00022     bool isDup;                         /* is this a duplication node */
00023     int numEdges;
00024     int allocedEdges;
00025 
00026     void *priv;
00027 };
00028 
00029 extern struct phyloTree *phyloOpenTree(char *fileName);
00030 /* opens an NH tree file */
00031 
00032 extern struct phyloTree *phyloReadTree(struct lineFile *lf);
00033 /* reads a phyloTree from lineFile (first line only) */
00034 
00035 extern struct phyloTree *phyloParseString(char *string);
00036 /* build a phyloTree from a string */
00037 
00038 extern void phyloPrintTree( struct phyloTree *,FILE *f);
00039 /* print a phyloTree to f in Newick format */
00040 
00041 extern void phyloDebugTree( struct phyloTree *,FILE *f);
00042 /* print a phyloTree to f */
00043 
00044 extern char *phyloFindPath(struct phyloTree *tree, char *ref, char *cross);
00045 /* find the shortest path from ref to cross (returns a list
00046  * of the node names separated by spaces */
00047 
00048 extern char *phyloNodeNames(struct phyloTree *tree);
00049 /* return list of all the node names separated by spaces */
00050 
00051 extern struct phyloTree *phyloFindName( struct phyloTree *tree,char *name );
00052 /* find the node with this name */
00053 
00054 extern struct phyloTree *phyloReRoot(struct phyloTree *inTree);
00055 /* return a tree whose root is inTree and what were parents are now "right" children */
00056 
00057 extern void phyloDeleteEdge(struct phyloTree *tree, struct phyloTree *edge);
00058 /* delete an edge from a node.  Aborts on error */
00059 
00060 extern struct phyloTree *phyloAddEdge(struct phyloTree *parent, struct phyloTree *child);
00061 /* add an edge to a phyloTree node */
00062 
00063 extern void phyloClearTreeMarks(struct phyloTree *tree);
00064 /* clear the favorite child marks */
00065 
00066 extern struct phyloTree *phyloFindMarkUpTree(struct phyloTree *tree);
00067 /* find a marked node somewhere above this node */
00068 
00069 extern void phyloMarkUpTree(struct phyloTree *tree);
00070 /* mark all the nodes from this one up to the top of the tree */
00071 
00072 extern void phyloPrintTreeNoDups( struct phyloTree *tree,FILE *f);
00073 /* print out phylogenetic tree in Newick format (only speciation nodes) */
00074 
00075 extern int phyloCountLeaves( struct phyloTree *tree);
00076 
00077 #endif

Generated on Tue Dec 25 18:39:29 2007 for blat by  doxygen 1.5.2