phylopomp
Phylodynamics for POMPs
|
Encodes a genealogy. More...
#include <genealogy.h>
Public Member Functions | |
size_t | ndeme (void) const |
number of demes More... | |
size_t & | ndeme (void) |
number of demes More... | |
size_t | bytesize (void) const |
size of serialized binary form More... | |
genealogy_t (double t0=0, name_t u=0, size_t nd=1) | |
genealogy_t (raw_t *o) | |
constructor from serialized binary form More... | |
genealogy_t (SEXP o) | |
constructor from RAW SEXP (containing binary serialization) More... | |
genealogy_t (const genealogy_t &G) | |
copy constructor More... | |
genealogy_t & | operator= (const genealogy_t &G) |
copy assignment operator More... | |
genealogy_t (genealogy_t &&)=default | |
move constructor More... | |
genealogy_t & | operator= (genealogy_t &&)=default |
move assignment operator More... | |
~genealogy_t (void) | |
destructor More... | |
slate_t & | time (void) |
view/set current time. More... | |
slate_t | time (void) const |
view current time. More... | |
slate_t | timezero (void) const |
get zero time. More... | |
void | lineage_count (double *tout, int *deme, int *ell, int *sat, int *etype) const |
SEXP | lineage_count (void) const |
lineage count and saturation More... | |
void | gendat (double *tout, int *anc, int *lin, int *sat, int *type, int *index, int *child) const |
nodelist in data-frame format More... | |
SEXP | gendat (void) const |
nodelist in data-frame format More... | |
size_t | nsample (void) const |
number of samples More... | |
SEXP | structure (void) const |
R list description. More... | |
std::string | describe (void) const |
human-readable info More... | |
virtual std::string | yaml (std::string tab="") const |
machine-readable info More... | |
std::string | newick (void) const |
put genealogy at current time into Newick format. More... | |
void | valid (void) const |
check the validity of the genealogy. More... | |
bool | check_genealogy_size (size_t grace=0) const |
check the size of the genealogy (to prevent memory exhaustion). More... | |
node_t * | make_node (name_t d) |
ball_t * | birth (ball_t *a, slate_t t, name_t d) |
birth into deme d More... | |
ball_t * | birth (node_t *p, name_t d) |
birth of second or subsequent sibling into deme d More... | |
void | death (ball_t *a, slate_t t) |
death More... | |
ball_t * | graft (slate_t t, name_t d) |
graft a new lineage into deme d More... | |
void | sample (ball_t *a, slate_t t) |
insert a sample node More... | |
void | sample_death (ball_t *a, slate_t t) |
insert a sample node and simultaneously terminate the lineage More... | |
ball_t * | migrate (ball_t *a, slate_t t, name_t d=0) |
movement into deme d More... | |
std::pair< node_it, node_it > | extant (void) const |
genealogy_t & | prune (void) |
prune the tree (drop all black balls) More... | |
genealogy_t & | obscure (void) |
erase all deme information More... | |
void | curtail (slate_t tnew) |
genealogy_t & | operator+= (genealogy_t &G) |
genealogy_t & | parse (const std::string &s, slate_t t0, node_t *p=0) |
Parse a Newick string and create the indicated genealogy. More... | |
Public Member Functions inherited from nodeseq_t | |
~nodeseq_t (void) | |
destructor More... | |
size_t | bytesize (void) const |
size of serialized binary form More... | |
nodeseq_t & | operator+= (nodeseq_t &other) |
merge two node sequences More... | |
void | sort (void) |
order nodes in order of increasing time More... | |
pocket_t * | colored (color_t col) const |
Get all balls of a color. More... | |
size_t | ntime (slate_t t) const |
Number of distinct timepoints. More... | |
size_t | length (void) const |
Number of nodes in the sequence. More... | |
node_t * | position (int n) |
traverse to nth node, retrieve pointer More... | |
void | swap (ball_t *a, ball_t *b) |
swap balls a and b, wherever they lie More... | |
void | add (node_t *p, ball_t *a) |
void | drop (ball_t *a) |
void | destroy_node (node_t *p) |
remove a dead root node More... | |
void | comb (void) |
void | trace_lineages (void) |
std::string | describe (void) const |
human-readable info More... | |
SEXP | structure (void) const |
R list description. More... | |
std::string | newick (slate_t t) const |
put genealogy at time t into Newick format. More... | |
Private Member Functions | |
name_t | unique (void) |
get the next unique name More... | |
void | clean (void) |
clean up More... | |
size_t | scan_color (const std::string &s, color_t *col) const |
size_t | scan_label (const std::string &s, color_t *col, name_t *deme, slate_t *time) const |
size_t | scan_ball (const std::string &s, const slate_t t0, node_t *p) |
size_t | scan_node (const std::string &s, const slate_t t0, node_t **q) |
Scan the Newick string and create the indicated node. More... | |
size_t | scan_tree (const std::string &s, const slate_t t0, node_t **root) |
Private Attributes | |
name_t | _unique |
The next unique name. More... | |
slate_t | _t0 |
The initial time. More... | |
slate_t | _time |
The current time. More... | |
size_t | _ndeme |
The number of demes. More... | |
Static Private Attributes | |
static const name_t | magic = 1123581321 |
Friends | |
raw_t * | operator>> (const genealogy_t &G, raw_t *o) |
binary serialization More... | |
raw_t * | operator>> (raw_t *o, genealogy_t &G) |
binary deserialization More... | |
Encodes a genealogy.
A genealogy consists of a sequence of nodes and the current time.
Definition at line 22 of file genealogy.h.
|
inline |
basic constructor for genealogy class t0 = initial time
Definition at line 105 of file genealogy.h.
|
inline |
constructor from serialized binary form
Definition at line 112 of file genealogy.h.
|
inline |
constructor from RAW SEXP (containing binary serialization)
Definition at line 116 of file genealogy.h.
|
inline |
copy constructor
Definition at line 125 of file genealogy.h.
|
default |
move constructor
|
inline |
birth into deme d
Definition at line 401 of file genealogy.h.
birth of second or subsequent sibling into deme d
Definition at line 411 of file genealogy.h.
|
inline |
size of serialized binary form
Definition at line 73 of file genealogy.h.
|
inline |
check the size of the genealogy (to prevent memory exhaustion).
Definition at line 373 of file genealogy.h.
|
inlineprivate |
|
inline |
curtail the genealogy by removing nodes with times later than tnew
Definition at line 496 of file genealogy.h.
death
Definition at line 417 of file genealogy.h.
|
inline |
human-readable info
Definition at line 342 of file genealogy.h.
set up for extraction of black balls (see 'inventory.h')
Definition at line 461 of file genealogy.h.
|
inline |
nodelist in data-frame format
Definition at line 231 of file genealogy.h.
|
inline |
nodelist in data-frame format
Definition at line 277 of file genealogy.h.
graft a new lineage into deme d
Definition at line 422 of file genealogy.h.
|
inline |
lineage count, saturation, and event-type. types are:
Definition at line 171 of file genealogy.h.
|
inline |
lineage count and saturation
Definition at line 207 of file genealogy.h.
create a node holding its own green ball. insert into the genealogy.
Definition at line 388 of file genealogy.h.
|
inline |
|
inline |
number of demes
Definition at line 61 of file genealogy.h.
|
inline |
put genealogy at current time into Newick format.
Definition at line 364 of file genealogy.h.
|
inline |
|
inline |
erase all deme information
Definition at line 476 of file genealogy.h.
|
inline |
merge two genealogies:
Definition at line 534 of file genealogy.h.
|
inline |
|
default |
move assignment operator
|
inline |
Parse a Newick string and create the indicated genealogy.
Definition at line 694 of file genealogy.h.
|
inline |
prune the tree (drop all black balls)
Definition at line 465 of file genealogy.h.
insert a sample node
Definition at line 432 of file genealogy.h.
insert a sample node and simultaneously terminate the lineage
Definition at line 441 of file genealogy.h.
Scan the Newick string and put the ball into the indicated pocket, as appropriate.
Definition at line 623 of file genealogy.h.
|
inlineprivate |
Definition at line 545 of file genealogy.h.
|
inlineprivate |
Scan the Newick-format label string. This has format c_d_d:f
Definition at line 550 of file genealogy.h.
|
inlineprivate |
Scan the Newick string and create the indicated node.
Definition at line 639 of file genealogy.h.
|
inlineprivate |
Parse a single-root Newick tree. This assumes the string starts with a '('.
Definition at line 663 of file genealogy.h.
|
inline |
R list description.
Definition at line 322 of file genealogy.h.
|
inline |
view/set current time.
Definition at line 150 of file genealogy.h.
|
inline |
|
inline |
get zero time.
Definition at line 158 of file genealogy.h.
|
inlineprivate |
get the next unique name
Definition at line 46 of file genealogy.h.
|
inline |
|
inlinevirtual |
machine-readable info
Reimplemented from nodeseq_t.
Definition at line 352 of file genealogy.h.
|
friend |
|
friend |
|
private |
The number of demes.
Definition at line 39 of file genealogy.h.
|
private |
The initial time.
Definition at line 35 of file genealogy.h.
|
private |
The current time.
Definition at line 37 of file genealogy.h.
|
private |
The next unique name.
Definition at line 33 of file genealogy.h.
|
staticprivate |
Definition at line 41 of file genealogy.h.