# HG changeset patch # User mingchen0919 # Date 1521568744 14400 # Node ID f8ac93c417209612370cf2d069ce9f50b2cff4b3 # Parent a88f12177e6fdbcadf6764fdd642ed79e8857fb0 special characters diff -r a88f12177e6f -r f8ac93c41720 helper.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/helper.R Tue Mar 20 13:59:04 2018 -0400 @@ -0,0 +1,28 @@ +#' \code{getopt_specification_matrix} returns a getopt specification matrix. +#' +#' @param specification_file a cvs file within the \code{galaxy_tool_directory} which stores getopt specification matrix data. +#' The first column are short flags, the second column are argument masks, the third column +#' is data types. The fourth column are variable names used in the tool XML. These three columns are required. +#' @param gtg_name the name of a running GTG. +getopt_specification_matrix = function(specification_file, gtg_name = 'gtg', tool_dir = Sys.getenv('TOOL_DIR')) { + df = read.csv(paste0(tool_dir, specification_file), + header = TRUE, stringsAsFactors = FALSE) + # check if there are duplicated short flags + short_flags = df[, 1] + if (length(unique(short_flags)) < length(short_flags)) { + cat('----Duplicated short flags found ----\n') + cat('short flags: ', df[, 1][duplicated(df[, 1])], '\n') + stop('Duplicated short flags are not allowed.') + } + + # use short flags to generate long flags + long_flags = paste0('X_', df[, 1]) + + # specification matrix + df2 = data.frame(long_flags = long_flags, + short_flags = df[, 1], + argument_mask = df[, 2], + data_type = df[, 3]) + + as.matrix(df2) +} \ No newline at end of file diff -r a88f12177e6f -r f8ac93c41720 mygene_and_myvariant_macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mygene_and_myvariant_macros.xml Tue Mar 20 13:59:04 2018 -0400 @@ -0,0 +1,1439 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r a88f12177e6f -r f8ac93c41720 variant_simple_search.Rmd --- a/variant_simple_search.Rmd Tue Mar 20 11:29:28 2018 -0400 +++ b/variant_simple_search.Rmd Tue Mar 20 13:59:04 2018 -0400 @@ -19,12 +19,9 @@ # Code for computational analysis -```{r 'step 1'} - -``` - -```{r 'ste[ 2'} - +```{r} +opt ``` + diff -r a88f12177e6f -r f8ac93c41720 variant_simple_search.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/variant_simple_search.csv Tue Mar 20 13:59:04 2018 -0400 @@ -0,0 +1,6 @@ +short flag,argument mask,data type,variable name,galaxy input type,description +o,1,character,report,data, +d,1,character,report.files_path,data, +s,1,character,sink_message,text, +q,1,character,variant_query,text, +f,1,character,return_fields,text, diff -r a88f12177e6f -r f8ac93c41720 variant_simple_search.xml --- a/variant_simple_search.xml Tue Mar 20 11:29:28 2018 -0400 +++ b/variant_simple_search.xml Tue Mar 20 13:59:04 2018 -0400 @@ -1,30 +1,54 @@ - - + + some description - - pandocr-getoptr-rmarkdownr-jsonliter-dtr-curlr-rcurl - - - + pandoc + r-getopt + r-rmarkdown + r-jsonlite + r-dt + r-curl + r-rcurl + + + mygene_and_myvariant_macros.xml + + + + + - - - - - + + + + + + + + + + + + + + + + + + + ]]> + diff -r a88f12177e6f -r f8ac93c41720 variant_simple_search_render.R --- a/variant_simple_search_render.R Tue Mar 20 11:29:28 2018 -0400 +++ b/variant_simple_search_render.R Tue Mar 20 13:59:04 2018 -0400 @@ -10,6 +10,8 @@ library(getopt) library(rmarkdown) +library(jsonlite) +library(DT) #------------------------------------------------ @@ -17,11 +19,11 @@ # load helper function source(paste0(Sys.getenv('TOOL_DIR'), '/helper.R')) # import getopt specification matrix from a csv file -spec_csv = paste0(Sys.getenv('TOOL_DIR'), '/getopt_specification.csv') -opt = getopt(getopt_specification_matrix(spec_csv)) +opt = getopt(getopt_specification_matrix('/variant_simple_search.csv')) opt$X_t = Sys.getenv('TOOL_DIR') #---------------------------------------------------- +print(opt) #-----------using passed arguments in R # to define system environment variables--- @@ -34,7 +36,7 @@ OUTPUT_DIR = opt$X_d TOOL_DIR = opt$X_t OUTPUT_REPORT = opt$X_o -RMD_NAME = '' +RMD_NAME = 'variant_simple_search.Rmd' # create the output associated directory to store all outputs dir.create(OUTPUT_DIR, recursive = TRUE)