This function compares feature counts across multiple STGrid objects.

cmp_counts_st(
  ...,
  features = NULL,
  normalized = FALSE,
  type = c("barplot"),
  names = NULL,
  transform = c("None", "log2", "log10", "log"),
  fill_color = NULL,
  border_color = "black"
)

Arguments

...

A set of STGrid objects.

features

A character vector specifying the features (e.g., genes) to compare. Default is NULL.

normalized

Logical indicating whether the counts should be normalized. Default is FALSE.

type

Type of plot to generate. Currently only barplot is supported.

names

Optional character vector specifying names for each STGrid object. If NULL, default names will be assigned.

transform

Transformation method for the counts. Options are "None" (default), "log2", "log10", or "log".

fill_color

Optional character vector specifying fill colors for different conditions in the plot.

border_color

Color for the border of bars in bar plots. Default is "black".

Value

A ggplot object representing the comparison of counts across different conditions or samples.

Examples

example_dataset()
#> |-- INFO :  Dataset 11284233/files/Xenium_Mouse_Brain_Coronal_7g was already loaded. 
xen <- Xenium_Mouse_Brain_Coronal_7g
x_bins <-  bin_x(xen)[181:nbin_x(xen)]
y_bins <-  bin_y(xen)[101:nbin_y(xen)]
xen_r1 <- xen[x_bins, y_bins]
x_bins <-  bin_x(xen)[61:101]
y_bins <-  bin_y(xen)[101:nbin_y(xen)]
xen_r2 <- xen[x_bins, y_bins]

cmp_counts_st(xen, xen_r1, xen_r2, features = c("Chat", "Ano1"), normalized = FALSE)
#> |-- INFO :  Found  3 STGrid objects. 

cmp_counts_st(xen, xen_r1, xen_r2,
             features = c("Chat", "Ano1"),
              normalized = TRUE, fill_color=grDevices::rainbow(3))
#> |-- INFO :  Found  3 STGrid objects.