Leverages dbscan::dbscan() to identify tissue sections on the slide and to group barcode spots accordingly. Required to approximate the outline of the tissue section(s).

add_dbscan_variable(
  coords_df,
  eps,
  minPts = 3,
  name = "dbscan",
  x = "x",
  y = "y",
  min_cluster_size = 1,
  ...
)

add_tissue_section_variable(coords_df, ccd, minPts = 3, ...)

Arguments

coords_df

Data.frame with x and y variable.

eps

Distance measure. Given to eps of dbscan::dbscan(). Determines the size (radius) of the epsilon neighborhood.

minPts

Numeric value. Given to dbscan::dbscan(). Determines the number of minimum points required in the eps neighborhood for core points (including the point itself)

name

Name of the added variable.

...

To silently drop deprecated arguments.

Value

Data.frame with additional variable containing numbers. 0 means that the spot is not connected to any other spot (probably artefact). 1-n corresponds to the tissue sections.

Note

add_dbscan_variable() is the working horse. add_tissue_section_variable() has specific defaults.

Examples


library(SPATA2)
library(EBImage)
library(tidyverse)

data("example_data")

object <- example_data$object_LMU_MCI_diet

coords_df <-
 getCoordsDf(object) %>%
 add_dbscan_variable(eps = recDbscanEps(object), name = "section")

plotSurface(coords_df, color_by = "section")