Mercurial > repos > mingchen0919 > aurora_deseq2
changeset 3:caae0a188548 draft
add deseq2 package
author | mingchen0919 |
---|---|
date | Thu, 08 Mar 2018 21:03:01 -0500 |
parents | 405d8fa2f560 |
children | f4b8887aac56 |
files | deseq2.Rmd deseq2.sh deseq2.xml deseq2_render.R spec.txt |
diffstat | 5 files changed, 57 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/deseq2.Rmd Thu Mar 08 20:13:30 2018 -0500 +++ b/deseq2.Rmd Thu Mar 08 21:03:01 2018 -0500 @@ -1,29 +1,31 @@ --- -title: 'HTML report title' -output: - html_document: - number_sections: true - toc: true - theme: cosmo - highlight: tango +title: 'DESeq2 Analysis' +output: html_document --- ```{r setup, include=FALSE, warning=FALSE, message=FALSE} knitr::opts_chunk$set( - echo = as.logical(), + echo = as.logical(opt$X_e), error = TRUE ) ``` -# Code for computational analysis - -```{r 'step 1'} +## DESeq2 analysis -``` - -```{r 'ste[ 2'} - +```{r} +coldata = read.csv(opt$X_B, row.names = 1, header = TRUE) +dds = DESeqDataSetFromMatrix(countData = count_data, + colData = coldata, + design = expression(opt$X_C)) +dds = DESeq(dds, test = opt$X_G, fitType = opt$X_H) ``` +## Results + +```{r} +res = results(dds, contrast = c(opt$X_D, opt$X_E, opt$X_F), alpha = opt$X_I) +res +``` +
--- a/deseq2.sh Thu Mar 08 20:13:30 2018 -0500 +++ b/deseq2.sh Thu Mar 08 21:03:01 2018 -0500 @@ -6,12 +6,13 @@ -s $sink_message -t '${__tool_directory__}' - -A $count_data - -B $column_data - -C $design_formula - -D $treatment_name - -E $treated - -F $untreated - -G $test_type - -H $fit_type - -I $alpha \ No newline at end of file + -A '$count_data' + -B '$column_data' + -C '$design_formula' + -D '$treatment_name' + -E '$treated' + -F '$untreated' + -G '$test_type' + -H '$fit_type' + -I '$alpha' + -J '$significant_genes' \ No newline at end of file
--- a/deseq2.xml Thu Mar 08 20:13:30 2018 -0500 +++ b/deseq2.xml Thu Mar 08 21:03:01 2018 -0500 @@ -19,15 +19,15 @@ -s $sink_message -t '${__tool_directory__}' - -A $count_data - -B $column_data - -C $design_formula - -D $treatment_name - -E $treated - -F $untreated - -G $test_type - -H $fit_type - -I $alpha]]></command> + -A '$count_data' + -B '$column_data' + -C '$design_formula' + -D '$treatment_name' + -E '$treated' + -F '$untreated' + -G '$test_type' + -H '$fit_type' + -I '$alpha']]></command> <inputs> <param type="boolean" name="echo" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Display analysis code in report?"/>
--- a/deseq2_render.R Thu Mar 08 20:13:30 2018 -0500 +++ b/deseq2_render.R Thu Mar 08 21:03:01 2018 -0500 @@ -17,12 +17,25 @@ #------------get arguments into R-------------------- -library(dplyr) -getopt_specification_matrix(extract_short_flags('deseq2.xml')) %>% - write.table(file = 'spec.txt', sep = ',', row.names = FALSE, col.names = TRUE, quote = FALSE) +# library(dplyr) +# getopt_specification_matrix(extract_short_flags('deseq2.xml')) %>% +# write.table(file = 'spec.txt', sep = ',', row.names = FALSE, col.names = TRUE, quote = FALSE) -spec_matrix = as.matrix() +spec_matrix = as.matrix( + data.frame(stringsAsFactors=FALSE, + long_flags = c("X_e", "X_o", "X_d", "X_s", "X_t", "X_A", "X_B", + "X_C", "X_D", "X_E", "X_F", "X_G", "X_H", "X_I"), + short_flags = c("e", "o", "d", "s", "t", "A", "B", "C", "D", "E", + "F", "G", "H", "I", "J"), + argument_mask_flags = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, + 1L, 1L), + data_type_flags = c("character", "character", "character", "character", + "character", "character", "character", "character", + "character", "character", "character", "character", + "character", "character", "character") + ) +) opt = getopt(spec_matrix) #---------------------------------------------------- @@ -35,16 +48,16 @@ #---------- 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_DIR = opt$X_d +TOOL_DIR = opt$X_t +RMD_NAME = 'deseq2.Rmd' 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) +render(paste0(TOOL_DIR, '/', RMD_NAME), output_file = OUTPUT_REPORT) #------------------------------------------ #==============the end==============