Skip to contents

This method returns information about tumour tissue cells

Arguments

lower_corner

The lower-left corner of the selection frame (optional).

upper_corner

The upper-right corner of the selection frame (optional).

mutant_filter

The vector of the to-be-selected mutant names (optional).

epigenetic_filter

The vector of the to-be-selected epigenetic states (optional).

Value

A dataframe reporting "cell_id", "mutant", "epistate", "position_x", and "position_y" for each cells satisfying the provided filters and laying in the input frame.

Details

It collects some data about the cells in the tissue without altering the tissue itself. The pairs of optional parameters lower_corner and upper_corner define a frame of the tissue in which the data are sampled. The optional parameters mutant_filter and epigenetic_filter filter the collected cell data according to the cell mutant and epigenetic state.

Examples

# set the seed of the random number generator
set.seed(0)

# create a simulation
sim <- SpatialSimulation()
sim$add_mutant(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
               growth_rates = c("+" = 0.2, "-" = 0.08),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$add_mutant(name = "B",
               epigenetic_rates = c("+-" = 0.02, "-+" = 0.01),
               growth_rates = c("+" = 0.3, "-" = 0.1),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$schedule_mutation(src = "A", dst = "B", time = 50)
sim$place_cell("A+", 500, 500)
sim$run_up_to_time(30)
#> 
 [████████████████████████████████████████] 100% [00m:00s] Saving snapshot                                 


# collect all the cells in the tissue
sim$get_cells()
#>    cell_id mutant epistate position_x position_y
#> 1       44      A        -        499        502
#> 2       19      A        -        500        500
#> 3       43      A        -        500        501
#> 4       27      A        -        500        503
#> 5       48      A        +        501        498
#> 6       39      A        +        501        499
#> 7       35      A        -        501        501
#> 8       33      A        -        501        502
#> 9       42      A        -        501        503
#> 10      47      A        +        502        498
#> 11      30      A        -        502        499
#> 12      36      A        -        502        500
#> 13      37      A        -        502        502
#> 14      41      A        -        502        503
#> 15      29      A        -        503        499
#> 16      45      A        -        503        502
#> 17      38      A        -        503        503
#> 18      46      A        -        504        502

# get the cells in the frame [495,505]x[490,500]
sim$get_cells(lower_corner=c(495,490), upper_corner=c(505,500))
#>   cell_id mutant epistate position_x position_y
#> 1      19      A        -        500        500
#> 2      48      A        +        501        498
#> 3      39      A        +        501        499
#> 4      47      A        +        502        498
#> 5      30      A        -        502        499
#> 6      36      A        -        502        500
#> 7      29      A        -        503        499

# cells can be filtered by mutant name...
sim$get_cells(mutant_filter=c("A"),epigenetic_filter=c("+","-"))
#>    cell_id mutant epistate position_x position_y
#> 1       44      A        -        499        502
#> 2       19      A        -        500        500
#> 3       43      A        -        500        501
#> 4       27      A        -        500        503
#> 5       48      A        +        501        498
#> 6       39      A        +        501        499
#> 7       35      A        -        501        501
#> 8       33      A        -        501        502
#> 9       42      A        -        501        503
#> 10      47      A        +        502        498
#> 11      30      A        -        502        499
#> 12      36      A        -        502        500
#> 13      37      A        -        502        502
#> 14      41      A        -        502        503
#> 15      29      A        -        503        499
#> 16      45      A        -        503        502
#> 17      38      A        -        503        503
#> 18      46      A        -        504        502

# ...or by epigenetic state
sim$get_cells(mutant_filter=c("A","B"),epigenetic_filter=c("-"))
#>    cell_id mutant epistate position_x position_y
#> 1       44      A        -        499        502
#> 2       19      A        -        500        500
#> 3       43      A        -        500        501
#> 4       27      A        -        500        503
#> 5       35      A        -        501        501
#> 6       33      A        -        501        502
#> 7       42      A        -        501        503
#> 8       30      A        -        502        499
#> 9       36      A        -        502        500
#> 10      37      A        -        502        502
#> 11      41      A        -        502        503
#> 12      29      A        -        503        499
#> 13      45      A        -        503        502
#> 14      38      A        -        503        503
#> 15      46      A        -        504        502

# cells can be filtered by frame, mutant, and epigenetic states
sim$get_cells(lower_corner=c(495,495), upper_corner=c(505,505),
              mutant_filter=c("A"),epigenetic_filter=c("+","-"))
#>    cell_id mutant epistate position_x position_y
#> 1       44      A        -        499        502
#> 2       19      A        -        500        500
#> 3       43      A        -        500        501
#> 4       27      A        -        500        503
#> 5       48      A        +        501        498
#> 6       39      A        +        501        499
#> 7       35      A        -        501        501
#> 8       33      A        -        501        502
#> 9       42      A        -        501        503
#> 10      47      A        +        502        498
#> 11      30      A        -        502        499
#> 12      36      A        -        502        500
#> 13      37      A        -        502        502
#> 14      41      A        -        502        503
#> 15      29      A        -        503        499
#> 16      45      A        -        503        502
#> 17      38      A        -        503        503
#> 18      46      A        -        504        502