calcPairwiseOverlaps: Calculate pairwise overlaps between all signatures

View source: R/calcPairwiseOverlaps.R

calcPairwiseOverlapsR Documentation

Calculate pairwise overlaps between all signatures

Description

Calculate pairwise overlaps between all signatures

Usage

calcPairwiseOverlaps(sets, targetset = NULL)

Arguments

sets

a named list of signatures

targetset

NULL to test all pairwise overlaps, or the name of one element of the 'sets' list. If the name of one element of 'sets' is provided, overlaps will be calculated only with that one signature.

Details

The hard work in this code is is by John Blischak from the blog post on efficient calculation of pairwise overlaps between list elements at https://blog.jdblischak.com/posts/pairwise-overlaps/. See that page for definitions of overlap and jaccard. This function adds a few columns, an option to calculate pairwise overlaps with one list element only, and documentation.

Value

a 'data.frame' with one row per pairwise overlap calculated, and colnames:

name1 name2 length_set1 length_set2 length_union length_intersection overlap jaccard

Examples

testlist <- list(a = 1:3, b = 3, c = 3:4)
(all <- calcPairwiseOverlaps(testlist))
calcPairwiseOverlaps(testlist, targetset = "b")
##
## Calculate overlaps between existing signatures with one additional signature
testlist <- c(testlist, d = list(4:5))
calcPairwiseOverlaps(testlist, targetset = "d")


waldronlab/BugSigDBStats documentation built on Oct. 21, 2023, 6:11 a.m.