Commit 06788fa7 authored by Holger Brandl's avatar Holger Brandl

added workaround for invalid pathway ids

parent 19d31786
......@@ -438,7 +438,7 @@ load_pack(png)
plot_pathway <- function(pathwayID, sliceData){
# pathwayID="mmu04015"; sliceData <- sliceData
# pathwayID="mmu05216"; sliceData <- sliceData
# pathwayID="mmu04723"; sliceData <- sliceData
# pathwayID="mmu01230"; sliceData <- sliceData
# browser()
# echo("processing pathway", pathwayID)
pv.out <- pathview(
......@@ -458,6 +458,7 @@ plot_pathway <- function(pathwayID, sliceData){
if (is.numeric(pv.out) && pv.out == 0) return(pathwayID) ## happens if pathview fails to parse xml e.g. for mmu01100
outfile <- paste0(pathwayID, ".pathview", ifelse(ncol(sliceData) > 1, ".multi", ""), ".png")
if(!file.exists(outfile)) return(pathwayID) # seems to happen for generic non-pathways such as mmu01230,mmu01200,mmu01210
## move pathway plots into figures sub-directory
figuresPlotFile <- file.path(pwPlotDir, outfile)
......@@ -478,8 +479,6 @@ plot_pathway <- function(pathwayID, sliceData){
#keggPathways <- c("mmu00830")
capture.output
#+ echo=FALSE, warning=FALSE, eval=hasEnrPathways
pathwayPlots <- keggPathways %>%
# head(3) %>%
......@@ -492,6 +491,9 @@ map(function(pathwayID){
#save(pathwayPlots, file=".pathwayPlots.RData")
# pathwayPlots <- local(get(load(".pathwayPlots.RData")))
session::save.session(".cp_pathways.dat");
# session::restore.session(".cp_pathways.dat");
## remove and report failed ones
failedPPs <- pathwayPlots[lapply(pathwayPlots, is.character) > 0]
......@@ -499,6 +501,9 @@ echo("the following pathways failed to render:", paste(failedPPs, collapse = ",
pathwayPlots <- pathwayPlots[lapply(pathwayPlots, is.character) == 0]
pathwayPlots[1]
pathwayPlots[!map_lgl(pathwayPlots, ~ file.exists(.$plotfile))] %>% map("pathway_id")
## make sure that all files exist
stopifnot(map_lgl(pathwayPlots, ~ file.exists(.$plotfile)) %>% all)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment