comparison 01_htseq_count_analysis.Rmd @ 0:dcf65671e56a draft

planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author mingchen0919
date Sun, 30 Dec 2018 12:52:51 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:dcf65671e56a
1 ---
2 title: 'HTSeq-count Analysis'
3 output:
4 html_document:
5 highlight: pygments
6 ---
7
8 ## Job script
9
10 ```{bash, echo=FALSE}
11 sh ${TOOL_INSTALL_DIR}/build-and-run-job-scripts.sh > ${REPORT_FILES_PATH}/log.txt 2>&1
12 ```
13
14 ```{r echo=FALSE, comment='', results='asis'}
15 cat('```bash\n')
16 cat(readLines(paste0(Sys.getenv('REPORT_FILES_PATH'), '/htseq-count.sh')), sep = '\n')
17 cat('\n```')
18 ```
19
20 ## Counts
21
22 Write data into a CSV file.
23
24 ```{r, echo=TRUE}
25 count_data = read.table(paste0(opt$X_d, '/counts.txt'), row.names = 1)
26 sample_names = trimws(strsplit(opt$X_B, ',')[[1]])
27 colnames(count_data) = rep(sample_names, length = ncol(count_data))
28
29
30 # modify column names
31 count_data = data.frame(feature_id = rownames(count_data), count_data)
32 write.csv(count_data,
33 file = paste0(Sys.getenv('REPORT_FILES_PATH'), '/count_data.csv'),
34 quote = FALSE, row.names = FALSE)
35 ```
36
37 Display the top 1000 rows with largest average counts.
38
39 ```{r echo=TRUE}
40 # Sort count table by count average
41 rownames(count_data) = count_data$feature_id
42 count_data = count_data[, -1]
43 sorted_ct_table = count_data[order(rowMeans(count_data), decreasing = TRUE), ]
44 DT::datatable(head(sorted_ct_table, 1000))
45 ```
46
47