mapToDimReduction: Use nearest neighbor relationships to approximate the...

View source: R/mapToDimReduction.R

mapToDimReductionR Documentation

Use nearest neighbor relationships to approximate the positions of new data points within pre-computed low-dimensional representations of a reference dataset

Description

Use nearest neighbor relationships to approximate the positions of new data points within pre-computed low-dimensional representations of a reference dataset

Usage

mapToDimReduction(
  refData,
  newData,
  int_dat = NULL,
  refReducedDims,
  nn_k = 10,
  min_k = 4,
  nn_span = 0.1
)

Arguments

refData

A matrix where cells correspond to rows and features correspond to columns.

newData

A matrix where cells correspond to rows and features correspond to columns.

int_dat

A matrix of batch corrected data. If left unset, batch correction will be performed on refData and newData using the batchelor::fastMNN function.

refReducedDims

A list where each element is a dimensionality reduction of refData.

nn_k

For a given new data point, the number of nearest neighbors in the reference data to use.

min_k

The minimum number of nearest neighbors out of nn_k nearest neighbors from which to select the "best" combination of nearest neighbors. If set, mapping will be performed using the combination of l (where min_k =< l <= nn_k) nearest neighbors in the reference data whose centroid is the closest to its corresponding new data point in batch-corrected space. Recommended for use with nn_k < 12 as the number of combinations (and computation time) increases exponentially with the size of nn_k.

nn_span_max

For a given refReducedDim, nn_span is the ratio between the diagnal spanning the nearest neighbors and the diagnal spanning all data points. If set and if nn_span of the reference nearest neighbors for a given new data point is greater than nn_span_max, then nearest neighbors will be iteratively removed by selecting the most distant neighbor (defined as the nn with the largest distance to the average the other nn) and recomputing nn_span until falls below nn_span_max.

Value

A list of the same length as refReducedDims

Author(s)

Kevin Brulois


kbrulois/Dufy documentation built on May 4, 2022, 3:54 a.m.