Extracts information about image annotations in a data.frame.

getImgAnnSummaryDf(
  object,
  ids = NULL,
  area = TRUE,
  unit_area = "mm2",
  center = TRUE,
  unit_center = "px",
  genes = NULL,
  summarize_with = "mean",
  tags_to_lgl = TRUE,
  tags_keep = FALSE,
  verbose = NULL
)

Arguments

object

An object of class spata2.

ids

Character vector or NULL. If character, specifies the IDs of the image annotations of interest. If numeric, the image annotations are picked by number. If NULL, all image annotations are included - subsequent selection with tags and test is possible.

area

Logical. If TRUE, the area of each image annotation is added in a variable named area.

unit_area

The unit of the area variable.

center

Logical. If TRUE, two variables named center_x and center_y area added providing the center coordinates of the image annotation.

unit_center

The unit of the center variables.

genes

Character value or NULL. If character, the gene expression of the named genes is summarized among all barcode spots that fall in the area of the image annotation and are added as a variable.

summarize_with

Character value. The summarizing function with which the gene expression values are summarized.

tags_to_lgl

Logical. If TRUE, tag information is displayed in logical variables where each variable is named like one of the unique tags and every value is either TRUE if the annotation cotnains the tag or FALSE if not.

tags_keep

Logical. If TRUE, variable tags is not removed if tags_to_lgl is TRUE.

verbose

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

(Warning messages will always be printed.)

Value

Data.frame in which each row corresponds to an image annotation identified by the variable id.

Selection of image annotations with tags

Input for argument tags specifies the tags of interest. Argument test decides about how the specified tags are used to select the image annotations of interest. There are multiple options:

  1. Argument test set to 'any' or 1: To be included, an image annotation must be tagged with at least one of the input tags.

  2. Argument test set to 'all' or 2: To be included, an image annotation must be tagged with all of the input tags. Can contain tags that are not specified.

  3. Argument test set to 'identical' or 3: To be included, an image annotation must be tagged with all of the input tags. Can not be tagged with anything else.

  4. Argument test set to not_identical or 4: To be included, an image annotation must not be tagged with the combination of input tags.

  5. Argument test set to 'none' or 5: To be included, an image annotation must not contain any of the input tags.

Note that the filtering process happens after the filtering by input for argument ids. You can first select a group of image annotations by naming their IDs and then select among them via tags and test. If ids is NULL, you select among all image annotations via tags and test. And if tags is also NULL, the function uses all image annoations.