view 10_adapter_content.Rmd @ 0:b7c115edd970 draft

planemo upload
author mingchen0919
date Tue, 27 Feb 2018 10:37:12 -0500
parents
children c64267b9f754
line wrap: on
line source

---
output: html_document
---

```{r setup, include=FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(
  echo = as.logical(opt$X_e),
  error = TRUE,
  eval = TRUE
)
```

# Adapter Content

```{r 'Adapter Content', fig.width=10}
## reads 1
ac_1 = extract_data_module(paste0(opt$X_d, '/read_1_fastqc/fastqc_data.txt'), 'Adapter Content')
ac_1$id = 1:length(ac_1$X.Position)

melt_ac_1 = melt(ac_1, id=c('X.Position', 'id'))
melt_ac_1$trim = 'before'

## reads 2
ac_2 = extract_data_module(paste0(opt$X_d, '/read_2_fastqc/fastqc_data.txt'), 'Adapter Content')
ac_2$id = 1:length(ac_2$X.Position)

melt_ac_2 = melt(ac_2, id=c('X.Position', 'id'))
melt_ac_2$trim = 'after'

comb_ac = rbind(melt_ac_1, melt_ac_2)
comb_ac$trim = factor(levels = c('before', 'after'), comb_ac$trim)

p = ggplot(data = comb_ac, aes(x = id, y = value, color = variable)) +
  geom_line() +
  facet_grid(. ~ trim) +
  xlim(min(comb_ac$id), max(comb_ac$id)) + 
  ylim(0, 1) +
  xlab('Position in read (bp)') +
  ylab('')
ggplotly(p)
```