-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathassembly-metrics.rmd
More file actions
72 lines (66 loc) · 2.15 KB
/
Copy pathassembly-metrics.rmd
File metadata and controls
72 lines (66 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
title: Plot assembly metrics
author: Shaun Jackman
output:
html_notebook:
code_folding: hide
html_document:
keep_md: true
params:
input_tsv:
label: "Input TSV file of assembly metrics"
value: "dmelanogaster.samtobreak.tsv"
input: text
---
```{r setup, message=FALSE}
library(dplyr)
library(ggplot2)
library(ggrepel)
library(knitr)
library(readr)
library(scales)
library(tidyr)
knit_print.data.frame <- function(x, ...) kable(x) %>% paste(collapse = "\n") %>% asis_output
input_tsv <- params$input_tsv
```
```{r read-data, message=FALSE}
metrics <- read_tsv(input_tsv) %>%
mutate(Directory = dirname(File)) %>%
separate(Directory, c("Trimmer", "Assembler", "k"),
fill = "left", remove = FALSE) %>%
mutate(Trimmer = sub("nxtrim", "NxTrim", Trimmer)) %>%
replace_na(list(Trimmer = "None")) %>%
mutate(k = as.integer(sub("k", "", k))) %>%
select(Directory, Trimmer, k,
starts_with("Scaffold"), starts_with("Contig"), starts_with("Total"),
everything(), -File, -Assembler)
```
# Scaffold NG50 and NGA50 vs Breakpoints
```{r Scaffold-NGA50-vs-breakpoints}
ggplot(metrics) +
aes(label = k, x = Total_breakpoints, colour = Trimmer, group = Trimmer) +
geom_errorbar(aes(ymin = Scaffold_NGA50, ymax = Scaffold_NG50), width = 10) +
geom_path(aes(y = Scaffold_NGA50), alpha = 0.2) +
geom_text_repel(aes(y = Scaffold_NG50), segment.color = "#cccccc") +
scale_x_continuous(name = "Breakpoints", labels = comma) +
scale_y_continuous(name = "Scaffold NG50 and NGA50", labels = unit_format(unit = "kbp", scale = 1e-3)) +
scale_colour_brewer(palette = "Set1") +
expand_limits(y = 0) +
theme_grey(24)
```
# Contig NGA50 vs breakpoints
```{r Contig-NGA50-vs-breakpoints}
ggplot(metrics) +
aes(label = k, x = Contig_breakpoints, y = Contig_NGA50, colour = Trimmer, group = Trimmer) +
geom_path() +
geom_text_repel(segment.color = "#cccccc") +
scale_x_continuous(name = "Contig breakpoints", labels = comma) +
scale_y_continuous(name = "Contig NGA50", labels = unit_format(unit = "kbp", scale = 1e-3)) +
scale_colour_brewer(palette = "Set1") +
expand_limits(y = 0) +
theme_grey(24)
```
# Table of assembly metrics
```{r assembly-metrics-table}
metrics
```