runJaccard: Calcualte Jaccard Index Matrix

View source: R/runJaccard.R

runJaccardR Documentation

Calcualte Jaccard Index Matrix

Description

This function takes a snap object as input and calculates the jaccard index matrix in which each entry Jij equals the intersection over the union between cell i and cell j.

Usage

runJaccard(obj, bin.downsample, tmp.folder, mat, max.var, seed.use)

Arguments

obj

A Snap obj

bin.downsample

Percentage of bins to be downsampled to [1].

tmp.folder

A non-empty character vector giving the directory name that saves the temp files

mat

A character class that indicates what matrix slot is used to calculate jaccard index c("bmat", "pmat", "gmat")

max.var

A numeric variable indicates the how many dimentions for jaccard index to be calcualted

seed.use

A numeric variable indicates the random seed to use [10].

Details

Calculating jaccard index becomes exponentially time-consuming and also memory intense with the increase of cell number.

The most memory and time consuming step of our procedure is the calculation of jaccard index matrix. This step increases exponentially with the increase of cell number. Here, we calculate a partial jaccard index matrix against a random subset of reference cells in lieu of the full spectrum of features. Here we tested if we can perform the calculation of partial jaccard index matrix using a random subset of max.var reference cells.

Value

Returns a Snap obj with the jaccard index matrix stored in obj@jmat

Examples

data(demo.sp);
demo.sp = makeBinary(demo.sp, mat="bmat");
demo.sp = runJaccard(obj=demo.sp, mat="bmat", bin.downsample=1, tmp.folder=tempdir())


r3fang/SnapATAC documentation built on March 29, 2022, 4:33 p.m.