|
phylopomp
Phylodynamics for POMPs
|
Encodes a genealogy. More...
#include <genealogy.h>


Public Member Functions | |
| size_t | ndeme (void) const |
| number of demes | |
| size_t & | ndeme (void) |
| number of demes | |
| size_t | bytesize (void) const |
| size of serialized binary form | |
| genealogy_t (double t0=R_NaReal, size_t ndeme=0) | |
| genealogy_t (raw_t *o) | |
| constructor from serialized binary form | |
| genealogy_t (SEXP o) | |
| constructor from RAW SEXP (containing binary serialization) | |
| genealogy_t (const genealogy_t &G) | |
| copy constructor | |
| genealogy_t & | operator= (const genealogy_t &G) |
| copy assignment operator | |
| genealogy_t (genealogy_t &&)=default | |
| move constructor | |
| genealogy_t & | operator= (genealogy_t &&)=default |
| move assignment operator | |
| ~genealogy_t (void) | |
| destructor | |
| slate_t & | time (void) |
| view/set current time. | |
| slate_t | time (void) const |
| view current time. | |
| slate_t & | timezero (void) |
| view/set zero time. | |
| slate_t | timezero (void) const |
| get zero time. | |
| void | lineage_count (double *tout, int *deme, int *ell, int *sat, int *etype) const |
| SEXP | lineage_count (void) const |
| lineage count and saturation | |
| void | gendat (double *tout, int *anc, int *lin, int *sat, int *type, int *deme, int *index, int *child) const |
| genealogy information in list format | |
| SEXP | gendat (void) const |
| genealogy information in list format | |
| size_t | nsample (void) const |
| number of samples | |
| size_t | nroot (void) const |
| number of roots | |
| string_t | yaml (string_t tab="") const |
| human/machine-readable info | |
| SEXP | structure (void) const |
| R list description. | |
| string_t | newick (bool extended=true) const |
| put genealogy at current time into Newick format. | |
| void | valid (void) const |
| check the validity of the genealogy. | |
| bool | check_genealogy_size (size_t grace=0) const |
| check the size of the genealogy (to prevent memory exhaustion). | |
| ball_t * | birth (ball_t *a, slate_t t, name_t d) |
| birth into deme d | |
| ball_t * | birth (node_t *p, name_t d) |
| birth of second or subsequent sibling into deme d | |
| void | death (ball_t *a, slate_t t) |
| death | |
| ball_t * | graft (slate_t t, name_t d) |
| graft a new lineage into deme d | |
| void | sample (ball_t *a, slate_t t) |
| insert a sample node | |
| void | sample_death (ball_t *a, slate_t t) |
| insert a sample node and simultaneously terminate the lineage | |
| void | migrate (ball_t *a, slate_t t, name_t d=0) |
| movement into deme d | |
| void | sample_migrate (ball_t *a, slate_t t, name_t d=0) |
| insert a sample node and simultaneously migrate the lineage | |
| genealogy_t & | prune (void) |
| prune the tree (drop all black balls) | |
| genealogy_t & | obscure (void) |
| erase all deme information | |
| void | curtail (slate_t tnew, slate_t troot) |
| genealogy_t & | operator+= (const genealogy_t &other) |
| merges two genealogies, adjusting time, t0, and ndeme as needed | |
| void | insert_zlb (void) |
| insert zero-length branches for samples where needed | |
| void | drop_zlb (void) |
| drop all zero-length branches | |
| genealogy_t & | parse (const string_t &s) |
| Parse a Newick string and create the indicated genealogy. | |
Public Member Functions inherited from nodeseq_t | |
| ~nodeseq_t (void) | |
| destructor | |
| size_t | bytesize (void) const |
| size of serialized binary form | |
| void | sort (void) |
| order nodes in order of increasing time | |
| pocket_t * | colored (color_t col) const |
| Get all balls of a color. | |
| size_t | ntime (slate_t t) const |
| Number of distinct timepoints. | |
| size_t | length (void) const |
| Number of nodes in the sequence. | |
| node_t * | position (int n) |
| traverse to nth node, retrieve pointer | |
| void | move (ball_t *b, node_t *p, node_t *q) |
| move ball b from p to q | |
| void | swap (ball_t *a, ball_t *b) |
| swap balls a and b, wherever they lie | |
| void | attach (node_t *p, node_t *q) |
| void | detach (node_t *p) |
| void | add (node_t *p, ball_t *a) |
| void | drop (ball_t *a) |
| void | destroy_node (node_t *p) |
| remove a dead root node | |
| void | weed (void) |
| drop all dead roots | |
| void | comb (void) |
| void | trace_lineages (void) |
| string_t | yaml (string_t tab="") const |
| human/machine-readable info | |
| SEXP | structure (void) const |
| R list description. | |
| string_t | newick (slate_t t, bool showdeme, bool extended) const |
put genealogy at time t into Newick format. | |
Private Member Functions | |
| name_t | unique (void) |
| get the next unique name | |
| void | clean (void) |
| clean up | |
| node_t * | make_node (name_t d=undeme) |
| void | reuniqify (name_t shift) |
| shifts names to avoid overlap | |
| void | repair_tips (void) |
| void | repair_roots (void) |
| roots are added at zero time if needed | |
| node_t * | scan_branch (string_t::const_iterator b, string_t::const_iterator e) |
Private Attributes | |
| name_t | _unique |
| The next unique name. | |
| slate_t | _t0 |
| The initial time. | |
| slate_t | _time |
| The current time. | |
| size_t | _ndeme |
| The number of demes (excluding the undeme). | |
Static Private Attributes | |
| static const name_t | magic = 1123581321 |
Friends | |
| raw_t * | operator>> (const genealogy_t &G, raw_t *o) |
| binary serialization | |
| raw_t * | operator>> (raw_t *o, genealogy_t &G) |
| binary deserialization | |
Additional Inherited Members | |
Static Public Member Functions inherited from nodeseq_t | |
| static bool | compare (node_t *p, node_t *q) |
Encodes a genealogy.
A genealogy consists of a sequence of nodes and the current time.
Definition at line 19 of file genealogy.h.
|
inline |
basic constructor for genealogy class
Definition at line 102 of file genealogy.h.


