Plots changes in clustering proportion against the distance to an image annotation.

plotIasBarplot(
  object,
  id,
  grouping_variable,
  distance = NA_integer_,
  binwidth = getCCD(object),
  n_bins_circle = NA_integer_,
  include_area = FALSE,
  unit = getSpatialMethod(object)@unit,
  round = 2,
  clrp = NULL,
  clrp_adjust = NULL,
  position = "fill",
  display_border = TRUE,
  border_linealpha = 0.75,
  border_linecolor = "black",
  border_linesize = 1,
  border_linetype = "dashed",
  x_nth = 1,
  bcsp_exclude = NULL,
  verbose = NULL
)

plotIasBarplotSC(
  object,
  id,
  sc_input,
  distance = NA_integer_,
  binwidth = getCCD(object),
  n_bins_circle = NA_integer_,
  angle_span = c(0, 360),
  include_area = FALSE,
  unit = getSpatialMethod(object)@unit,
  round = 2,
  clrp = NULL,
  clrp_adjust = NULL,
  position = "fill",
  display_border = TRUE,
  border_linealpha = 0.75,
  border_linecolor = "black",
  border_linesize = 1,
  border_linetype = "dashed",
  x_nth = 1,
  bcsp_exclude = NULL,
  verbose = NULL
)

Arguments

object

An object of class spata2.

id

Character value. The ID of the image annotation of interest.

grouping_variable

Character value. The grouping variable of interest. Use getGroupingOptions() to obtain all valid input options.

distance

Distance value. Specifies the distance from the border of the image annotation to the horizon in the periphery up to which the screening is conducted. (See details for more.) - See details of ?is_dist for more information about distance values.

binwidth

Distance value. The width of the circular bins to which the barcode-spots are assigned. We recommend to set it equal to the center-center distance: binwidth = getCCD(object). (See details for more.) - See details of ?is_dist for more information about distance values.

n_bins_circle

Numeric value or vector of length 2. Specifies how many times the area is buffered with the value denoted in binwidth. (See details for more.)

unit

Character value. The unit in which the distance to the image annotation is displayed on the x-axis.

If FALSE, plots the bin numbers instead.

round

Numeric value or FALSE. If numeric, given to digits of base::round(). Rounds transformed values before they are returned.

clrp

Character value. Specifies the color palette to be used to represent groups of discrete variables. Run validColorPalettes() to obtain valid input options.

clrp_adjust

Named character vector or NULL. If character, it adjusts the color palette that is used to represent the groups. Names of the input vector must refer to the group and the respective named element denotes the color with which to represent the group.

display_border

Logical value. If TRUE, displays a vertical line to highlight where the border of the image annotation runs.

border_linealpha, border_linecolor, border_linesize, border_linetype

Given to ggplot2::geom_vline(). Adjusts appearance of the vertical line that represents the border of the image annotation.

x_nth

Numeric value. If the number of breaks/labels on the x-axis becomes too high x_nth can be used to reduce it. If x_nth is 1, every label is kept. If 2, every second label is kept. If 3, every third label is kept. And so on.

bcsp_exclude

Character value containing name(s) of barcode-spots to be excluded from the analysis.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

sc_input

Data.frame that contains the results from single cell deconvolution. Must have at least three columns:

  • x : numeric. Position of cell on the x axis in pixel.,

  • y : numeric. Position of cell on the y axis in pixel.,

  • cell_type : factor Cell type of the cell.

angle_span

Numeric vector of length 2. Confines the area screened by an angle span relative to the center of the image annotation. (See details fore more.)

Value

A ggplot.

Distance measures

Several functions in SPATA2 have arguments that take distance input. To specifically refer to a distance the unit must be specified. There are three ways to create valid input for these arguments.

1. In pixel:

There are two valid input options to specify the distance in pixel:

  • numeric: Single numeric values, e.g. arg_input = c(2, 3.554, 69, 100.67). If no unit is specified the input will be interpreted as pixels.

  • character: Suffixed with 'px', e.g. arg_input = c('2px', '3.554px', '69px', '100.67px')

Note: The unit pixel (px) is used for distances as well as for areas. If pixel refers to a distance the pixel side length is meant. If pixel refers to an area the number of pixels is meant.

2. According to the Systeme international d`unites (SI):

Specifying distances in SI units e.g. arg_input = c('2mm', '4mm') etc. requires the input to be a character as the unit must be provided as suffix. Between the numeric value and the unit must be no empty space! Valid suffixes can be obtained using the function validUnitsOfLengthSI().

3. As vectors of class unit:

Behind the scenes SPATA2 works with the units package. Input is converted into vectors of class units. Therefore, input can be directly provided this way: arg_input = units::set_unit(x = c(2,4), value = 'mm') Note that pixel is not a valid unit in the units package. If you want to specify the input in pixel you have to use input option 1. In pixel.