View source: R/calcPairwiseOverlaps.R
calcPairwiseOverlaps | R Documentation |
Calculate pairwise overlaps between all signatures
calcPairwiseOverlaps(sets, targetset = NULL)
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. |
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.
a 'data.frame' with one row per pairwise overlap calculated, and colnames:
name1 name2 length_set1 length_set2 length_union length_intersection overlap jaccard
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.