Mercurial > repos > mingchen0919 > tripal_db_explorer
changeset 7:7fd14296e7e0 draft
add es_gene_search
author | mingchen0919 |
---|---|
date | Mon, 19 Mar 2018 17:32:36 -0400 |
parents | 4bc7752bfd72 |
children | faddfcea253d |
files | es_gene_search.Rmd es_gene_search.csv es_gene_search.sh es_gene_search.xml es_gene_search_render.R get_content_types.xml search_contents.xml |
diffstat | 7 files changed, 158 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/es_gene_search.Rmd Mon Mar 19 17:32:36 2018 -0400 @@ -0,0 +1,27 @@ +--- +title: 'HTML report title' +output: + html_document: + theme: cosmo + highlight: tango +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = TRUE, + error = TRUE +) +``` + + +# Code for computational analysis + +```{r 'step 1'} +opt +``` + +```{r 'ste[ 2'} + +``` + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/es_gene_search.csv Mon Mar 19 17:32:36 2018 -0400 @@ -0,0 +1,5 @@ +short flag,argument mask,data type,variable name,galaxy input type,description +o,1,character,report,data, +d,1,character,report.files_path,data, +O,1,character,organism,text, +R,1,character,fasta_results,text,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/es_gene_search.sh Mon Mar 19 17:32:36 2018 -0400 @@ -0,0 +1,8 @@ +export TOOL_DIR='${__tool_directory__}' && + +Rscript '${__tool_directory__}/'es_gene_search_render.R + + -o '$report' + -d '$report.files_path' + -O '$organism' + -R '$fasta_results'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/es_gene_search.xml Mon Mar 19 17:32:36 2018 -0400 @@ -0,0 +1,39 @@ +<tool id="es_gene_search" name="tripal_db_explorer: elasticsearch" version="1.0.0"> + <description>gene search </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="3.1">r-curl</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_DIR='${__tool_directory__}' && + +Rscript '${__tool_directory__}/'es_gene_search_render.R + + -o '$report' + -d '$report.files_path' + -O '$organism' + -R '$fasta_results' +]]></command> + <inputs> + <param type="text" name="organism" label="Organism" optional="False"/><param type="text" name="search_keywords" label="Search keywords" optional="False"/></inputs> + <outputs> + <data format="html" name="report" label="tool report"/><data name="sink_message" format="txt" label="${tool.name} log" from_work_dir="warnings_and_errors.txt" hidden="false"/><data name="fasta_results" format="fasta" label="${tool.name} results" hidden="false"/></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/es_gene_search_render.R Mon Mar 19 17:32:36 2018 -0400 @@ -0,0 +1,50 @@ +##============ 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 +opt = getopt(getopt_specification_matrix('/es_gene_search.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 = 'es_gene_search.Rmd' + +# 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=============================
--- a/get_content_types.xml Mon Mar 19 16:29:51 2018 -0400 +++ b/get_content_types.xml Mon Mar 19 17:32:36 2018 -0400 @@ -1,19 +1,11 @@ -<tool id="get_content_types" name="tripal_db_explorer: resources summary" version="1.0.0"> - <description> +<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="3.1">r-curl</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_DIR='${__tool_directory__}' && + <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="3.1">r-curl</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_DIR='${__tool_directory__}' && Rscript '${__tool_directory__}/'get_content_types_render.R @@ -22,15 +14,11 @@ -s '$sink_message' -u '$web_services_root_url' ]]></command> - <inputs> - <param type="text" name="web_services_root_url" label="Web services root URL" optional="False"/> - </inputs> - <outputs> - <data name="report" format="html" label="${tool.name} report" hidden="false"/> - <data name="sink_message" format="txt" label="${tool.name} log" from_work_dir="warnings_and_errors.txt" - hidden="false"/> - </outputs> - <citations> + <inputs> + <param type="text" name="web_services_root_url" label="Web services root URL" optional="False"/></inputs> + <outputs> + <data name="report" format="html" label="${tool.name} report" hidden="false"/><data name="sink_message" format="txt" label="${tool.name} log" from_work_dir="warnings_and_errors.txt" hidden="false"/></outputs> + <citations> <citation type="bibtex"><![CDATA[ @article{allaire2016rmarkdown, title={rmarkdown: Dynamic Documents for R, 2016}, @@ -40,8 +28,7 @@ volume={6}, year={2016} } - ]]></citation> - <citation type="bibtex"><![CDATA[ + ]]></citation><citation type="bibtex"><![CDATA[ @book{xie2015dynamic, title={Dynamic Documents with R and knitr}, author={Xie, Yihui}, @@ -49,6 +36,5 @@ year={2015}, publisher={CRC Press} } - ]]></citation> - </citations> + ]]></citation></citations> </tool>
--- a/search_contents.xml Mon Mar 19 16:29:51 2018 -0400 +++ b/search_contents.xml Mon Mar 19 17:32:36 2018 -0400 @@ -1,19 +1,12 @@ -<tool id="search_contents" name="tripal_db_explorer: search" version="1.0.0"> - <description> +<tool id="search_contents" name="Search contents" version="1.0.0"> + <description> + some description </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="3.1">r-curl</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_DIR='${__tool_directory__}' && + <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="3.1">r-curl</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_DIR='${__tool_directory__}' && Rscript '${__tool_directory__}/'search_contents_render.R @@ -40,32 +33,11 @@ -l '$records_number' -r '$search_results' ]]></command> - <inputs> - <param type="text" name="content_type_url" label="Content type URL" optional="False"/> - <section name="search_section" title="Search: fields" expanded="True"> - <repeat name="search_field_repeat" title="Field paths" min="1" max="20" default="1"> - <param type="text" name="field_path" optional="False"/> - <param type="select" name="search_operator" optional="False"> - <option value="eq" selected="false">equal (string value)</option> - <option value="contains" selected="true">contains (string value)</option> - </param> - </repeat> - </section> - <section name="extract_section" title="Extract: fields" expanded="True"> - <repeat name="extract_field_repeat" title="Field paths" min="1" max="20" default="1"> - <param type="text" name="field_path" optional="False"/> - </repeat> - </section> - <param type="integer" name="records_number" label="Records number" - help="The maximum number of records to be extracted" optional="False" value="25" min="0"/> - </inputs> - <outputs> - <data name="report" format="html" label="${tool.name} report" hidden="false"/> - <data name="sink_message" format="txt" label="${tool.name} log" from_work_dir="warnings_and_errors.txt" - hidden="false"/> - <data name="search_results" format="txt" label="${tool.name} results" hidden="false"/> - </outputs> - <citations> + <inputs> + <param type="text" name="content_type_url" label="Content type URL" optional="False"/><section name="search_section" title="Search: fields" expanded="True"><repeat name="search_field_repeat" title="Field paths" min="1" max="20" default="1"><param type="text" name="field_path" optional="False"/><param type="select" name="search_operator" optional="False"><option value="eq" selected="false">equal (string value)</option><option value="contains" selected="true">contains (string value)</option></param></repeat></section><section name="extract_section" title="Extract: fields" expanded="True"><repeat name="extract_field_repeat" title="Field paths" min="1" max="20" default="1"><param type="text" name="field_path" optional="False"/></repeat></section><param type="integer" name="records_number" label="Records number" help="The maximum number of records to be extracted" optional="False" value="25" min="0"/></inputs> + <outputs> + <data name="report" format="html" label="${tool.name} report" hidden="false"/><data name="sink_message" format="txt" label="${tool.name} log" from_work_dir="warnings_and_errors.txt" hidden="false"/><data name="search_results" format="txt" label="${tool.name} results" hidden="false"/></outputs> + <citations> <citation type="bibtex"><![CDATA[ @article{allaire2016rmarkdown, title={rmarkdown: Dynamic Documents for R, 2016}, @@ -75,8 +47,7 @@ volume={6}, year={2016} } - ]]></citation> - <citation type="bibtex"><![CDATA[ + ]]></citation><citation type="bibtex"><![CDATA[ @book{xie2015dynamic, title={Dynamic Documents with R and knitr}, author={Xie, Yihui}, @@ -84,6 +55,5 @@ year={2015}, publisher={CRC Press} } - ]]></citation> - </citations> + ]]></citation></citations> </tool>