datapplab / pathview

pathway based data integration and visualization
37 stars 16 forks source link

Is there a way to save pathview results to a custom directory? #11

Closed eggrandio closed 2 years ago

eggrandio commented 2 years ago

As the title says, is there a way of giving a name and/or output directory to pathview? Or does it always download and generate the png files in the current directory?

TylerSagendorf commented 2 years ago

As the title says, is there a way of giving a name and/or output directory to pathview? Or does it always download and generate the png files in the current directory?

I don't think there is an option to change the directory, but you can move the png files yourself:

old_dir <- "path/to/png/files"
new_dir <- "new/path/for/files"
old_files <- list.files(path = old_dir, pattern = "png", full.names = T)
new_files <- sub(old_dir, new_dir, old_files)
file.rename(from = old_files, to = new_files) # move files

If you have other png files in the same directory that you don't want to move, use a different regular expression for pattern in list.files.

wluo1 commented 2 years ago

All pathway data are downloaded to the directory specified by argument kegg.dir. pathview always check in kegg.dir for existing pathway data and retrieve the data from there. when the data needed does not exist in kegg.dir, it will download the data from KEGG. see the details in pathview function documentation as below. "kegg.dir: character, the directory of KEGG pathway data file (.xml) and image file (.png). Users may supply their own data files in the same format and naming convention of KEGG's (species code

All the result pathway graphs are written into the current working directory.