comparison htseq_count.Rmd @ 5:aacd5f53ac99 draft

v2.0.0
author mingchen0919
date Wed, 18 Apr 2018 13:17:28 -0400
parents 0fdb0d5f53ce
children 7c54fd452b8e
comparison
equal deleted inserted replaced
4:0fdb0d5f53ce 5:aacd5f53ac99
1 --- 1 ---
2 title: 'htseq-count analysis' 2 title: 'htseq-count analysis'
3 output: html_document 3 output:
4 html_document:
5 highlight: pygments
4 --- 6 ---
5 7
6 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} 8 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
7 knitr::opts_chunk$set( 9 knitr::opts_knit$set(progress = FALSE)
8 echo = as.logical(opt$X_e), 10 knitr::opts_chunk$set(error = TRUE, echo = FALSE)
9 error = TRUE
10 )
11 ``` 11 ```
12 12
13 13 ```{r, echo=FALSE}
14 ## Run htseq-count 14 # to make the css theme to work, <link></link> tags cannot be added directly
15 15 # as <script></script> tags as below.
16 ```{bash} 16 # it has to be added using a code chunk with the htmltool functions!!!
17 cd ${X_d} 17 css_link = tags$link()
18 18 css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css")
19 cat >htseq-count.sh <<EOF 19 css_link
20 htseq-count \\
21 $(echo ${X_A} | sed 's/,/ /g') \\
22 ${X_G} \\
23 -f ${X_f} \\
24 -r ${X_r} \\
25 -s ${X_S} \\
26 -a ${X_a} \\
27 -t ${X_T} \\
28 -i ${X_i} \\
29 -m ${X_m} > counts.txt
30
31 grep -v '__no_feature\|__ambiguous\|__too_low_aQual\|__not_aligned\|__alignment_not_unique' counts.txt > ${X_c}
32 EOF
33 ``` 20 ```
34 21
22 ```{r, eval=FALSE, echo=FALSE}
23 # this code chunk is purely for adding comments
24 # below is to add jQuery and jstree javascripts
25 ```
26 <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
27 <script src="vakata-jstree-3.3.5/dist/jstree.min.js"></script>
35 28
36 ```{r} 29 ```{r, eval=FALSE, echo=FALSE}
37 # display htseq-count job script 30 # this code chunk is purely for adding comments
38 htseq_count_sh = paste0(opt$X_d, '/htseq-count.sh') 31 # javascript code below is to build the file tree interface
39 tags$code(tags$pre(readChar(htseq_count_sh, file.info(htseq_count_sh)$size ))) 32 # 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
33 ```
34 <script>
35 $(function () {
36 // create an instance when the DOM is ready
37 $('#jstree').jstree().bind("select_node.jstree", function (e, data) {
38 window.open( data.node.a_attr.href, data.node.a_attr.target )
39 });
40 });
41 </script>
42 -----------------------------------------
43
44
45 ```{bash, echo=FALSE}
46 sh ${TOOL_INSTALL_DIR}/run_htseq-count.sh
40 ``` 47 ```
41 48
42 ```{bash} 49 ## Job script
43 cd ${X_d} 50
44 sh htseq-count.sh 51 * htseq-count analysis: [htseq-count.sh](htseq-count.sh)
45 ```
46 52
47 ## Counts 53 ## Counts
48 54
49 ```{r} 55 ```{r}
50 count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1) 56 count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1)
60 66
61 ```{bash} 67 ```{bash}
62 cp ${X_d}/counts.RData ${X_O} 68 cp ${X_d}/counts.RData ${X_O}
63 ``` 69 ```
64 70
71 -----------------------------------------
72 ## Output
65 73
74 ```{r, echo=FALSE}
75 # create a div container to store the file tree interface
76 tags$div(
77 id="jstree",
78 file_tree(Sys.getenv('REPORT_FILES_PATH'))
79 )
80 ```