comparison 5_per_base_sequence_content.Rmd @ 0:d732d4526c6d draft

planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
author mingchen0919
date Tue, 08 Aug 2017 10:14:46 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d732d4526c6d
1 ---
2 title: "Per Base Sequence Content"
3 output: html_document
4 ---
5
6 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
7 knitr::opts_chunk$set(echo = ECHO)
8 ```
9
10 ## Per Base Sequence Content
11
12 ```{r}
13 PBSC_df = data.frame()
14 PBSC_file_paths = read.csv('PBSC_file_paths.txt',
15 header = TRUE, stringsAsFactors = FALSE)
16 for(i in 1:nrow(PBSC_file_paths)) {
17 # file_path = paste0('REPORT_OUTPUT_DIR/', PBSC_file_paths[i,2])
18 file_path = PBSC_file_paths[i,2]
19 pbsc_df = read.csv(file_path,
20 sep='\t', header=TRUE, stringsAsFactors = FALSE) %>%
21 mutate(Base1=as.numeric(str_split_fixed(X.Base, '-', 2)[,1]),
22 Base2=as.numeric(str_split_fixed(X.Base, '-', 2)[,2])) %>%
23 (function (df) {
24 df1 = select(df, -Base2)
25 df2 = select(df, -Base1) %>% filter(Base2 != '')
26 colnames(df1) = c(colnames(df1)[1:5], 'Base')
27 colnames(df2) = c(colnames(df2)[1:5], 'Base')
28 res = rbind(df1, df2) %>% arrange(Base)
29 return(res)
30 })
31 pbsc_df$sample_id = rep(PBSC_file_paths[i,1], nrow(pbsc_df))
32 PBSC_df = rbind(PBSC_df, pbsc_df)
33 }
34 ```
35
36
37 ```{r out.width="100%"}
38 PBSC_df_2 = select(PBSC_df, -X.Base) %>%
39 melt(id = c('Base', 'sample_id'), value.name = 'base_percentage')
40 p = ggplot(data = PBSC_df_2, aes(x = Base, y = base_percentage, group = variable, color = variable)) +
41 geom_line() +
42 facet_wrap(~ sample_id)
43 ggplotly(p)
44 ```
45