Skip to contents

This function launches an interactive Shiny application that allows users to manually draw lasso selections to define regions of interest (ROIs) on spatial transcriptomics data. Supports multiple ROIs per sample and saves the results for downstream analysis.

Usage

NicheDetect_Lasso(
  STID_obj = NULL,
  loop_id = "LoopAllSamp",
  meta_key = "coord",
  group_by = NULL,
  lasso_para = list(meta_data = NULL, samp_colnm = NULL, x_colnm = "x", y_colnm = "y",
    data_format = "square_grid", data_platform = "StereoSeq", binsize = 1, coord_interval
    = 1),
  col = COLOR_LIST$PALETTE_WHITE_BG,
  description = NULL,
  grp_nm = NULL,
  dir_nm = "M2_NicheDetect_Lasso"
)

Arguments

STID_obj

An STID object containing spatial transcriptomics data

loop_id

Character, sample grouping identifier (default: "LoopAllSamp")

meta_key

Character, metadata key containing spatial coordinates and grouping information (default: "coord")

group_by

Character, column name for coloring points in the interactive plot

lasso_para

List, parameters for lasso selection when STID_obj is NULL, including: - meta_data: Data frame containing spatial coordinates and metadata (required if STID_obj is NULL) - samp_colnm: Column name for sample identifiers in meta_data (required if STID_obj is NULL) - x_colnm: Column name for x coordinates in meta_data (default: "x") - y_colnm: Column name for y coordinates in meta_data (default: "y") - data_format: Format of spatial data, either "square_grid" or "hex_grid" (default: "square_grid") - data_platform: Platform of spatial data, either "StereoSeq" or "Visium" (default: "StereoSeq") - binsize: Bin size for spatial data (default: 1) - coord_interval: Coordinate interval for spatial data (default: 1)

col

Color palette for visualization (default: COLOR_LIST$PALETTE_WHITE_BG)

description

Character, description of the analysis (default: NULL)

grp_nm

Character, group name for output organization (default: NULL, uses timestamp)

dir_nm

Character, directory name for output (default: "M2_NicheDetect_Lasso")

Value

Returns the modified STID object with added metadata containing ROI labels, distances to ROI centers, and edge information

Examples

if (FALSE) { # \dontrun{
# Launch interactive ROI selection
STID_obj <- NicheDetect_Lasso(
  STID_obj = ist_object,
  group_by = "cell_type",
  meta_key = "coord"
)
} # }