View source: R/simulate_clusters.R
simulate_clusters | R Documentation |
Based on an existing background image, simulate clusters of cells where the same type of cells aggregate. The default values for the arguments give an example of cluster simulation which enable an automatic simulation of clusters without the specification of any argument.
simulate_clusters(
bg_sample = bg1,
n_clusters = 2,
bg_type = "Others",
cluster_properties = list(C1 = list(name_of_cluster_cell = "Tumour", size = 300, shape
= "Oval", centre_loc = data.frame(x = 500, y = 500), infiltration_types =
c("Immune1", "Others"), infiltration_proportions = c(0.1, 0.05)), C2 =
list(name_of_cluster_cell = "Immune1", size = 500, shape = "Irregular", centre_loc =
data.frame(x = 1500, y = 500), infiltration_types = c("Immune2", "Others"),
infiltration_proportions = c(0.1, 0.05))),
plot_image = TRUE,
plot_categories = NULL,
plot_colours = NULL
)
bg_sample |
(OPTIONAL) A data frame or |
n_clusters |
Numeric. Number of clusters. This must match the
|
bg_type |
(OPTIONAL) String. The name of the background cell type if the background sample does not have a "Cell.Type" column. By default is "Others". |
cluster_properties |
List of properties of the clusters. See examples for the format of this arg. |
plot_image |
Boolean. Whether the simulated image is plotted. |
plot_categories |
String Vector specifying the order of the cell categories to be plotted. Default is NULL - the cell categories under the "Cell.Type" column would be used for plotting. |
plot_colours |
String Vector specifying the order of the colours that
correspond to the |
A data.frame of the simulated image
simulate_background_cells
for all cell simulation,
simulate_mixing
for mixed background 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_double_rings()
,
simulate_immune_rings()
,
simulate_mixing()
,
simulate_stripes()
set.seed(610)
cluster_image <- simulate_clusters(bg_sample = bg1,
n_clusters=2, cluster_properties=list(C1=list(name_of_cluster_cell="Tumour",
size=300, shape="Oval", centre_loc=data.frame("x"=500, "y"=500),
infiltration_types=c("Immune1", "Others"), infiltration_proportions=c(0.1, 0.05)),
C2=list(name_of_cluster_cell="Immune1", size=500, shape="Irregular",
centre_loc=data.frame("x"=1500,"y"=500), infiltration_types=c("Immune2", "Others"),
infiltration_proportions=c(0.1, 0.05))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.