Mercurial > repos > mingchen0919 > rmarkdown_fastqc_site
annotate 2_per_base_N_content.Rmd @ 9:848cf699c443 draft
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit a23e23222252167ef7c3338a4872e84706df8f83-dirty
author | mingchen0919 |
---|---|
date | Tue, 08 Aug 2017 14:56:32 -0400 |
parents | d732d4526c6d |
children |
rev | line source |
---|---|
0
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
2 title: "Per Base N Content" |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
3 output: html_document |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
4 --- |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
5 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
6 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
7 knitr::opts_chunk$set(echo = ECHO) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
8 ``` |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
9 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
10 ## Per Base N Content |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
11 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
12 ```{r} |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
13 PBNC_df = data.frame() |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
14 PBNC_file_paths = read.csv('PBNC_file_paths.txt', |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
15 header = TRUE, stringsAsFactors = FALSE) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
16 for(i in 1:nrow(PBNC_file_paths)) { |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
17 # file_path = paste0('REPORT_OUTPUT_DIR/', PBNC_file_paths[i,2]) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
18 file_path = PBNC_file_paths[i,2] |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
19 pbnc_df = read.csv(file_path, |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
20 sep='\t', header=TRUE, stringsAsFactors = FALSE) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
21 mutate(Base1=as.numeric(str_split_fixed(X.Base, '-', 2)[,1]), |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
22 Base2=as.numeric(str_split_fixed(X.Base, '-', 2)[,2])) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
23 (function (df) { |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
24 df1 = select(df, -Base2) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
25 df2 = select(df, -Base1) %>% filter(Base2 != '') |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
26 colnames(df1) = c(colnames(df1)[1:2], 'Base') |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
27 colnames(df2) = c(colnames(df2)[1:2], 'Base') |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
28 res = rbind(df1, df2) %>% arrange(Base) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
29 return(res) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
30 }) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
31 pbnc_df$sample_id = rep(PBNC_file_paths[i,1], nrow(pbnc_df)) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
32 PBNC_df = rbind(PBNC_df, pbnc_df) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
33 } |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
34 ``` |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
35 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
36 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
37 ```{r} |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
38 PBNC_df$N.Count = PBNC_df$N.Count * 100 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
39 max_phred = max(PBNC_df$N.Count) + 5 |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
40 hchart(PBNC_df, "line", hcaes(x = as.character(Base), y = N.Count, group = sample_id)) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
41 hc_title( |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
42 text = "Per Base N Content" |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
43 ) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
44 hc_xAxis( |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
45 title = list(text = "Base Position") |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
46 ) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
47 hc_yAxis( |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
48 title = list(text = "N %"), |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
49 plotLines = list( |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
50 list(label = list(text = "N = 5%"), |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
51 width = 2, |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
52 dashStyle = "dash", |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
53 color = "red", |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
54 value = 5) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
55 ) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
56 ) %>% |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
57 hc_exporting(enabled = TRUE) |
d732d4526c6d
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_fastqc_site commit ddb1f6aca7619aea2e660b1729367841b56ba4c9-dirty
mingchen0919
parents:
diff
changeset
|
58 ``` |