Skip to contents

Basic usage

This is an R interface of tumopp, a tumor growth simulator in C++. The parameter values and resulting populations are returned in a nested tibble. See ?tumopp for details.

library(tumopp)
result = tumopp("--seed=24601 -D3 -Cmoore -k10 -N1000")
colnames(result)
#>  [1] "alpha0"     "benchmark"  "beta0"      "coord"      "delta0"    
#>  [6] "dimensions" "extinction" "interval"   "local"      "ma"        
#> [11] "max"        "max_time"   "mb"         "md"         "mm"        
#> [16] "mutate"     "origin"     "outdir"     "path"       "plateau"   
#> [21] "prolif"     "record"     "resistant"  "rho0"       "sa"        
#> [26] "sb"         "sd"         "seed"       "shape"      "sm"        
#> [31] "symmetric"  "treatment"  "ua"         "ub"         "ud"        
#> [36] "um"         "verbose"    "population" "graph"
result$population[[1L]] |> dplyr::arrange(id)
#> # A tibble: 1,999 × 8
#>        x     y     z    id ancestor birth death omega
#>    <int> <int> <int> <int>    <int> <dbl> <dbl> <int>
#>  1     0     0     0     1        0  0     1.28    -1
#>  2     0     0     0     2        1  1.28  2.18    -1
#>  3     1     1     0     3        1  1.28  1.89    -1
#>  4     1     1     0     4        3  1.89  3.14    -1
#>  5     1     2     1     5        3  1.89  2.80    -1
#>  6     1     0     1     6        2  2.18  3.20    -1
#>  7    -1     0    -1     7        2  2.18  3.13    -1
#>  8     1     2     1     8        5  2.80  3.80    -1
#>  9     2     3     2     9        5  2.80  3.92    -1
#> 10    -1     0    -1    10        7  3.13  4.82    -1
#> # ℹ 1,989 more rows

Explore parameter space

A parameter grid can be generated with make_args(). See tumopp("--help") or C++ library documentation generated by doxygen for available parameters.

.const = list(D = 3L, C = "hex", N = 1000L)
.alt = list(
  k = c("1", "1e6"),
  L = c("const", "linear", "step"),
  P = c("random", "mindrag")
)

# Generate combinations of arguments
args_table = make_args(alt = .alt, const = .const, each = 1L) |> print()
#> # A tibble: 12 × 6
#>    k     L      P           D C         N
#>    <chr> <chr>  <chr>   <int> <chr> <int>
#>  1 1     const  mindrag     3 hex    1000
#>  2 1     const  random      3 hex    1000
#>  3 1     linear mindrag     3 hex    1000
#>  4 1     linear random      3 hex    1000
#>  5 1     step   mindrag     3 hex    1000
#>  6 1     step   random      3 hex    1000
#>  7 1e6   const  mindrag     3 hex    1000
#>  8 1e6   const  random      3 hex    1000
#>  9 1e6   linear mindrag     3 hex    1000
#> 10 1e6   linear random      3 hex    1000
#> 11 1e6   step   mindrag     3 hex    1000
#> 12 1e6   step   random      3 hex    1000

# Concurrent execution
results = tumopp(args_table)
results |>
  dplyr::select(!c(outdir, seed, where(is.list))) |>
  dplyr::select(where(\(x) dplyr::n_distinct(x) > 1L))
#> # A tibble: 12 × 4
#>    args  local  path      shape
#>    <chr> <chr>  <chr>     <dbl>
#>  1 1     const  mindrag       1
#>  2 2     const  random        1
#>  3 3     linear mindrag       1
#>  4 4     linear random        1
#>  5 5     step   mindrag       1
#>  6 6     step   random        1
#>  7 7     const  mindrag 1000000
#>  8 8     const  random  1000000
#>  9 9     linear mindrag 1000000
#> 10 10    linear random  1000000
#> 11 11    step   mindrag 1000000
#> 12 12    step   random  1000000