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)
set.seed(24601L)
result = tumopp::tumopp("-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.36    -1
##  2     0     0     0     2        1  1.36  2.04    -1
##  3     0     0     1     3        1  1.36  2.37    -1
##  4     0     0     0     4        2  2.04  2.69    -1
##  5    -1     1     0     5        2  2.04  3.07    -1
##  6     0     0     1     6        3  2.37  3.48    -1
##  7     1     0     2     7        3  2.37  3.15    -1
##  8     0     0     0     8        4  2.69  3.41    -1
##  9     0    -1    -1     9        4  2.69  3.52    -1
## 10    -1     1     0    10        5  3.07  4.43    -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 = tumopp::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::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