This function will create the pairs of cells between different modalities based on the integrated data generated by CoembedData. It was modified from https://github.com/buenrostrolab/stimATAC_analyses_code/blob/master/R/optMatching_functions.R to use Seurat object as input.
Author: Vinay Kartha, Yan Hu
Contact: <vinay_kartha@g.harvard.edu>
Affiliation: Buenrostro Lab, Department of Stem Cell and Regenerative Biology, Harvard University

PairCells(
  object,
  reduction = NULL,
  pair.by = NULL,
  ident1 = "ATAC",
  ident2 = "RNA",
  assay = "RNA",
  pair.mode = "greedy",
  tol = 1e-04,
  search.range = 0.2,
  max.multimatch = 5,
  min_subgraph_size = 50,
  seed = 42,
  k = 300
)

Arguments

object

The integrated Seurat object generated by the function CoembedData

reduction

Dimensional reduction to use for the pairing cells

pair.by

Name of one metadata column to split the object for pairing;

ident1

Specify how to split the object, must be an value of pair.by

ident2

Specify how to split the object, must be an value of pair.by

assay

Assay name based on which a KNN graph is constructed

pair.mode

Pair mode. Available options are: "greedy" and "geodesic".

tol

Tol times the number of subjects to be matched specifies the extent to which fullmatch's

search.range

This determines the size of the search knn. search_range * total number of cells = size of knn.

max.multimatch

Maximum number of cells allowed to be matched to each cell

min_subgraph_size

Minimum number of cells (ATAC/RNA each) needed for pairing in a given subgraph. Will skip subgraphs with fewer than these cells

seed

Random seed

k

k-NN parameter used for applying constraints on ATAC-RNA pairs

Value

A data frame containing the cell pairs

Examples

if (FALSE) {
df.pair <- PairCells(
  object = obj.coembed,
  reduction = "harmony",
  pair.by = "tech",
  ident1 = "ATAC",
  ident2 = "RNA"
  )
}