I came across a weird issue when trying to use hyp_to_rmd - the file_path argument can take a plain file name or an absolute path, but not a relative path:
> library(hypeR)
> library(tidyverse)
#deleted for space
> load(file.path(system.file("extdat", package="hyperworkshop"), "limma.rda"))
> genesets <- msigdb_gsets("Homo sapiens", "C2", "CP:KEGG")
> signature <- signature <- limma %>%
+ dplyr::filter(t > 0 & fdr < 0.001) %>%
+ magrittr::use_series(symbol)
> hyp_obj <- hypeR(signature, genesets, test="hypergeometric", background=50000, fdr=0.01, plotting=TRUE)
> hyp_to_rmd(hyp_obj,
+ file_path="hypeR.rmd")
processing file: hypeR.rmd
# deleted for space
Output created: hypeR.rmd.html
> getwd()
[1] "C:/Users/jenny/"
> dir.create("test")
> hyp_to_rmd(hyp_obj,
+ file_path="test/hypeR.rmd")
Error: The directory 'test' does not not exist.
> hyp_to_rmd(hyp_obj,
+ file_path="C:/Users/jenny/test/hypeR.rmd")
processing file: hypeR.rmd
# deleted for space
Output created: hypeR.rmd.html
I did some debugging and the problem occurs in rmarkdown::render(). It wants output directory separate from the file name and does weird things like calling setwd(dirname(abs_path(input))) so you can't put relative paths in hyp_to_rmd(file_path = ). Easiest thing to do would be to add a warning in the help file, which also should say that file_path needs to end in .rmd or it won't be rendered properly:
One final request: could you strip off the .rmd when creating the html file name? I am used to having hypeR.rmd and the rendered hypeR.html and hypeR.rmd.html is just clunky. Thanks!
I came across a weird issue when trying to use
hyp_to_rmd
- thefile_path
argument can take a plain file name or an absolute path, but not a relative path:I did some debugging and the problem occurs in
rmarkdown::render()
. It wants output directory separate from the file name and does weird things like callingsetwd(dirname(abs_path(input)))
so you can't put relative paths inhyp_to_rmd(file_path = )
. Easiest thing to do would be to add a warning in the help file, which also should say thatfile_path
needs to end in .rmd or it won't be rendered properly:One final request: could you strip off the .rmd when creating the html file name? I am used to having hypeR.rmd and the rendered hypeR.html and hypeR.rmd.html is just clunky. Thanks!