Mercurial > repos > mingchen0919 > aurora_skewer
changeset 8:7c9170b7d9f6 draft
planemo upload commit 5b03cf1a31307c262701d4f267972bd01be24311
author | mingchen0919 |
---|---|
date | Thu, 26 Apr 2018 13:38:15 -0400 |
parents | c5c297020c36 |
children | c0e57c994deb |
files | expose-outputs.sh getopt_specification.csv shell-script-template.sh skewer.Rmd skewer.xml skewer_render.R star.Rmd star.xml star_render.R |
diffstat | 9 files changed, 309 insertions(+), 373 deletions(-) [+] |
line wrap: on
line diff
--- a/expose-outputs.sh Thu Apr 26 12:49:35 2018 -0400 +++ b/expose-outputs.sh Thu Apr 26 13:38:15 2018 -0400 @@ -2,16 +2,5 @@ cd ${REPORT_FILES_PATH} # copy outputs from tool outputs directory to corresponding galaxy output path -cp skewer.html ${REPORT} - -if [ -e trim-trimmed-pair1.fastq ]; then - cp trim-trimmed-pair1.fastq ${X_1} -fi - -if [ -e trim-trimmed-pair2.fastq ]; then - cp trim-trimmed-pair2.fastq ${X_2} -fi - -if [ -e trim-trimmed.fastq ]; then - cp trim-trimmed.fastq ${X_3} -fi +cp star.html ${REPORT} +cp Aligned.out.sorted.bam ${X_S} \ No newline at end of file
--- a/getopt_specification.csv Thu Apr 26 12:49:35 2018 -0400 +++ b/getopt_specification.csv Thu Apr 26 13:38:15 2018 -0400 @@ -1,27 +1,9 @@ -short flag,argument mask,data type,variable name -o,1,character,report -d,1,character,report.files_path -A,1,character,first_reads -B,1,character,second_reads -x,1,character,adapter_first_reads -y,1,character,adapter_second_reads -m,1,character,trimming_mode -r,1,character,maximum_allowed_error_rate -D,1,character,maximum_allowed_indel_error_rate -q,1,character,quality_trimming_3_end -Q,1,character,mean_quality -l,1,character,minimum_read_length -j,1,character,advanced_options.junction_adapter -M,1,character,advanced_options.tab_adapter -b,1,character,advanced_options.barcode -c,1,character,advanced_options.cut -n,1,character,advanced_options.filter_degenerative_reads -u,1,character,advanced_options.filter_undetermined_mate_pair_reads -f,1,character,advanced_options.format -z,1,character,advanced_options.compress -E,1,character,advanced_options.qiime -F,1,character,advanced_options.quiet -i,1,character,advanced_options.intelligent -1,1,character,trimmed_r1 -2,1,character,trimmed_r2 -3,1,character,trimmed_s \ No newline at end of file +short flag,argument mask,data type,variable name +o,1,character,report +d,1,character,report.files_path +A,1,character,genomeFastaFiles +B,1,character,sjdbGTFfile +C,1,character,sjdbOverhang +F,1,character,first_reads +R,1,character,second_reads +S,1,character,sorted_bam \ No newline at end of file
--- a/shell-script-template.sh Thu Apr 26 12:49:35 2018 -0400 +++ b/shell-script-template.sh Thu Apr 26 13:38:15 2018 -0400 @@ -1,48 +1,47 @@ -# SHELL_SCRIPT file name -SHELL_SCRIPT='skewer.sh' - # run SHELL_SCRIPT within tool outputs directory cd ${REPORT_FILES_PATH} -# build job-script.sh +#--------- index genome -------- +# create genome directory for genome indexes +mkdir -p ${X_d}/genomeDir + cat >temp.sh <<EOF -skewer \\ - ${X_A} \\ - ${X_B} \\ - -x ${X_x} \\ - -y ${X_y} \\ - -m ${X_m} \\ - -r ${X_r} \\ - -d ${X_D} \\ - -q ${X_q} \\ - -Q ${X_Q} \\ - -l ${X_l} \\ - -j ${X_j} \\ - -M ${X_M} \\ - -b ${X_b} \\ - -c ${X_b} \\ - -n ${X_n} \\ - -u ${X_u} \\ - -f ${X_f} \\ - -z ${X_z} \\ - -qiime ${X_E} \\ - -quiet ${X_F} \\ - -i ${X_i} \\ - -o trim > /dev/null 2>&1 +STAR \\ + --runMode genomeGenerate \\ + --genomeDir ${X_d}/genomeDir \\ + --genomeFastaFiles $( echo ${X_A} | sed 's/,/ /g' ) \\ + --sjdbGTFfile ${X_B} \\ + --sjdbOverhang ${X_C} \\ + > /dev/null 2>&1 EOF -# remove empty input lines -grep -v '\-M \\' temp.sh |\ - grep -v 'None' |\ - grep -v 'NO_ARGUMENT_NO' |\ - sed 's/NO_ARGUMENT_YES//g' > ${SHELL_SCRIPT} +grep -v None temp.sh > index-genome.sh + +# run star +sh index-genome.sh +#---- mapping --------- +cat >temp.sh <<EOF +STAR \\ + --genomeDir ${X_d}/genomeDir \\ + --readFilesIn \\ + ${X_F} \\ + ${X_R} \\ + > /dev/null 2>&1 +EOF + +grep -v None temp.sh > mapping.sh + +# run mapping +sh mapping.sh + +# remove temp.sh rm temp.sh -# run SHELL_SCRIPT -sh ${SHELL_SCRIPT} +#----- SAM to sorted BAM ------ +echo "samtools sort -o Aligned.out.sorted.bam Aligned.out.sam" > sam2bam.sh +sh sam2bam.sh -# rename log file -if [ -e trim-trimmed.log ]; then - cp trim-trimmed.log trim-trimmed.txt -fi \ No newline at end of file +#----- evaluate mapping ------- +echo "samtools flagstat Aligned.out.sorted.bam > flagstat.txt" > flagstat.sh +sh flagstat.sh
--- a/skewer.Rmd Thu Apr 26 12:49:35 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ ---- -title: 'Skewer report' -output: - html_document: - highlight: pygments ---- - -```{r setup, include=FALSE, warning=FALSE, message=FALSE} -knitr::opts_knit$set(progress = FALSE) -knitr::opts_chunk$set(error = TRUE, echo = FALSE) -``` - -```{r, echo=FALSE} -# to make the css theme to work, <link></link> tags cannot be added directly -# as <script></script> tags as below. -# it has to be added using a code chunk with the htmltool functions!!! -css_link = tags$link() -css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css") -css_link -``` - -```{r, eval=FALSE, echo=FALSE} -# this code chunk is purely for adding comments -# below is to add jQuery and jstree javascripts -``` -<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> -<script src="vakata-jstree-3.3.5/dist/jstree.min.js"></script> - -```{r, eval=FALSE, echo=FALSE} -# this code chunk is purely for adding comments -# javascript code below is to build the file tree interface -# see this for how to implement opening hyperlink: https://stackoverflow.com/questions/18611317/how-to-get-i-get-leaf-nodes-in-jstree-to-open-their-hyperlink-when-clicked-when -``` -<script> - $(function () { - // create an instance when the DOM is ready - $('#jstree').jstree().bind("select_node.jstree", function (e, data) { - window.open( data.node.a_attr.href, data.node.a_attr.target ) - }); - }); -</script> - -```{css} -# code chunks scrollable -pre code, pre, code { - white-space: pre !important; - overflow-x: scroll !important; - word-break: keep-all !important; - word-wrap: initial !important; -} -``` ------------------------------------------ - -## Job script - -```{bash echo=FALSE} -sh ${TOOL_INSTALL_DIR}/shell-script-template.sh -``` - -```{r echo=FALSE,warning=FALSE,results='asis'} -# display content of the job-script.sh file. -cat('```bash\n') -cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/skewer.sh')), sep = '\n') -cat('\n```') -``` - - ------------------------------------------ -## Output - -```{r, echo=FALSE} -# create a div container to store the file tree interface -tags$div( - id="jstree", - file_tree(Sys.getenv('REPORT_FILES_PATH')) -) -``` -
--- a/skewer.xml Thu Apr 26 12:49:35 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -<tool id="aurora_skewer" name="aurora_skewer" version="2.0.0"> - <description>A fast and accurate adapter trimmer for next-generation sequencing single or paired end reads. - </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[ - - ######### each aurora tool generates a html file and have an files path directory associated with it. - mkdir -p $report.files_path && - - ######### three important paths: - ######### 1. path to tool installation directory - ######### 2. path to report html - ######### 3. path to files_path directory associated with the report output. - export TOOL_INSTALL_DIR='${__tool_directory__}' && - export REPORT='$report' && - export REPORT_FILES_PATH='$report.files_path' && - - ############ create a hidden file to store r markdown rendering log - touch $report.files_path/.r_rendering.log.txt && - -Rscript '${__tool_directory__}/'skewer_render.R - - -o '$report' - -d '$report.files_path' - -A '$first_reads' - -B '$second_reads' - -x '$adapter_first_reads' - -y '$adapter_second_reads' - -m '$trimming_mode' - -r '$maximum_allowed_error_rate' - -D '$maximum_allowed_indel_error_rate' - -q '$quality_trimming_3_end' - -Q '$mean_quality' - -l '$minimum_read_length' - -j '$advanced_options.junction_adapter' - -M '$advanced_options.tab_adapter' - -b '$advanced_options.barcode' - -c '$advanced_options.cut' - -n '$advanced_options.filter_degenerative_reads' - -u '$advanced_options.filter_undetermined_mate_pair_reads' - -f '$advanced_options.format' - -z '$advanced_options.compress' - -E '$advanced_options.qiime' - -F '$advanced_options.quiet' - -i '$advanced_options.intelligent' - -1 '$trimmed_r1' - -2 '$trimmed_r2' - -3 '$trimmed_s' -]]></command> - <inputs> - <param type="data" name="first_reads" label="First reads" optional="False" format="fastq,fastqsanger" - multiple="False"/> - <param type="data" name="second_reads" label="Second reads" - help="If it is single end reads, ignore this input field and use the "first reads" field only." - optional="True" format="fastq,fastqsanger" multiple="False"/> - <param type="data" name="adapter_first_reads" argument="-x" label="Adapter sequence/file for the first reads." - optional="True" format="fasta,fa" multiple="False"/> - <param type="data" name="adapter_second_reads" argument="-y" label="Adapter sequence/file for the second reads" - optional="True" format="fasta,fa" multiple="False"/> - <param type="select" name="trimming_mode" argument="-m" label="trimming mode" optional="False" multiple="False"> - <option value="None" selected="true">--select a model--</option> - <option value="head" selected="false">5’ end trimming (single end reads)</option> - <option value="tail" selected="false">3’ end trimming (single end reads)</option> - <option value="any" selected="false">anywhere adapter detection and trimming (single end reads)</option> - <option value="pe" selected="false">paired-end trimming</option> - <option value="mp" selected="false">mate-pair trimming</option> - <option value="ap" selected="false">amplicon trimming</option> - </param> - <param type="float" name="maximum_allowed_error_rate" argument="-r" label="Maximum allowed error rate" - optional="False" value="0.1" min="0" max="0.5"/> - <param type="float" name="maximum_allowed_indel_error_rate" argument="-d" - label="Maximum allowed indel error rate" - help="The valid range of indel error rate is [0, maximum allowed error rate]" optional="False" - value="0.03" min="0"/> - <param type="integer" name="quality_trimming_3_end" argument="-q" label="3’ end quality trimming" - optional="False" value="0"/> - <param type="integer" name="mean_quality" argument="-Q" label="Reads filtering by average quality" - optional="False" value="0"/> - <param type="integer" name="minimum_read_length" argument="-l" - label="Minimum read length allowed after trimming" optional="False" value="18"/> - <section name="advanced_options" title="Advanced options" expanded="False"> - <param type="data" name="junction_adapter" argument="-j" - label="Junction adapter sequence/file for Nextera Mate Pair reads" optional="True" format="fasta,fa" - multiple="False"/> - <param type="text" name="tab_adapter" argument="-M" - label="TAB delimited file indicates valid forward/reverse adapter pairing" optional="True"/> - <param type="boolean" name="barcode" argument="-b" - label="Whether to demultiplex reads according to adapters/primers" optional="False" checked="False" - truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="text" name="cut" argument="-c" - label="To hard clip off the 5’ leading bases of the forward primer and reverse primer respectively as the barcodes in amplicon mode" - optional="False" value="0, 0"/> - <param type="boolean" name="filter_degenerative_reads" argument="-n" - label="Whether to filter out highly degenerative reads" optional="False" checked="False" - truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="boolean" name="filter_undetermined_mate_pair_reads" argument="-u" - label="Whether to filter out undetermined mate-pair reads" optional="False" checked="False" - truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="select" name="format" argument="-f" label="Format of FASTQ quality value" optional="False" - multiple="False"> - <option value="sanger" selected="false">sanger</option> - <option value="solexa" selected="false">solexa</option> - <option value="auto" selected="true">auto</option> - </param> - <param type="boolean" name="compress" argument="-z" label="Whether to compress output in GZIP format" - optional="False" truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="boolean" name="qiime" argument="-qiime" label="Whether to prepare files required by QIIME" - optional="False" truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="boolean" name="quiet" argument="--quiet" label="Whether in quiet mode" optional="False" - truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - <param type="boolean" name="intelligent" argument="-i" label="Whether to intelligently redistribute reads" - optional="False" checked="False" truevalue="NO_ARGUMENT_YES" falsevalue="NO_ARGUMENT_NO"/> - </section> - </inputs> - <outputs> - <data name="report" format="html" label="${tool.name} report on ${on_string}" hidden="false"/> - <data name="trimmed_r1" format="fastq" label="${tool.name} trimmed first reads on ${on_string}" hidden="false"/> - <data name="trimmed_r2" format="fastq" label="${tool.name} trimmed second reads on ${on_string}" - hidden="false"/> - <data name="trimmed_s" format="fastq" label="${tool.name} trimmed single end reads on ${on_string}" - hidden="false"/> - </outputs> - <help> - <![CDATA[Read the `tool manual <http://download2.nust.na/pub4/sourceforge/s/project/sk/skewer/skewer_manual.pdf>`_ if you are not sure what parameter values to use.]]></help> - <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>
--- a/skewer_render.R Thu Apr 26 12:49:35 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -##============ Sink warnings and errors to a file ============== -## use the sink() function to wrap all code within it. -##============================================================== -zz = file(paste0(Sys.getenv('REPORT_FILES_PATH'), '/.r_rendering.log.txt')) -sink(zz) -sink(zz, type = 'message') - -#============== preparation ==================================== -options(stringsAsFactors = FALSE) -# import libraries -#------------------------------------------------------------------ -# ADD MORE LIBRARIES HERE IF YOUR TOOL DEPENDS ON OTHER R LIBRARIES -#------------------------------------------------------------------ -library('getopt') -library('rmarkdown') -library('htmltools') - - -# load helper functions -source(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/helper.R')) -# import getopt specification matrix from a csv file -opt = getopt(getopt_specification_matrix('getopt_specification.csv', - tool_dir=Sys.getenv('TOOL_INSTALL_DIR'))) -# define environment variables for all input values. this is useful when we -# want to use input values by other programming language in r markdown -do.call(Sys.setenv, opt[-1]) -#=============================================================== - - -#======================== render Rmd files ========================= -# NOTICE: -# we should copy all rmarkdown files from tool install directory to REPORT_FILES_PATH directory. -# and render rmarkdown files in the REPORT_FILES_PATH directory. -file.copy(from = paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/vakata-jstree-3.3.5'), - to = Sys.getenv('REPORT_FILES_PATH'), recursive = TRUE) -system(command = 'cp -r ${TOOL_INSTALL_DIR}/*.Rmd ${REPORT_FILES_PATH}') - -#----------------BELOW IS WHERE YOU NEED TO CUSTOMIZE --------------------- -render(input = paste0(Sys.getenv('REPORT_FILES_PATH'), '/skewer.Rmd')) -# add more lines below if there are more Rmd files to be rendered - -#=============================================================== - - -#============== expose outputs to galaxy history =============== -system(command = 'sh ${TOOL_INSTALL_DIR}/expose-outputs.sh') -#=============================================================== - - -##--------end of code rendering .Rmd templates---------------- -sink() -##=========== End of sinking output============================= \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star.Rmd Thu Apr 26 13:38:15 2018 -0400 @@ -0,0 +1,117 @@ +--- +title: 'STAR: RNA-Seq aligner' +output: + html_document: + highlight: pygments +--- + +```{css echo=FALSE} +pre code, pre, code { + white-space: pre !important; + overflow-x: scroll !important; + word-break: keep-all !important; + word-wrap: initial !important; +} +``` + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_knit$set(progress = FALSE) +knitr::opts_chunk$set(error = TRUE, echo = FALSE) +``` + +```{r, echo=FALSE} +# to make the css theme to work, <link></link> tags cannot be added directly +# as <script></script> tags as below. +# it has to be added using a code chunk with the htmltool functions!!! +css_link = tags$link() +css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css") +css_link +``` + +```{r, eval=FALSE, echo=FALSE} +# this code chunk is purely for adding comments +# below is to add jQuery and jstree javascripts +``` +<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> +<script src="vakata-jstree-3.3.5/dist/jstree.min.js"></script> + +```{r, eval=FALSE, echo=FALSE} +# this code chunk is purely for adding comments +# javascript code below is to build the file tree interface +# see this for how to implement opening hyperlink: https://stackoverflow.com/questions/18611317/how-to-get-i-get-leaf-nodes-in-jstree-to-open-their-hyperlink-when-clicked-when +``` +<script> + $(function () { + // create an instance when the DOM is ready + $('#jstree').jstree().bind("select_node.jstree", function (e, data) { + window.open( data.node.a_attr.href, data.node.a_attr.target ) + }); + }); +</script> +----------------------------------------- + + +## Job scripts + +```{bash, echo=FALSE} +sh ${TOOL_INSTALL_DIR}/shell-script-template.sh +``` + +### Index genome + +```{r echo=FALSE,results='asis'} +# display content of the job-script.sh file. +cat('```bash\n') +cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/index-genome.sh')), sep = '\n') +cat('\n```') +``` + +### Mapping + +```{r echo=FALSE,results='asis'} +# display content of the job-script.sh file. +cat('```bash\n') +cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/mapping.sh')), sep = '\n') +cat('\n```') +``` + +### SAM to sorted BAM + +```{r echo=FALSE,warning=FALSE,results='asis'} +# display content of the job-script.sh file. +cat('```bash\n') +cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/sam2bam.sh')), sep = '\n') +cat('\n```') +``` + +### Mapping evaluation + +```{r echo=FALSE,warning=FALSE,results='asis'} +# display content of the job-script.sh file. +cat('```bash\n') +cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/flagstat.sh')), sep = '\n') +cat('\n```') +``` + + +### Mapping evaluation results + +```{r echo=FALSE,warning=FALSE,results='asis'} +# display content of the job-script.sh file. +cat('```bash\n') +cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/flagstat.txt')), sep = '\n') +cat('\n```') +``` + + +----------------------------------------- +## Output + +```{r, echo=FALSE} +# create a div container to store the file tree interface +tags$div( + id="jstree", + file_tree(Sys.getenv('REPORT_FILES_PATH')) +) +``` +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star.xml Thu Apr 26 13:38:15 2018 -0400 @@ -0,0 +1,92 @@ +<tool id="aurora_star" name="aurora_star" version="2.0.0"> + <description>ultrafast universal RNA-seq aligner
 + </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="2.5.4a">star</requirement> + <requirement type="package" version="1.7">samtools</requirement> + </requirements> + <stdio> + <regex match="XXX" source="stderr" level="warning" + description="Check the warnings_and_errors.txt file for more details."/> + </stdio> + <command><![CDATA[ + + ######### each aurora tool generates a html file and have an files path directory associated with it. + mkdir -p $report.files_path && + + ######### three important paths: + ######### 1. path to tool installation directory + ######### 2. path to report html + ######### 3. path to files_path directory associated with the report output. + export TOOL_INSTALL_DIR='${__tool_directory__}' && + export REPORT='$report' && + export REPORT_FILES_PATH='$report.files_path' && + + ############ create a hidden file to store r markdown rendering log + touch $report.files_path/.r_rendering.log.txt && + + + Rscript '${__tool_directory__}/star_render.R' + + + -o $report + -d $report.files_path + + + -A '$genomeFastaFiles' + -B '$sjdbGTFfile' + -C '$sjdbOverhang' + -F '$first_reads' + -R '$second_reads' + -S '$sorted_bam']]></command> + <inputs> + <param type="data" name="first_reads" label="First reads" optional="False" format="fastq,fastqsanger"/> + <param type="data" name="second_reads" label="Second reads" optional="True" format="fastq,fastqsanger"/> + <param type="data" name="genomeFastaFiles" argument="--genomeFastaFiles" label="Genome fasta files" + optional="False" format="fasta,fa"/> + <param type="data" name="sjdbGTFfile" argument="--sjdbGTFfile" label="Annotated transcripts" + help="the file with annotated transcripts in the standard GTF format. STAR will extract splice junctions from this file and use them to greatly improve accuracy of the mapping. While this is optional, and STAR can be run without annotations, using annotations is highly recommended whenever they are available." + optional="True" format="gtf"/> + <param type="integer" name="sjdbOverhang" argument="--sjdbOverhang" label="sjdbOverhang" + help="the length of the genomic sequence around the annotated junction to be used in constructing the splice junctions database. Ideally, this length should be equal to the ReadLength-1, where ReadLength is the length of the reads. For instance, for Illumina 2x100b paired-end reads, the ideal value is 100-1=99. In case of reads of varying length, the ideal value is max(ReadLength)-1. In most cases, a generic value of 100 will work as well as the ideal value." + optional="False" value="100" min="1"/> + </inputs> + <outputs> + <data name="report" format="html" label="${tool.name} report on ${on_string}"/> + <data name="sorted_bam" format="bam" label="${tool.name} sorted bam on ${on_string}"/> + </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{dobin2013star, + title={STAR: ultrafast universal RNA-seq aligner}, + author={Dobin, Alexander and Davis, Carrie A and Schlesinger, Felix and Drenkow, Jorg and Zaleski, Chris and Jha, Sonali and Batut, Philippe and Chaisson, Mark and Gingeras, Thomas R}, + journal={Bioinformatics}, + volume={29}, + number={1}, + pages={15--21}, + year={2013}, + publisher={Oxford University Press} +}]]></citation> + </citations> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star_render.R Thu Apr 26 13:38:15 2018 -0400 @@ -0,0 +1,52 @@ +##============ Sink warnings and errors to a file ============== +## use the sink() function to wrap all code within it. +##============================================================== +zz = file(paste0(Sys.getenv('REPORT_FILES_PATH'), '/.r_rendering.log.txt')) +sink(zz) +sink(zz, type = 'message') + +#============== preparation ==================================== +options(stringsAsFactors = FALSE) +# import libraries +#------------------------------------------------------------------ +# ADD MORE LIBRARIES HERE IF YOUR TOOL DEPENDS ON OTHER R LIBRARIES +#------------------------------------------------------------------ +library('getopt') +library('rmarkdown') +library('htmltools') + + +# load helper functions +source(paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/helper.R')) +# import getopt specification matrix from a csv file +opt = getopt(getopt_specification_matrix('getopt_specification.csv', + tool_dir=Sys.getenv('TOOL_INSTALL_DIR'))) +# define environment variables for all input values. this is useful when we +# want to use input values by other programming language in r markdown +do.call(Sys.setenv, opt[-1]) +#=============================================================== + + +#======================== render Rmd files ========================= +# NOTICE: +# we should copy all rmarkdown files from tool install directory to REPORT_FILES_PATH directory. +# and render rmarkdown files in the REPORT_FILES_PATH directory. +file.copy(from = paste0(Sys.getenv('TOOL_INSTALL_DIR'), '/vakata-jstree-3.3.5'), + to = Sys.getenv('REPORT_FILES_PATH'), recursive = TRUE) +system(command = 'cp -r ${TOOL_INSTALL_DIR}/*.Rmd ${REPORT_FILES_PATH}') + +#----------------BELOW IS WHERE YOU NEED TO CUSTOMIZE --------------------- +render(input = paste0(Sys.getenv('REPORT_FILES_PATH'), '/star.Rmd')) +# add more lines below if there are more Rmd files to be rendered + +#=============================================================== + + +#============== expose outputs to galaxy history =============== +system(command = 'sh ${TOOL_INSTALL_DIR}/expose-outputs.sh') +#=============================================================== + + +##--------end of code rendering .Rmd templates---------------- +sink() +##=========== End of sinking output============================= \ No newline at end of file