0
|
1 ---
|
1
|
2 title: 'htseq-count analysis'
|
5
|
3 output:
|
|
4 html_document:
|
|
5 highlight: pygments
|
0
|
6 ---
|
|
7
|
|
8 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
|
5
|
9 knitr::opts_knit$set(progress = FALSE)
|
|
10 knitr::opts_chunk$set(error = TRUE, echo = FALSE)
|
|
11 ```
|
|
12
|
|
13 ```{r, echo=FALSE}
|
|
14 # to make the css theme to work, <link></link> tags cannot be added directly
|
|
15 # as <script></script> tags as below.
|
|
16 # it has to be added using a code chunk with the htmltool functions!!!
|
|
17 css_link = tags$link()
|
|
18 css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css")
|
|
19 css_link
|
|
20 ```
|
|
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
|
0
|
25 ```
|
5
|
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>
|
|
28
|
|
29 ```{r, eval=FALSE, echo=FALSE}
|
|
30 # this code chunk is purely for adding comments
|
|
31 # javascript code below is to build the file tree interface
|
|
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 -----------------------------------------
|
0
|
43
|
|
44
|
5
|
45 ```{bash, echo=FALSE}
|
|
46 sh ${TOOL_INSTALL_DIR}/run_htseq-count.sh
|
2
|
47 ```
|
|
48
|
5
|
49 ## Job script
|
2
|
50
|
5
|
51 * htseq-count analysis: [htseq-count.sh](htseq-count.sh)
|
0
|
52
|
2
|
53 ## Counts
|
0
|
54
|
2
|
55 ```{r}
|
|
56 count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1)
|
|
57 sample_names = trimws(strsplit(opt$X_B, ',')[[1]])
|
|
58 colnames(count_data) = rep(sample_names, length = ncol(count_data))
|
|
59 DT::datatable(count_data, caption = "htseq counts for each sample")
|
0
|
60 ```
|
|
61
|
4
|
62 ```{r}
|
|
63 # save count data as an R object
|
|
64 save(count_data, file = paste0(opt$X_d, '/counts.RData'))
|
|
65 ```
|
0
|
66
|
4
|
67 ```{bash}
|
|
68 cp ${X_d}/counts.RData ${X_O}
|
|
69 ```
|
|
70
|
5
|
71 -----------------------------------------
|
|
72 ## Output
|
4
|
73
|
5
|
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 ```
|