# HG changeset patch # User mingchen0919 # Date 1524766258 14400 # Node ID c0e57c994deb0ac9590922ed1493ae0a6b93129f # Parent 7c9170b7d9f65b9f46154c274e5f9c51500996ec planemo upload commit 5b03cf1a31307c262701d4f267972bd01be24311 diff -r 7c9170b7d9f6 -r c0e57c994deb expose-outputs.sh --- a/expose-outputs.sh Thu Apr 26 13:38:15 2018 -0400 +++ b/expose-outputs.sh Thu Apr 26 14:10:58 2018 -0400 @@ -2,5 +2,16 @@ cd ${REPORT_FILES_PATH} # copy outputs from tool outputs directory to corresponding galaxy output path -cp star.html ${REPORT} -cp Aligned.out.sorted.bam ${X_S} \ No newline at end of file +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 diff -r 7c9170b7d9f6 -r c0e57c994deb getopt_specification.csv --- a/getopt_specification.csv Thu Apr 26 13:38:15 2018 -0400 +++ b/getopt_specification.csv Thu Apr 26 14:10:58 2018 -0400 @@ -1,9 +1,27 @@ -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 +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 diff -r 7c9170b7d9f6 -r c0e57c994deb shell-script-template.sh --- a/shell-script-template.sh Thu Apr 26 13:38:15 2018 -0400 +++ b/shell-script-template.sh Thu Apr 26 14:10:58 2018 -0400 @@ -1,47 +1,48 @@ +# SHELL_SCRIPT file name +SHELL_SCRIPT='skewer.sh' + # run SHELL_SCRIPT within tool outputs directory cd ${REPORT_FILES_PATH} -#--------- index genome -------- -# create genome directory for genome indexes -mkdir -p ${X_d}/genomeDir - +# build job-script.sh cat >temp.sh < /dev/null 2>&1 +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 EOF -grep -v None temp.sh > index-genome.sh - -# run star -sh index-genome.sh +# 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} -#---- mapping --------- -cat >temp.sh < /dev/null 2>&1 -EOF - -grep -v None temp.sh > mapping.sh - -# run mapping -sh mapping.sh - -# remove temp.sh rm temp.sh -#----- SAM to sorted BAM ------ -echo "samtools sort -o Aligned.out.sorted.bam Aligned.out.sam" > sam2bam.sh -sh sam2bam.sh +# run SHELL_SCRIPT +sh ${SHELL_SCRIPT} -#----- evaluate mapping ------- -echo "samtools flagstat Aligned.out.sorted.bam > flagstat.txt" > flagstat.sh -sh flagstat.sh +# rename log file +if [ -e trim-trimmed.log ]; then + cp trim-trimmed.log trim-trimmed.txt +fi \ No newline at end of file diff -r 7c9170b7d9f6 -r c0e57c994deb skewer.Rmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/skewer.Rmd Thu Apr 26 14:10:58 2018 -0400 @@ -0,0 +1,78 @@ +--- +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, tags cannot be added directly +# as 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 +``` + + + +```{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 +``` + + +```{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')) +) +``` + diff -r 7c9170b7d9f6 -r c0e57c994deb skewer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/skewer.xml Thu Apr 26 14:10:58 2018 -0400 @@ -0,0 +1,165 @@ + + A fast and accurate adapter trimmer for next-generation sequencing single or paired end reads. + + + pandoc + r-getopt + r-rmarkdown + skewer + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+
+ + + + `_ if you are not sure what parameter values to use.]]> + + + + + +
diff -r 7c9170b7d9f6 -r c0e57c994deb skewer_render.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/skewer_render.R Thu Apr 26 14:10:58 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'), '/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 diff -r 7c9170b7d9f6 -r c0e57c994deb star.Rmd --- a/star.Rmd Thu Apr 26 13:38:15 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ ---- -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, tags cannot be added directly -# as 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 -``` - - - -```{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 -``` - ------------------------------------------ - - -## 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')) -) -``` - diff -r 7c9170b7d9f6 -r c0e57c994deb star.xml --- a/star.xml Thu Apr 26 13:38:15 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ - - ultrafast universal RNA-seq aligner - - - pandoc - r-getopt - r-rmarkdown - star - samtools - - - - - - - - - - - - - - - - - - - - - - diff -r 7c9170b7d9f6 -r c0e57c994deb star_render.R --- a/star_render.R Thu Apr 26 13:38:15 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'), '/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