Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active September 16, 2015 06:30
Show Gist options
  • Save kozo2/291e966c901af39c57dc to your computer and use it in GitHub Desktop.
Save kozo2/291e966c901af39c57dc to your computer and use it in GitHub Desktop.
library(pathview)
library(stringr)
library(KEGGREST)
foo <- read.csv("foo.csv")
keggdf <- foo[!is.na(foo$kegg),]
cpdlist <- str_split(keggdf$kegg, "\\|")
log2list <- c()
for (i in 1:length(cpdlist)) {
log2list <- c(log2list, setNames(rep(keggdf$log2FC[i], length(cpdlist[[i]])), toupper(cpdlist[[i]])))
}
pathwayIDfor <- keggLink("pathway", log2list)
# find the most mapped pathwayID
hitslist <- c()
for (i in unique(pathwayIDfor)) {
hits <- match(i, pathwayIDfor)
}
sim.cpd.data=sim.mol.data(mol.type="cpd", nmol=3000)
pv.out <- pathview(cpd.data = sim.cpd.data, pathway.id = "00020", species = "hsa", out.suffix = "sim.cpd", kegg.native = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment