diff --git a/R/multiple_background_images.R b/R/multiple_background_images.R index 511798e..1b58519 100644 --- a/R/multiple_background_images.R +++ b/R/multiple_background_images.R @@ -42,7 +42,7 @@ multiple_background_images <- function(bg_sample = bg1, idents = c("Tumour", "Immune","Others"), props = list(rep(0.1, 9), seq(0, 0.4, 0.05), - seq(0.9,0.5,-0.05)), + seq(0.9, 0.5, -0.05)), plot_image = TRUE, plot_colours = NULL){ ## CHECK diff --git a/R/multiple_images_with_clusters.R b/R/multiple_images_with_clusters.R index 30ab9a9..bb2b261 100644 --- a/R/multiple_images_with_clusters.R +++ b/R/multiple_images_with_clusters.R @@ -52,10 +52,9 @@ #' @export #' @examples #' set.seed(610) -#' cluster_image_list <- multiple_images_with_clusters(bg_sample = bg1, -#' cluster_shape=2, prop_infiltration = c(0.1, 0.3), cluster_size = c(300,600), +#' cluster_image_list <- multiple_images_with_clusters(bg_sample=bg1, +#' cluster_shape=2, prop_infiltration=0.1, cluster_size = seq(200,1000,100), #' cluster_loc_x = 0, cluster_loc_y = 0, plot_image = TRUE) - multiple_images_with_clusters <- function(bg_sample = bg1, cluster_shape = 2, prop_infiltration = 0.1, diff --git a/R/multiple_images_with_immune_rings.R b/R/multiple_images_with_immune_rings.R index 1413e94..e927e94 100644 --- a/R/multiple_images_with_immune_rings.R +++ b/R/multiple_images_with_immune_rings.R @@ -58,9 +58,8 @@ #' set.seed(610) #' ring_image_list <- multiple_images_with_immune_rings(bg_sample = bg1, #' ring_shape = 1, prop_infiltration = 0, ring_width = seq(50,100,10), -#' cluster_size = 300, cluster_loc_x = 0, cluster_loc_y = 0, +#' cluster_size = 200, cluster_loc_x = 0, cluster_loc_y = 0, #' prop_ring_infiltration = seq(0, 0.2,0.05), plot_image = TRUE) - multiple_images_with_immune_rings <- function(bg_sample = bg1, cluster_size = 200, ring_shape = 1, diff --git a/R/simulate_clusters.R b/R/simulate_clusters.R index 4db5991..aafd707 100644 --- a/R/simulate_clusters.R +++ b/R/simulate_clusters.R @@ -39,11 +39,12 @@ #' @examples #' set.seed(610) #' cluster_image <- simulate_clusters(bg_sample = bg1, -#' n_clusters = 1, 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)))) - +#' 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)))) simulate_clusters <- function(bg_sample = bg1, n_clusters = 2, bg_type = "Others", @@ -68,7 +69,6 @@ simulate_clusters <- function(bg_sample = bg1, plot_categories = NULL, plot_colours = NULL ){ - ## CHECK if (!is.data.frame(bg_sample) & !methods::is(bg_sample, "SingleCellExperiment")) { stop("`bg_sample` should be either a data.frame or a SingleCellExperiment object!") diff --git a/R/simulate_double_rings.R b/R/simulate_double_rings.R index 5810911..e09ec8a 100644 --- a/R/simulate_double_rings.R +++ b/R/simulate_double_rings.R @@ -65,7 +65,7 @@ simulate_double_rings <- function(bg_sample = bg1, n_dr = 2, win = NULL, dr_properties = list( - I1 = list( + D1 = list( name_of_cluster_cell = "Tumour", size = 300, shape = "Circle", @@ -81,7 +81,7 @@ simulate_double_rings <- function(bg_sample = bg1, double_ring_infiltration_types = c("Others"), double_ring_infiltration_proportions = c(0.15) ), - I2 = list( + D2 = list( name_of_cluster_cell = "Tumour", size = 300, shape = "Oval", diff --git a/R/simulate_immune_rings.R b/R/simulate_immune_rings.R index 54fd46e..7ce897f 100644 --- a/R/simulate_immune_rings.R +++ b/R/simulate_immune_rings.R @@ -41,14 +41,19 @@ #' @examples #' set.seed(610) #' # manually define the properties of the immune ring -#' ir_properties <- list(I1 = list(name_of_cluster_cell = "Tumour", -#' size = 600,shape = "Circle",centre_loc = data.frame("x" = 930, "y" = 1000), -#' infiltration_types = c("Immune1", "Immune2", "Others"), infiltration_proportions -#' = c(0.15, 0.05, 0.05), name_of_ring_cell = "Immune1", immune_ring_width = 150, -#' immune_ring_infiltration_types = c("Others"), immune_ring_infiltration_proportions = c(0.15))) +#' ir_properties <- list(I1=list(name_of_cluster_cell="Tumour", size=600, +#' shape="Circle",centre_loc=data.frame("x"=930, "y"=1000), +#' infiltration_types=c("Immune1", "Immune2", "Others"), infiltration_proportions +#'=c(0.15, 0.05, 0.05), name_of_ring_cell="Immune1", immune_ring_width=150, +#' immune_ring_infiltration_types=c("Others"), immune_ring_infiltration_proportions=c(0.15)), +#' I2=list(name_of_cluster_cell="Tumour", size=500, shape="Oval", +#' centre_loc=data.frame("x"=1330, "y"=1100), infiltration_types=c("Immune1", "Immune2", "Others"), +#' infiltration_proportions=c(0.15, 0.05, 0.05), name_of_ring_cell="Immune1", +#' immune_ring_width=150, immune_ring_infiltration_types=c("Others"), +#' immune_ring_infiltration_proportions=c(0.15))) #' # simulate immune rings (`n_ir` should match the length of `ir_properties`) -#' immune_ring_image <- simulate_immune_rings(bg_sample = bg1, -#' n_ir = 1, ir_properties = ir_properties) +#' immune_ring_image <- simulate_immune_rings(bg_sample=bg1, +#' n_ir=2, ir_properties=ir_properties) #' simulate_immune_rings <- function(bg_sample = bg1, bg_type = "Others", diff --git a/R/simulate_mixing.R b/R/simulate_mixing.R index f20dd84..c8393e9 100644 --- a/R/simulate_mixing.R +++ b/R/simulate_mixing.R @@ -29,10 +29,9 @@ #' #' @examples #' set.seed(610) -#' mix_background <- simulate_mixing(bg_sample = bg1, -#' idents = c("Tumour","Immune", "Others"), props = c(0.2, 0.4, 0.4)) -#' - +#' mix_background <- simulate_mixing(bg_sample=bg1, +#' idents=c("Tumour","Immune", "Others"), props=c(0.2, 0.4, 0.4), +#' plot_image=TRUE) simulate_mixing <- function(bg_sample = bg1, idents = c("Tumour", "Immune", "Others"), props = c(0.2, 0.4, 0.4), diff --git a/man/TIS.Rd b/man/TIS.Rd index 6d423ad..82d9e55 100644 --- a/man/TIS.Rd +++ b/man/TIS.Rd @@ -85,10 +85,12 @@ stripes.} \item{plot_image}{Boolean. Whether the simulated image is plotted.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ An sce object of the simulated image diff --git a/man/multiple_background_images.Rd b/man/multiple_background_images.Rd index c56d4fd..728a6e3 100644 --- a/man/multiple_background_images.Rd +++ b/man/multiple_background_images.Rd @@ -31,7 +31,8 @@ number of images.} is TRUE.} \item{plot_colours}{String Vector. If plot_image is TRUE, this param is the -corresponding colours for the \code{idents} arg.} +corresponding colours for the \code{idents} arg. Default is NULL, the predefined +colour vector would be used for plotting.} } \value{ A list of SCE objects diff --git a/man/multiple_images_with_clusters.Rd b/man/multiple_images_with_clusters.Rd index 3dd6ccb..f4afe34 100644 --- a/man/multiple_images_with_clusters.Rd +++ b/man/multiple_images_with_clusters.Rd @@ -55,10 +55,12 @@ The Y location of the cluster center offset.} TRUE.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A list of SCE objects @@ -72,8 +74,8 @@ without the specification of any argument. } \examples{ set.seed(610) -cluster_image_list <- multiple_images_with_clusters(bg_sample = bg1, -cluster_shape=2, prop_infiltration = c(0.1, 0.3), cluster_size = c(300,600), +cluster_image_list <- multiple_images_with_clusters(bg_sample=bg1, +cluster_shape=2, prop_infiltration=0.1, cluster_size = seq(200,1000,100), cluster_loc_x = 0, cluster_loc_y = 0, plot_image = TRUE) } \seealso{ diff --git a/man/multiple_images_with_immune_rings.Rd b/man/multiple_images_with_immune_rings.Rd index 977621b..333141f 100644 --- a/man/multiple_images_with_immune_rings.Rd +++ b/man/multiple_images_with_immune_rings.Rd @@ -64,10 +64,12 @@ infiltration in the region of immune rings.} TRUE.} \item{plot_categories}{String Vector specifying the order of the cell -cateories to be plotted.} +cateories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A list of sce objects @@ -82,7 +84,7 @@ specification of any argument. set.seed(610) ring_image_list <- multiple_images_with_immune_rings(bg_sample = bg1, ring_shape = 1, prop_infiltration = 0, ring_width = seq(50,100,10), -cluster_size = 300, cluster_loc_x = 0, cluster_loc_y = 0, +cluster_size = 200, cluster_loc_x = 0, cluster_loc_y = 0, prop_ring_infiltration = seq(0, 0.2,0.05), plot_image = TRUE) } \seealso{ diff --git a/man/simulate_clusters.Rd b/man/simulate_clusters.Rd index 18a26ce..2b475b5 100644 --- a/man/simulate_clusters.Rd +++ b/man/simulate_clusters.Rd @@ -44,10 +44,12 @@ for the format of this arg.} \item{plot_image}{Boolean. Whether the simulated image is plotted.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A data.frame of the simulated image @@ -61,10 +63,12 @@ simulation of clusters without the specification of any argument. \examples{ set.seed(610) cluster_image <- simulate_clusters(bg_sample = bg1, -n_clusters = 1, 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)))) +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)))) } \seealso{ \code{\link{simulate_background_cells}} for all cell simulation, diff --git a/man/simulate_double_rings.Rd b/man/simulate_double_rings.Rd index 16b6dc7..039b00b 100644 --- a/man/simulate_double_rings.Rd +++ b/man/simulate_double_rings.Rd @@ -9,14 +9,14 @@ simulate_double_rings( bg_type = "Others", n_dr = 2, win = NULL, - dr_properties = list(I1 = list(name_of_cluster_cell = "Tumour", size = 300, shape = + dr_properties = list(D1 = list(name_of_cluster_cell = "Tumour", size = 300, shape = "Circle", centre_loc = data.frame(x = 1000, y = 1000), infiltration_types = c("Immune1", "Immune2", "Others"), infiltration_proportions = c(0.15, 0.05, 0.05), name_of_ring_cell = "Immune1", immune_ring_width = 150, immune_ring_infiltration_types = c("Others"), immune_ring_infiltration_proportions = c(0.15), name_of_double_ring_cell = "Immune2", double_ring_width = 100, double_ring_infiltration_types = c("Others"), double_ring_infiltration_proportions = - c(0.15)), I2 = list(name_of_cluster_cell = "Tumour", size = 300, shape = "Oval", + c(0.15)), D2 = list(name_of_cluster_cell = "Tumour", size = 300, shape = "Oval", centre_loc = data.frame(x = 1200, y = 1200), infiltration_types = c("Immune1", "Immune2", "Others"), infiltration_proportions = c(0.15, 0.05, 0.05), name_of_ring_cell = "Immune1", immune_ring_width = 150, @@ -52,10 +52,12 @@ refer to the examples for the structure of \code{dr_properties}.} \item{plot_image}{Boolean. Whether the simulated image is plotted.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A data.frame of the simulated image diff --git a/man/simulate_immune_rings.Rd b/man/simulate_immune_rings.Rd index 90d6f60..e604129 100644 --- a/man/simulate_immune_rings.Rd +++ b/man/simulate_immune_rings.Rd @@ -48,10 +48,12 @@ the examples for the structure of \code{ir_properties}.} \item{plot_image}{Boolean. Whether the simulated image is plotted.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A data.frame of the simulated image @@ -66,14 +68,19 @@ of immune rings without the specification of any argument. \examples{ set.seed(610) # manually define the properties of the immune ring -ir_properties <- list(I1 = list(name_of_cluster_cell = "Tumour", -size = 600,shape = "Circle",centre_loc = data.frame("x" = 930, "y" = 1000), -infiltration_types = c("Immune1", "Immune2", "Others"), infiltration_proportions -= c(0.15, 0.05, 0.05), name_of_ring_cell = "Immune1", immune_ring_width = 150, -immune_ring_infiltration_types = c("Others"), immune_ring_infiltration_proportions = c(0.15))) +ir_properties <- list(I1=list(name_of_cluster_cell="Tumour", size=600, +shape="Circle",centre_loc=data.frame("x"=930, "y"=1000), +infiltration_types=c("Immune1", "Immune2", "Others"), infiltration_proportions +=c(0.15, 0.05, 0.05), name_of_ring_cell="Immune1", immune_ring_width=150, +immune_ring_infiltration_types=c("Others"), immune_ring_infiltration_proportions=c(0.15)), +I2=list(name_of_cluster_cell="Tumour", size=500, shape="Oval", +centre_loc=data.frame("x"=1330, "y"=1100), infiltration_types=c("Immune1", "Immune2", "Others"), +infiltration_proportions=c(0.15, 0.05, 0.05), name_of_ring_cell="Immune1", +immune_ring_width=150, immune_ring_infiltration_types=c("Others"), +immune_ring_infiltration_proportions=c(0.15))) # simulate immune rings (`n_ir` should match the length of `ir_properties`) -immune_ring_image <- simulate_immune_rings(bg_sample = bg1, -n_ir = 1, ir_properties = ir_properties) +immune_ring_image <- simulate_immune_rings(bg_sample=bg1, +n_ir=2, ir_properties=ir_properties) } \seealso{ diff --git a/man/simulate_mixing.Rd b/man/simulate_mixing.Rd index f0f388c..6b5921e 100644 --- a/man/simulate_mixing.Rd +++ b/man/simulate_mixing.Rd @@ -27,7 +27,8 @@ metadata of the SCE object should have colnames including \item{plot_image}{Boolean. Whether the simulated image is plotted.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{idents} arg.} +correspond to the \code{idents} arg. Default is NULL - the predefined +colour vector would be used for plotting..} } \value{ A data.frame of the simulated image @@ -41,9 +42,9 @@ argument. } \examples{ set.seed(610) -mix_background <- simulate_mixing(bg_sample = bg1, -idents = c("Tumour","Immune", "Others"), props = c(0.2, 0.4, 0.4)) - +mix_background <- simulate_mixing(bg_sample=bg1, +idents=c("Tumour","Immune", "Others"), props=c(0.2, 0.4, 0.4), +plot_image=TRUE) } \seealso{ \code{\link{simulate_background_cells}} for all cell simulation, diff --git a/man/simulate_stripes.Rd b/man/simulate_stripes.Rd index fb49bf9..ba6cb65 100644 --- a/man/simulate_stripes.Rd +++ b/man/simulate_stripes.Rd @@ -40,10 +40,12 @@ structure of \code{stripe_properties}.} TRUE.} \item{plot_categories}{String Vector specifying the order of the cell -categories to be plotted.} +categories to be plotted. Default is NULL - the cell categories under the +"Phenotype" column would be used for plotting.} \item{plot_colours}{String Vector specifying the order of the colours that -correspond to the \code{plot_categories} arg.} +correspond to the \code{plot_categories} arg. Default is NULL - the predefined +colour vector would be used for plotting.} } \value{ A data.frame of the simulated image