library(keggrest) find_organism <- function(compounds) { organism <- NULL for (i in compounds) { tryCatch({ res <- kegg_search(i)$org }, warning = function(warn) { res <- NULL }) organism <- append(organism, res) } organism <- unique(organism) }
function that: library(msigdb) msig_genes <- function(msig, db=GREAT_HG19) { genes <- NULL for (i in msig) { tryCatch({ res <- db[i]$genes }, warning = function(warn) { res <- NULL }) genes <- append(genes, res) } return(genes) }