Skip to contents

A clonal partition is a partition of genotypes where a pair of genotypes of the same partition cell have a clonal relationship. Genotypes from the same infection cannot be clones. This code enumerates all clonal partitions, accounting for this intra-infection restriction; see vignette("enumerate") for more details.

Usage

enumerate_CPs(MOIs)

Arguments

MOIs

A numeric vector specifying, for each infection, the number of distinct parasite genotypes, a.k.a. the multiplicity of infection (MOI).

Value

A list of all possible partitions, where each partition is encoded as a membership vector, which indices (genotype names) with the same entry corresponding to genotypes being int he same partition cell.

Examples

enumerate_CPs(c(2, 2))
#> [[1]]
#> [1] 1 2 1 2
#> 
#> [[2]]
#> [1] 1 2 1 3
#> 
#> [[3]]
#> [1] 1 2 2 1
#> 
#> [[4]]
#> [1] 1 2 2 3
#> 
#> [[5]]
#> [1] 1 2 3 1
#> 
#> [[6]]
#> [1] 1 2 3 2
#> 
#> [[7]]
#> [1] 1 2 3 4
#>