simulate_mixing: Simulate mixed background image

View source: R/simulate_mixing.R

simulate_mixingR Documentation

Simulate mixed background image

Description

Based on an existing background image, simulate mixed cell types with specified cell types and proportions. The default values for the arguments give an example of mixed cell type simulation which enable an automatic simulation of mixed cell types without the specification of any argument.

Usage

simulate_mixing(
  bg_sample = bg1,
  idents = c("Tumour", "Immune", "Others"),
  props = c(0.2, 0.4, 0.4),
  plot_image = TRUE,
  plot_colours = NULL
)

Arguments

bg_sample

(OPTIONAL) A data frame or SpatialExperiment class object with locations of points representing background cells. Further cell types will be simulated based on this background sample. The data.frame or the spatialCoords() of the SPE object should have colnames including "Cell.X.Positions" and "Cell.Y.Positions". By default use the internal bg1 background image.

idents

String Vector of the mixed cell types.

props

Numeric Vector of the proportions of the mixed cell types.

plot_image

Boolean. Whether the simulated image is plotted.

plot_colours

String Vector specifying the order of the colours that correspond to the idents arg. Default is NULL - the predefined colour vector would be used for plotting..

Value

A data.frame of the simulated image

See Also

simulate_background_cells for all cell simulation, simulate_clusters for cluster simulation, simulate_immune_rings/simulate_double_rings for immune ring simulation, and simulate_stripes for vessel simulation.

Other simulate pattern functions: simulate_background_cells(), simulate_clusters(), simulate_double_rings(), simulate_immune_rings(), simulate_stripes()

Examples

set.seed(610)
mix_background <- simulate_mixing(bg_sample=bg1,
idents=c("Tumour","Immune", "Others"), props=c(0.2, 0.4,  0.4),
plot_image=TRUE)

TrigosTeam/spaSim documentation built on May 25, 2023, 4:20 p.m.