Mercurial > repos > mingchen0919 > tripal_db_explorer
changeset 0:b2d25344377d draft
planemo upload
author | mingchen0919 |
---|---|
date | Sun, 18 Mar 2018 17:06:04 -0400 |
parents | |
children | 7ab543623d03 |
files | get_content_types.Rmd get_content_types.xml get_content_types_render.R |
diffstat | 3 files changed, 126 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get_content_types.Rmd Sun Mar 18 17:06:04 2018 -0400 @@ -0,0 +1,30 @@ +--- +title: 'HTML report title' +output: + html_document: + number_sections: true + toc: true + theme: cosmo + highlight: tango + code_folding: hide +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = TRUE, + error = TRUE +) +``` + + +# Code for computational analysis + +```{r 'step 1'} + +``` + +```{r 'ste[ 2'} + +``` + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get_content_types.xml Sun Mar 18 17:06:04 2018 -0400 @@ -0,0 +1,45 @@ +<tool id="get_content_types" name="Get content types" version="1.0.0"> + <description>Tripal database explorer: get content types
 + </description> + <requirements> + <requirement type="package" version="1.15.0.6-0">pandoc</requirement><requirement type="package" version="1.20.0">r-getopt</requirement><requirement type="package" version="1.6">r-rmarkdown</requirement><requirement type="package" version="1.5">r-jsonlite</requirement><requirement type="package" version="0.2">r-dt</requirement><requirement type="package" version="1.2.1">r-tidyverse</requirement></requirements> + <stdio> + <regex match="XXX" source="stderr" level="warning" description="Check the warnings_and_errors.txt file for more details."/></stdio> + <command><![CDATA[ + export TOOL_DIRECTORY='${__tool_directory__}' && + + Rscript '${__tool_directory__}/rmarkdown_report_render.R' + + -e $echo + -o $report + -d $report.files_path + -s $sink_message + -t '${__tool_directory__}' + + + + ]]></command> + <inputs> + <param type="boolean" name="echo" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Display analysis code in report?"/></inputs> + <outputs> + <data format="html" name="report" label="tool report"/><data format="txt" name="sink_message" label="Warnings and Errors" from_work_dir="warnings_and_errors.txt"/></outputs> + <citations> + <citation type="bibtex"><![CDATA[ + @article{allaire2016rmarkdown, + title={rmarkdown: Dynamic Documents for R, 2016}, + author={Allaire, J and Cheng, Joe and Xie, Yihui and McPherson, Jonathan and Chang, Winston and Allen, Jeff + and Wickham, Hadley and Atkins, Aron and Hyndman, Rob}, + journal={R package version 0.9}, + volume={6}, + year={2016} + } + ]]></citation><citation type="bibtex"><![CDATA[ + @book{xie2015dynamic, + title={Dynamic Documents with R and knitr}, + author={Xie, Yihui}, + volume={29}, + year={2015}, + publisher={CRC Press} + } + ]]></citation></citations> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/get_content_types_render.R Sun Mar 18 17:06:04 2018 -0400 @@ -0,0 +1,51 @@ +##============ Sink warnings and errors to a file ============== +## use the sink() function to wrap all code within it. +##============================================================== +zz = file('warnings_and_errors.txt') +sink(zz) +sink(zz, type = 'message') + +#------------import libraries-------------------- +options(stringsAsFactors = FALSE) + +library(getopt) +library(rmarkdown) +#------------------------------------------------ + + +#------------get arguments into R-------------------- +# load helper function +source(paste0(Sys.getenv('TOOL_DIR'), '/helper.R')) +# import getopt specification matrix from a csv file +spec_csv = paste0(Sys.getenv('TOOL_DIR'), '/getopt_specification.csv') +opt = getopt(getopt_specification_matrix(spec_csv)) +opt$X_t = Sys.getenv('TOOL_DIR') +#---------------------------------------------------- + + +#-----------using passed arguments in R +# to define system environment variables--- +do.call(Sys.setenv, opt[-1]) +#---------------------------------------------------- + +#---------- often used variables ---------------- +# OUTPUT_DIR: path to the output associated directory, which stores all outputs +# TOOL_DIR: path to the tool installation directory +OUTPUT_DIR = opt$X_d +TOOL_DIR = opt$X_t +OUTPUT_REPORT = opt$X_o +RMD_NAME = '' + +# create the output associated directory to store all outputs +dir.create(OUTPUT_DIR, recursive = TRUE) + +#-----------------render Rmd-------------- +render(paste0(TOOL_DIR, '/', RMD_NAME), output_file = OUTPUT_REPORT) +#------------------------------------------ + +#==============the end============== + + +##--------end of code rendering .Rmd templates---------------- +sink() +##=========== End of sinking output============================= \ No newline at end of file