kdist: Calculated K-distance between query cells and reference cells...

View source: R/scoloc.R

kdistR Documentation

Calculated K-distance between query cells and reference cells based on their spatial coordinates

Description

Calculated K-distance between query cells and reference cells based on their spatial coordinates

Usage

kdist(
  inp_df,
  ref = NULL,
  ref_type = "all",
  que = NULL,
  k = 10,
  new_name = "kdist",
  keep_nn = F
)

Arguments

inp_df

inp_df must contain cell_names, 'coord_x', 'coord_y' columns

ref

Reference groups

ref_type

'all' or 'each'

que

Query groups

k

The number of nearest neighbors

new_name

New name for kdist

keep_nn

Keep Nearest Neighboor id matrix?

Value

A list of 1. kdist data frame and 2. a list of knn id matrix

Examples

kdist_out <- kdist(inp_df=test_df, ref=c('A', 'B', 'C'), ref_type='each', que=unique(test_df$cell_names), k=10, keep_nn=T)

navinlabcode/CellTrek documentation built on April 15, 2022, 8:04 a.m.