stephenturner / annotables

R data package for annotating/converting Gene IDs
http://www.gettinggeneticsdone.blogspot.com/2015/11/annotables-convert-gene-ids.html
160 stars 34 forks source link

Autogenerate data documentation #9

Closed aaronwolen closed 7 years ago

aaronwolen commented 7 years ago

Manually writing/updating documentation files... are we animals? 😉

This adds a (unexported) function, document_annotable(), that uses mustache-based templates (located in inst/templates) and annotable recipes to generate R scripts in R/ containing (hopefully) all relevant documentation info for a table.

Note, this adds whisker as a suggested dependency.

stephenturner commented 7 years ago

wow. what sort of wizardry is this? It took me longer to write all the documentation files than it did to create the data. This is great. Two things on reviewing:

Map(document_annotable, recipes, names(recipes), type = "gene")
 Error in system.file("inst/templates", paste0(type, ".R"), package = "annotables",  : 
  no file found 
aaronwolen commented 7 years ago

Whoops, that's my fault. The problem is document_annotable() is actually an annotables function so the annotables package needs to be loaded for it to work (sourcing utils.R won't be sufficient).

I didn't hit this error because I was using devtools to load the package (devtools::load_all(), or ⌘+shift+L in Rstudio) before running the script.

In short, we can fix this by updating build-annotables.R to include devtools::load_all() or assume an updated annotables is installed and add library(annotables).

I believe the latter is the less janky solution.

stephenturner commented 7 years ago

slick. merged, and added the load_all in 54b18cd5213cba6b3b87c47e03c71f16cb22746c