# HG changeset patch # User mingchen0919 # Date 1520014665 18000 # Node ID e0638fbb50f2ddfbbea4698e1e4e1423549c060c planemo upload diff -r 000000000000 -r e0638fbb50f2 star.Rmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star.Rmd Fri Mar 02 13:17:45 2018 -0500 @@ -0,0 +1,36 @@ +--- +title: 'STAR: RNA-Seq aligner' +output: html_document +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = as.logical(), + error = TRUE +) +``` + + +# Generating genome indexes + +```{bash} +cd ${X_d} +# create genome directory for genome indexes +mkdir -p ${X_d}/genomeDir + +cat >temp.sh < /dev/null 2>&1 +EOF + +grep -v None temp.sh > star-job.sh + +# run star +sh star-job.sh +``` + diff -r 000000000000 -r e0638fbb50f2 star.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star.sh Fri Mar 02 13:17:45 2018 -0500 @@ -0,0 +1,11 @@ +Rscript '${__tool_directory__}/star_render.R' + + -e $echo + -o $report + -d $report.files_path + -s $sink_message + -t '${__tool_directory__}' + + -A '$genomeFastaFiles' + -B '$sjdbGTFfile' + -C '$sjdbOverhang' \ No newline at end of file diff -r 000000000000 -r e0638fbb50f2 star.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star.xml Fri Mar 02 13:17:45 2018 -0500 @@ -0,0 +1,61 @@ + + ultrafast universal RNA-seq aligner + + + pandoc + r-getopt + r-rmarkdown + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e0638fbb50f2 star_render.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/star_render.R Fri Mar 02 13:17:45 2018 -0500 @@ -0,0 +1,52 @@ +##============ 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-------------------- +# library(dplyr) +# getopt_specification_matrix(extract_short_flags('')) %>% +# 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 = '' +OUTPUT_REPORT = opt$X_o + +# create the output associated directory to store all outputs +dir.create(OUTPUT_DIR, recursive = TRUE) + +#-----------------render Rmd-------------- +render(paste0(TOOL_DIR, RMD_NAME, sep = '/'), output_file = OUTPUT_REPORT) +#------------------------------------------ + +#==============the end============== + + +##--------end of code rendering .Rmd templates---------------- +sink() +##=========== End of sinking output============================= \ No newline at end of file