biomcmc-lib  0.1
low level library for phylogenetic analysis
read_newick_trees.h
Go to the documentation of this file.
1 /*
2  * This file is part of biomcmc-lib, a low-level library for phylogenomic analysis.
3  * Copyright (C) 2019-today Leonardo de Oliveira Martins [ leomrtns at gmail.com; http://www.leomartins.org ]
4  *
5  * biomcmc is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
6  * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8 
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
10  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11  * details (file "COPYING" or http://www.gnu.org/copyleft/gpl.html).
12  */
13 
19 #ifndef _biomcmc_read_newick_trees_h
20 #define _biomcmc_read_newick_trees_h
21 
22 #include "topology_distance.h"
23 #include "nexus_common.h"
24 
25 typedef struct newick_node_struct* newick_node;
26 typedef struct newick_tree_struct* newick_tree;
29 {
30  newick_node up, right, left;
31  int id;
32  double branch_length;
33  char *taxlabel;
34 };
35 
37 {
38  newick_node *nodelist;
39  newick_node *leaflist;
40  newick_node root;
41  int nnodes, nleaves;
42 };
43 
45 newick_tree new_newick_tree (int nleaves);
47 void del_newick_tree (newick_tree T);
50 void copy_topology_from_newick_tree (topology tree, newick_tree nwk_tree, bool create_tree_taxlabel);
52 newick_tree new_newick_tree_from_string (char *external_string);
54 newick_node subtree_newick_tree (newick_tree tree, char *lsptr, char *rsptr, int *node_id, newick_node up);
56 int number_of_leaves_in_newick (char **string, int *number_branches);
57 
58 #endif
branch length operations on topologies, including patristic distances
void del_newick_tree(newick_tree T)
Frees memory used by tree.
Definition: read_newick_trees.c:57
int number_of_leaves_in_newick(char **string, int *number_branches)
Counts the number of leaves and resolves (one) trifurcation of tree string.
Definition: read_newick_trees.c:248
int id
Parent and children nodes.
Definition: read_newick_trees.h:31
File handling functions for nexus format in general.
newick_node root
Vector with pointers to tree leaves.
Definition: read_newick_trees.h:40
int nnodes
Pointer to root node.
Definition: read_newick_trees.h:41
double branch_length
Initial pre-order numbering of node.
Definition: read_newick_trees.h:32
newick_tree new_newick_tree_from_string(char *external_string)
Creates newick_tree structure.
Definition: read_newick_trees.c:104
newick_tree new_newick_tree(int nleaves)
Allocates memory for newick_tree_struct.
Definition: read_newick_trees.c:35
newick_node * leaflist
Vector with pointers to every internal node.
Definition: read_newick_trees.h:39
newick_node subtree_newick_tree(newick_tree tree, char *lsptr, char *rsptr, int *node_id, newick_node up)
Recursive function that creates a node based on parenthetic structure.
Definition: read_newick_trees.c:141
newick trees have minimal information, unlike topology_struct
Definition: read_newick_trees.h:28
void copy_topology_from_newick_tree(topology tree, newick_tree nwk_tree, bool create_tree_taxlabel)
Copy information from newick_tree struct to topology_struct; newick_space copies taxlabels but topolo...
Definition: read_newick_trees.c:68
Definition: read_newick_trees.h:36
char * taxlabel
Branch length from node to node->up.
Definition: read_newick_trees.h:33
Binary unrooted topology (rooted at leaf with ID zero)
Definition: topology_common.h:47