|
inline |
constructor from serialized binary form
Definition at line 108 of file genealogy.h.
|
inline |
constructor from RAW SEXP (containing binary serialization)
Definition at line 112 of file genealogy.h.
|
inline |
copy constructor
Definition at line 120 of file genealogy.h.

|
default |
move constructor

|
inline |
birth into deme d
Definition at line 242 of file genealogy.h.

birth of second or subsequent sibling into deme d
Definition at line 252 of file genealogy.h.

|
inline |
size of serialized binary form
Definition at line 71 of file genealogy.h.


|
inline |
check the size of the genealogy (to prevent memory exhaustion).
Definition at line 214 of file genealogy.h.

|
inlineprivate |
clean up
Definition at line 50 of file genealogy.h.

curtail the genealogy by removing nodes with times later than tnew and/or earlier than troot
Definition at line 10 of file curtail.cc.


death
Definition at line 258 of file genealogy.h.

|
inline |
drop all zero-length branches
Definition at line 373 of file genealogy.h.


| void genealogy_t::gendat | ( | double * | tout, |
| int * | anc, | ||
| int * | lin, | ||
| int * | sat, | ||
| int * | type, | ||
| int * | deme, | ||
| int * | index, | ||
| int * | child ) const |
genealogy information in list format
Definition at line 8 of file gendat.cc.


| SEXP genealogy_t::gendat | ( | void | ) | const |
genealogy information in list format
Definition at line 59 of file gendat.cc.


graft a new lineage into deme d
Definition at line 263 of file genealogy.h.

|
inline |
insert zero-length branches for samples where needed
Definition at line 358 of file genealogy.h.


| void genealogy_t::lineage_count | ( | double * | tout, |
| int * | deme, | ||
| int * | ell, | ||
| int * | sat, | ||
| int * | etype ) const |
lineage count, saturation, and event-type. types are:
Definition at line 39 of file lineages.cc.

| SEXP genealogy_t::lineage_count | ( | void | ) | const |
lineage count and saturation
Definition at line 79 of file lineages.cc.


create a node holding its own green ball. this does not insert into the genealogy.
Definition at line 229 of file genealogy.h.


|
inline |
|
inline |
number of demes
Definition at line 59 of file genealogy.h.

| string_t genealogy_t::newick | ( | bool | extended = true | ) | const |
put genealogy at current time into Newick format.
Definition at line 93 of file newick.cc.


|
inline |
|
inline |
|
inline |
erase all deme information
Definition at line 321 of file genealogy.h.


| genealogy_t & genealogy_t::operator+= | ( | const genealogy_t & | other | ) |
merges two genealogies, adjusting time, t0, and ndeme as needed
merge two genealogies:
Definition at line 29 of file sum.cc.

|
inline |
|
default |
move assignment operator

| genealogy_t & genealogy_t::parse | ( | const string_t & | s | ) |
Parse a Newick string and create the indicated genealogy.
Definition at line 130 of file parse.cc.


|
inline |
prune the tree (drop all black balls)
Definition at line 310 of file genealogy.h.


|
inlineprivate |
|
private |
|
private |
|
private |
Scan the branch (label+branch-length) string. This has format [&&PhyloPOMP deme=d type=s]s:f
Scan the branch string. This has format s[&&PhyloPOMP deme=d type=s]s:f
Definition at line 100 of file parse.cc.


| SEXP genealogy_t::structure | ( | void | ) | const |
R list description.
Definition at line 84 of file structure.cc.

|
inline |
view/set current time.
Definition at line 145 of file genealogy.h.

|
inline |
|
inline |
view/set zero time.
Definition at line 153 of file genealogy.h.

|
inline |
|
inlineprivate |
get the next unique name
Definition at line 43 of file genealogy.h.

|
inline |
| string_t genealogy_t::yaml | ( | string_t | tab = "" | ) | const |
|
friend |
binary serialization
Definition at line 76 of file genealogy.h.
|
friend |
binary deserialization
Definition at line 84 of file genealogy.h.
|
private |
The number of demes (excluding the undeme).
Definition at line 36 of file genealogy.h.
|
private |
The initial time.
Definition at line 32 of file genealogy.h.
|
private |
The current time.
Definition at line 34 of file genealogy.h.
|
private |
The next unique name.
Definition at line 30 of file genealogy.h.
|
staticprivate |
Definition at line 38 of file genealogy.h.