Skip to contents

Determine the number of neighbors per cell type for a cell of interest

Usage

compute_neighbor_metrics(
  approach,
  dbscan_res,
  group_varname,
  df_with_labels,
  n_cores = 1,
  k_neighbors = NA
)

Arguments

approach

'knn' or 'radius'

dbscan_res

results of dbscan

group_varname

variable containing your labels for the cell_ids, e.g. cell type

df_with_labels

dataframe with 'cell_ids' and your 'group_varname'

n_cores

number of cores to use

k_neighbors

number of neighbors when approach = 'knn'

cell_id

cell_id for which you want to assess its neighbors

Value

return dataframe with the columns: labels_of_neighbors, cell_id, n_total, and n_cells