getJaccard.Rd
Computes Jaccard Similarity between two sets, x1 and x2.
getJaccard(x1, x2, assert.unique = T)
set 1
set 2
Logical flag specifying whether to ensure that x1 and x2 are unique. Default is TRUE.
Jaccard similarity score (numeric)
pheatmap
# compute jaccard similarity matrix for (named) list of genesets.
n.sets <- length(gene.sets)
#> Error in eval(expr, envir, enclos): object 'gene.sets' not found
j.mat <- matrix(nrow = n.sets, ncol = n.sets)
#> Error in matrix(nrow = n.sets, ncol = n.sets): object 'n.sets' not found
for (i in 1:n.sets){
for (j in 1:n.sets){
i.name <- names(gene.sets)[i]
j.name <- names(gene.sets)[j]
j.mat[i, j] <- getJaccard(gene.sets[[i.name]], gene.sets[[j.name]])
}
}
#> Error in eval(expr, envir, enclos): object 'n.sets' not found
# assign row and col names
rownames(j.mat) <- names(gene.sets)
#> Error in eval(expr, envir, enclos): object 'gene.sets' not found
colnames(j.mat) <- names(gene.sets)
#> Error in eval(expr, envir, enclos): 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