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=0, name_t u=0, size_t nd=1) | |
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 *index, int *child) const |
nodelist in data-frame format | |
SEXP | gendat (void) const |
nodelist in data-frame format | |
size_t | nsample (void) const |
number of samples | |
SEXP | structure (void) const |
R list description. | |
std::string | describe (void) const |
human-readable info | |
virtual std::string | yaml (std::string tab="") const |
machine-readable info | |
std::string | newick (void) 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). | |
node_t * | make_node (name_t d) |
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 | |
ball_t * | migrate (ball_t *a, slate_t t, name_t d=0) |
movement into deme d | |
std::pair< node_it, node_it > | extant (void) const |
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+= (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. | |
![]() | |
~nodeseq_t (void) | |
destructor | |
size_t | bytesize (void) const |
size of serialized binary form | |
nodeseq_t & | operator+= (nodeseq_t &other) |
merge two node sequences | |
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 | swap (ball_t *a, ball_t *b) |
swap balls a and b, wherever they lie | |
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 | comb (void) |
void | trace_lineages (void) |
std::string | describe (void) const |
human-readable info | |
SEXP | structure (void) const |
R list description. | |
std::string | newick (slate_t t) 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 | |
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. | |
size_t | scan_tree (const std::string &s, const slate_t t0, node_t **root) |
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. | |
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 | |
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 404 of file genealogy.h.
birth of second or subsequent sibling into deme d
Definition at line 414 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 376 of file genealogy.h.
|
inlineprivate |
curtail the genealogy by removing nodes with times later than tnew and/or earlier than troot
Definition at line 499 of file genealogy.h.
death
Definition at line 420 of file genealogy.h.
|
inline |
human-readable info
Definition at line 345 of file genealogy.h.
set up for extraction of black balls (see 'inventory.h')
Definition at line 464 of file genealogy.h.
|
inline |
nodelist in data-frame format
Definition at line 234 of file genealogy.h.
|
inline |
nodelist in data-frame format
Definition at line 280 of file genealogy.h.
graft a new lineage into deme d
Definition at line 425 of file genealogy.h.
|
inline |
lineage count, saturation, and event-type. types are:
Definition at line 175 of file genealogy.h.
|
inline |
lineage count and saturation
Definition at line 210 of file genealogy.h.
create a node holding its own green ball. insert into the genealogy.
Definition at line 391 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 367 of file genealogy.h.
|
inline |
|
inline |
erase all deme information
Definition at line 479 of file genealogy.h.
|
inline |
merge two genealogies:
Definition at line 577 of file genealogy.h.
|
inline |
|
default |
move assignment operator
|
inline |
Parse a Newick string and create the indicated genealogy.
Definition at line 737 of file genealogy.h.
|
inline |
prune the tree (drop all black balls)
Definition at line 468 of file genealogy.h.
insert a sample node and simultaneously terminate the lineage
Definition at line 444 of file genealogy.h.
Scan the Newick string and put the ball into the indicated pocket, as appropriate.
Definition at line 666 of file genealogy.h.
|
inlineprivate |
Definition at line 588 of file genealogy.h.
|
inlineprivate |
Scan the Newick-format label string. This has format c_d_d:f
Definition at line 593 of file genealogy.h.
|
inlineprivate |
Scan the Newick string and create the indicated node.
Definition at line 682 of file genealogy.h.
|
inlineprivate |
Parse a single-root Newick tree. This assumes the string starts with a '('.
Definition at line 706 of file genealogy.h.
|
inline |
R list description.
Definition at line 325 of file genealogy.h.
|
inline |
view/set current time.
Definition at line 150 of file genealogy.h.
|
inline |
|
inline |
view/set zero time.
Definition at line 158 of file genealogy.h.
|
inline |
|
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 355 of file genealogy.h.
|
friend |
binary serialization
Definition at line 78 of file genealogy.h.
|
friend |
binary deserialization
Definition at line 86 of file genealogy.h.
|
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.