Computes Jaccard similarity mtrix for list of genesets

jaccardSimilarityMatrix(gene.sets, y = NULL, assert.unique = T)

Arguments

gene.sets

named list of genesets, where names specify name of gene set, and entries are character vectors specifying genes belongs to the respective set.

y

Optional second gene set. If provided, resulting matrix is gene.sets x y.

assert.unique

Logical flag specifying whether to remove duplicate entries within individual sets. Default is TRUE.

Value

Jaccard similarity matrix

See also

pheatmap

Author

Nicholas Mikolajewicz

Examples


# compute jaccard similarity matrix for (named) list of genesets.
j.mat <- jaccardSimilarityMatrix(gene.sets)
#> Loading required package: locStra
#> Warning: package 'locStra' was built under R version 4.2.1
#> Loading required package: arules
#> Warning: package 'arules' was built under R version 4.2.1
#> Loading required package: Matrix
#> 
#> Attaching package: 'Matrix'
#> The following objects are masked from 'package:tidyr':
#> 
#>     expand, pack, unpack
#> 
#> Attaching package: 'arules'
#> The following object is masked from 'package:dplyr':
#> 
#>     recode
#> The following objects are masked from 'package:base':
#> 
#>     abbreviate, write
#> Error in .class1(object): object 'gene.sets' not found

# generate heatmap
pheatmap::pheatmap(j.mat, show_colnames = F, main = "Jaccard Similarity")
#> Error in rownames(mat): object 'j.mat' not found