An RG is a graph over all per-person parasite genotypes (each as a vertex), with edges between clone and sibling genotypes. Valid RGs satisfy:
Subgraphs induced by clone edges are cluster graphs.
Subgraphs induced by clone plus sibling edges are cluster graphs.
Clone edges only link genotypes from different episodes.
enumerate_RGs(MOIs, igraph = TRUE, progress.bar = TRUE)A list of RGs. If igraph = FALSE,
each RG is a list of length four with:
List of vectors encoding genotypes per clonal cell.
Numeric vector with the clonal cell membership of each genotype.
List of vectors encoding clonal cells per sibling cell.
Numeric vector with the sibling cell membership of each clonal cell.
If igraph = TRUE (default), each RG is encoded as an igraph object
(see RG_to_igraph).
Vector of per-episode multiplicities of infection (MOIs), i.e., numbers of per-episode genotypes / vertices.
Logical; returns RGs as igraph objects (default TRUE).
Logical; show progress bar (default TRUE).
RGs are generated by enumerating nested set partitions under specific
constraints; see
Understand graph and partition enumeration.
Each nested set parition is an RG. Clone edges induce a cluster graph,
equivalent to a partition of genotypes, with no intra-episode clones allowed.
Sibling edges refine the clone partition, with no constraints (intra-episode
siblings allowed). Each nested set partition is encoded as a list. Each
partition is represented by a list of vectors (either clone or sib) and
by a membership vector (either clone.vec or sib.vec). By default, an RG
encoded as a list is converted to an igraph object.
graphs <- enumerate_RGs(c(2, 1, 2), progress.bar = FALSE) # nine graphs
Run the code above in your browser using DataLab