This function identifies the valley that tends to be outliers compared to other valley locations and tries to find the closest samples that have similar density distribution to input the valley. If no neighbor sample is detected, the valley will remain as original.

get_neighbors(
  target_sample,
  adt_marker_select,
  cell_x_adt,
  cell_x_feature,
  nearest_neighbor_n = 3,
  nearest_neighbor_threshold = NULL
)

Arguments

target_sample

The target sample whose valley needs to be imputed. Find the neighbor samples whose density distribution is close to the target sample.

adt_marker_select

The marker whose valley needs to be imputed. Find the neighbor samples whose density distribution is close to the target sample of the same ADT marker.

cell_x_adt

Matrix of ADT raw counts in cells (rows) by ADT markers (columns) format.

cell_x_feature

Matrix of cells (rows) by cell features (columns) such as cell type, sample, and batch-related information.

nearest_neighbor_n

Number of top nearest neighbor samples to detect.

nearest_neighbor_threshold

Threshold to call neighbor samples.

Examples

if (FALSE) {
get_neighbors(target_sample, adt_marker_select, cell_x_adt, cell_x_feature)
}