map_to_genes <- function(dt,genesdt,groupid){
data.table::setkey(dt,chr,start,end)
data.table::setkey(genesdt,chr,start,end)
geneDT <- data.table::foverlaps(dt,genesdt,nomatch = 0)[order(gene)][,.(group=groupid,gene=unique(gene))]
return(geneDT)
}
map_stats_to_genes <- function(stats=list('s1','s2'),
genes){
mapped_stats <- rbindlist(lapply(seq_along(stats), function(y, n, i) map_to_genes(dt=y[[i]],genesdt=genes,groupid=n[[i]]), y=stats, n=names(stats)))
return(mapped_stats)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.