shiba
 All Data Structures Files Functions Variables Macros Pages
Functions
newick.c File Reference

Parses newick tree strings More...

#include "shiba.h"
Include dependency graph for newick.c:

Go to the source code of this file.

Functions

phylo parseNewick (char *in)
 
void phyloToLineage (phylo p)
 Reconciles the phylogeny edges with the geo time periods
 

Detailed Description

Parses newick tree strings

Definition in file newick.c.

Function Documentation

phylo parseNewick ( char *  in)
Todo:
deal with quoted labels

Definition at line 7 of file newick.c.

References phylo::age, phylo::bl, phylo::depth, error(), mem1d_d(), mem1d_i(), mem2d1_c(), phylo::ndaughter, phylo::nnodes, phylo::parent, Sasprintf, and phylo::taxon.

Referenced by main().

Here is the call graph for this function:

void phyloToLineage ( phylo  p)

Reconciles the phylogeny edges with the geo time periods

For example, imagine three past time periods (A, B, C) and the future (Z), and several phylogeny edges (a-k):

 Z :   a     b   d     e   g     h    j     
 ..:...|.....|...|.....|...|.....|....|..... NOW
   :   |     |   |     |   +--+--+    |
 C :   +--+--+   |     |      |i      |
   :      |c     |     |      +----+--+
 ..:......|......|.....|...........|........
   :      |      +--+--+           |k
 B :      |         |f             |
 ..:......|.........|..............|........
 A :      |         |              | 

These would be encoded with reference to the time periods as:

          a b c    d e f    g h i j k
          -----    -----    ---------
      Z | 1 1 0    1 1 0    1 1 x 1 0
      C | 0 0 1    1 1 0    0 0 x 0 1
      B | 0 0 1    0 0 1    0 0 x 0 1
      A | 0 0 1    0 0 1    0 0 x 0 1

Note that we need to push the branching events `forward,' so that there is only ever one root stem passing through the beginning of the first time period.

Definition at line 199 of file newick.c.

References phylo::age, phylo::bl, error(), Extant, LineageDaughters, LineageDaughtersN, LineageExtant, LineagePeriod, Lineages, mem1d_i(), mem2d1_i(), mem2d_i(), mem3d_i(), phylo::ndaughter, phylo::nnodes, phylo::parent, RealTime, Spaces, Taxa, phylo::taxon, Taxon, and Times.

Referenced by main().

Here is the call graph for this function: