| Bsoft 2.0.5 Bernard's software package

Classes | Macros | Functions
rwtree.h File Reference

Header file for reading (and writing) trees. More...

Go to the source code of this file.

## Classes
struct | Bnode

## Macros
#define | _Bnode_

## Functions
Bnode * | read_tree (char *filename)
| Reads a phylip format tree file. More...
Bnode * | tree_read_node (char **handle, Bnode *parent)
| Reads a node into a tree structure. More...
int | tree_calculate_angle (Bnode *node, int *itip, float tip_angle)
| Calculates an angle for each node for plotting. More...
int | tree_delete_node (Bnode *node)
| Deletes a node with all daughter nodes. More...
int | tree_rotate (Bnode *node, float angle)
| Adds an angle to all nodes. More...
int | tree_show (Bnode *node)
| Shows a node with all daughter nodes. More...

## Detailed Description

Header file for reading (and writing) trees.

Author
  Bernard Heymann

Date
  Created: 20010722
  Modified: 20010805

Definition in file rwtree.h.

## Macro Definition Documentation

## ◆ _Bnode_

#define _Bnode_

Definition at line 31 of file rwtree.h.

## Function Documentation

## ◆ read_tree()

Bnode* read_tree | ( | char * | filename | ) |

Reads a phylip format tree file.

    Reads the tree file using a recursive approach.

Parameters

  *filename | tree file name.

Returns
  Bnode* a pointer to the root node of the tree.

Definition at line 23 of file rwtree.cpp.

## ◆ tree_calculate_angle()

int tree_calculate_angle | ( | Bnode * | node,
|  | int * | itip,
|  | float | tip_angle
| ) |  |

Calculates an angle for each node for plotting.

Parameters

  *node | node.
  *itip | the number of tip nodes passed.
  tip_angle | the angular increment for each tip node.

Returns
  int 0.

Definition at line 133 of file rwtree.cpp.

## ◆ tree_delete_node()

int tree_delete_node | ( | Bnode * | node | ) |

Deletes a node with all daughter nodes.

Parameters

  *node | node.

Returns
  int 0.

Definition at line 160 of file rwtree.cpp.

## ◆ tree_read_node()

Bnode* tree_read_node | ( | char ** | handle,
|  | Bnode * | one
| ) |  |

Reads a node into a tree structure.

Parameters

  **handle | pointer to the buffer holding the phylip format tree.
  *one | one node.

Returns
  Bnode* a pointer to the new node of the tree.

Definition at line 75 of file rwtree.cpp.

## ◆ tree_rotate()

int tree_rotate | ( | Bnode * | node,
|  | float | angle
| ) |  |

Adds an angle to all nodes.

    The angle must be specified in radians.

Parameters

  *node | node.
  angle | rotation angle (radians).

Returns
  int 0.

Definition at line 184 of file rwtree.cpp.

## ◆ tree_show()

int tree_show | ( | Bnode * | node | ) |

Shows a node with all daughter nodes.

Parameters

  *node | node.

Returns
  int 0.

Definition at line 204 of file rwtree.cpp.