changeset 0:746b9263ec64 draft

planemo upload
author mingchen0919
date Thu, 01 Mar 2018 14:25:15 -0500
parents
children e969699f49b6
files skewer.Rmd skewer.xml skewer_render.R
diffstat 3 files changed, 133 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/skewer.Rmd	Thu Mar 01 14:25:15 2018 -0500
@@ -0,0 +1,29 @@
+---
+title: 'HTML report title'
+output:
+    html_document:
+      number_sections: true
+      toc: true
+      theme: cosmo
+      highlight: tango
+---
+
+```{r setup, include=FALSE, warning=FALSE, message=FALSE}
+knitr::opts_chunk$set(
+  echo = as.logical(), 
+  error = TRUE
+)
+```
+
+
+# Code for computational analysis
+
+```{r 'step 1'}
+
+```
+
+```{r 'ste[ 2'}
+
+```
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/skewer.xml	Thu Mar 01 14:25:15 2018 -0500
@@ -0,0 +1,54 @@
+<tool id="aurora_skewer" name="Aurora Skewer" version="1.0.0">
+  <description>A fast and accurate adapter trimmer for next-generation sequencing paired-end reads&#xD;
+    </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="0.2.2">skewer</requirement></requirements>
+  <stdio>
+        <regex match="XXX" source="stderr" level="warning" description="Check the warnings_and_errors.txt file for more details."/></stdio>
+  <command><![CDATA[
+        
+
+        Rscript '${__tool_directory__}/rmarkdown_site_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 site"/><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><citation type="bibtex"><![CDATA[@article{jiang2014skewer,
+  title={Skewer: a fast and accurate adapter trimmer for next-generation sequencing paired-end reads},
+  author={Jiang, Hongshan and Lei, Rong and Ding, Shou-Wei and Zhu, Shuifang},
+  journal={BMC bioinformatics},
+  volume={15},
+  number={1},
+  pages={182},
+  year={2014},
+  publisher={BioMed Central}
+}]]></citation></citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/skewer_render.R	Thu Mar 01 14:25:15 2018 -0500
@@ -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--------------------
+# getopt_specification_matrix(extract_short_flags('fastqc_report.xml')) %>%
+#   write.table(file = 'spec.txt', sep = ',', row.names = FALSE, col.names = TRUE, quote = FALSE)
+
+
+spec_matrix = as.matrix()
+opt = getopt(spec_matrix)
+#----------------------------------------------------
+
+
+#-----------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 = ''
+TOOL_DIR =   ''
+RMD_NAME = ''
+
+# create the output associated directory to store all outputs
+dir.create(OUT_DIR, recursive = TRUE)
+
+#-----------------render Rmd--------------
+render(paste0(TOOL_DIR, RMD_NAME, sep = '/'), OUTPUT_DIR)
+#------------------------------------------
+
+#==============the end==============
+
+
+##--------end of code rendering .Rmd templates----------------
+sink()
+##=========== End of sinking output=============================
\ No newline at end of file