% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/R-neighbourhood.R
\name{get_inlaid_spots}
\alias{get_inlaid_spots}
\title{Get inlaid spots within a source cluster}
\usage{
get_inlaid_spots(
  df,
  cluster,
  inlaid_col = "cluster",
  cluster_col = "cluster",
  coords = c("x", "y")
)
}
\arguments{
\item{df}{A data.frame containing at least the columns `x`, `y`, cluster
identifier column, inlaid column, and `spot_id`.
  - `x`, `y`: numeric coordinates of spots
- cluster column (name specified by `cluster_col`): cluster assignment for
each spot
- inlaid column (name specified by `inlaid_col`): inlaid/annotation for each
spot
  - `spot_id`: unique identifier for each spot}

\item{cluster}{The cluster label to retrieve inlaid spots for.}

\item{inlaid_col}{Character. Name of the column containing inlaid/annotation
values.
  Default is `"cluster"`.}

\item{cluster_col}{Character. Name of the column containing cluster
assignments.
  Default is `"cluster"`.}

\item{coords}{Character vector of length 2 giving the coordinate column
names.
  Default is `c("x", "y")`.}
}
\value{
A data.frame with columns:
\describe{
  \item{spot_id}{Unique spot identifier.}
  \item{x}{X coordinate.}
  \item{y}{Y coordinate.}
  \item{inlaid}{Inlaid/annotation value.}
  \item{cluster}{The source cluster being analyzed.}
  \item{is_inlaid}{Logical, always TRUE for returned rows.}
}
Rows are sorted by inlaid and spot_id.
}
\description{
This function retrieves all spots from a source cluster along with their
inlaid/annotation values. Unlike [get_neighborhood_spots()], this returns
spots
*inside* the source cluster itself, not around it.
}
\examples{
data("visium_simulated_spe", package = "Battlefield")
spe <- visium_simulated_spe
df <- data.frame(
  spot_id = colnames(spe),
  x = SpatialExperiment::spatialCoords(spe)[, 1],
  y = SpatialExperiment::spatialCoords(spe)[, 2],
  cluster = SummarizedExperiment::colData(spe)$cluster,
inlaid = sample(paste0("type_", 1:3), length(colnames(spe)), replace = TRUE)
)
# Get all inlaid spots within cluster 1
inlaid_spots <- get_inlaid_spots(df, cluster = 1, inlaid_col = "inlaid")
head(inlaid_spots)

}
