comparison rmarkdown_report.Rmd @ 0:0358f6f78adf draft

planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author mingchen0919
date Fri, 14 Dec 2018 00:40:15 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0358f6f78adf
1 ---
2 title: 'Aurora Skewer Report'
3 output:
4 html_document:
5 highlight: pygments
6 ---
7
8 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
9 knitr::opts_chunk$set(error = TRUE, echo = FALSE)
10 ```
11
12 ```{css, echo=FALSE}
13 pre code, pre, code {
14 white-space: pre !important;
15 overflow-x: scroll !important;
16 word-break: keep-all !important;
17 word-wrap: initial !important;
18 }
19 ```
20
21 ```{r, echo=FALSE}
22 # to make the css theme to work, <link></link> tags cannot be added directly
23 # as <script></script> tags as below.
24 # it has to be added using a code chunk with the htmltool functions!!!
25 css_link = tags$link()
26 css_link$attribs = list(rel="stylesheet", href="vakata-jstree-3.3.5/dist/themes/default/style.min.css")
27 css_link
28 ```
29
30 ```{r, eval=FALSE, echo=FALSE}
31 # this code chunk is purely for adding comments
32 # below is to add jQuery and jstree javascripts
33 ```
34
35 <script src="vakata-jstree-3.3.5/dist/jstree.min.js"></script>
36
37
38 ```{r, eval=FALSE, echo=FALSE}
39 # this code chunk is purely for adding comments
40 # javascript code below is to build the file tree interface
41 # 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
42 ```
43 <script>
44 jQuery(function () {
45 // create an instance when the DOM is ready
46 jQuery('#jstree').jstree().bind("select_node.jstree", function (e, data) {
47 window.open( data.node.a_attr.href, data.node.a_attr.target )
48 });
49 });
50 </script>
51
52
53 ```{r, eval=FALSE, echo=FALSE}
54 ---
55 # ADD YOUR DATA ANALYSIS CODE AND MARKUP TEXT BELOW TO EXTEND THIS R MARKDOWN FILE
56 ---
57 ```
58
59 ## Job script
60
61 ```{bash echo=FALSE}
62 sh ${TOOL_INSTALL_DIR}/build-and-run-job-scripts.sh
63 ```
64
65 ```{r echo=FALSE,warning=FALSE,results='asis'}
66 # display content of the job-script.sh file.
67 cat('```bash\n')
68 cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/job-1-script.sh')), sep = '\n')
69 cat('\n```')
70 ```
71
72 # Results summary
73
74 ## Reads processing summary
75
76 ```{r echo=TRUE}
77 log = readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/trim-trimmed.log'))
78 start_line = grep('read.+processed; of these:', log)
79 end_line = grep('untrimmed.+available after processing', log)
80 processing_summary = gsub('(\\d+) ', '\\1\t', log[start_line:end_line])
81 processing_summary_df = do.call(rbind, strsplit(processing_summary, '\t'))
82 colnames(processing_summary_df) = c('Total reads:', processing_summary_df[1,1])
83 knitr::kable(processing_summary_df[-1, ])
84 ```
85
86 ## Length distribution of reads after trimming
87
88 ```{r echo=TRUE, message=FALSE, warning=FALSE}
89 start_line = grep('length count percentage', log)
90 len_dist = log[(start_line):length(log)]
91 len_dist = do.call(rbind, strsplit(len_dist, '\t'))
92 columns = len_dist[1, ]
93 len_dist = as.data.frame(len_dist[-1, ])
94 colnames(len_dist) = columns
95
96 library(plotly)
97 library(ggplot2)
98 len_dist$count = as.numeric(len_dist$count)
99 labels = as.character(len_dist$length)
100 len_dist$length = 1:nrow(len_dist)
101 pp = ggplot(data = len_dist, aes(length, count)) +
102 geom_line(color='red') +
103 scale_x_continuous(name = 'Length',
104 breaks = 1:nrow(len_dist),
105 labels = labels) +
106 theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
107 ylab('Count') +
108 ggtitle('Length distribution')
109 ggplotly(pp)
110 ```
111