Skip to content

Instantly share code, notes, and snippets.

@kozo2
Last active September 17, 2015 05:50
Show Gist options
  • Select an option

  • Save kozo2/5db54924d81e38429968 to your computer and use it in GitHub Desktop.

Select an option

Save kozo2/5db54924d81e38429968 to your computer and use it in GitHub Desktop.
library(pathview)
library(stringr)
dopathview <- function(csvfilepath, pathwayid) {
df <- read.csv(csvfilepath)
keggdf <- df[!is.na(df$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]])))
}
pv.out <- pathview(cpd.data = log2list, pathway.id = pathwayid, species = "ath", out.suffix = "atmet.cpd", kegg.native = T)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment