get_closepairs_fixednumber: get_closepairs_fixednumber

View source: R/get_closepairs_fixednumber.R

get_closepairs_fixednumberR Documentation

get_closepairs_fixednumber

Description

This function takes a distance matrix and finds all pairs of samples that are within a distance cutoff determined by a specified number of close pairs. If there are too many close pairs that could be below this threshold, then a random sample of these close pairs is returned. User must specify a seed. The pairs are returned as an nx2 matrix, where n is the number of close pairs, and the elements of the matrix are the indices of the samples in that close pair in the distance matrix. Plotting the histogram with the cutoff is optional.

Usage

get_closepairs_fixednumber(
  distance_matrix,
  number_close_pairs,
  seed,
  show_hist,
  verbose
)

Arguments

distance_matrix

A distance matrix

number_close_pairs

The number of close pairs to be returned

seed

Random seed for down-sampling if necessary

show_hist

Boolean indicator for whether or not to plot a histogram of the distances and cutoff. Uses ggplot defaults for bins.

verbose

TRUE for returning distance cutoff used, FALSE for not

Examples

get_closepairs_fixednumber(distance_matrix, 5000, 1, T) # This will yield the 5000 closest pairs, with random seed 1.

weissmanlab/decotur documentation built on Sept. 4, 2024, 6:49 a.m.