forked from lch14forever/hospital_microbiome
-
Notifications
You must be signed in to change notification settings - Fork 5
/
figure3b.hai_ar_species_nanopore_n50.Rmd
66 lines (56 loc) · 1.76 KB
/
figure3b.hai_ar_species_nanopore_n50.Rmd
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
---
title: "HAI AR assembly N50"
output:
html_document:
df_print: paged
---
### HAI AR assembly N50
Load generic libraries
```{r message=FALSE, warning=FALSE}
source('configuration.r')
```
Load plot specific libraries
```{r}
library(ggridges)
```
Read in and process data
```{r}
dat <- read.table('../tables/genome_info.dat', head=TRUE, sep='\t') %>%
mutate(species=str_replace(Species_name, '_',' '))
```
Select HAI species
```{r}
dat <- filter(dat, grepl("Burkholderia", species) |
species %in% c("Acinetobacter baumannii","Candida albicans",
"Clostridium difficile", "Clostridium sordellii",
"Klebsiella pneumoniae", "Klebsiella oxytoca",
"Escherichia coli", "Staphylococcus aureus",
"Pseudomonas aeruginosa","Mycobacterium abscessus",
"Mycobacterium tuberculosis","Enterococcus faecalis",
"Enterococcus faecium", "Staphylococcus epidermidis"))
```
Plot
```{r fig.height=6, fig.width=8}
plot.dat <- group_by(dat, species) %>%
tally() %>%
merge(dat, by='species') %>%
mutate(species = str_replace(species, '[a-z]+ ', '. ')) %>%
filter(n>19)
g <- ggplot(data =plot.dat, aes(y=species,x=N50/1e6, fill=species, height = ..density..)) +
geom_density_ridges(stat = "binline", bins = 15, scale = 0.8, draw_baseline = FALSE) +
scale_fill_npg(guide=FALSE)+
theme(axis.text.y = element_text(face='bold.italic',margin=margin(0,10,0,0))) +
scale_x_log10() +
labs(y=NULL, x='N50 (MB)') +
coord_cartesian(ylim =c(1,7.5))
g
```
Save plot
```{r, echo=FALSE}
ggsave('../plots/fig3b.hai_ar_species_nanopore_n50.svg', g,
width=7, height=6)
```
### Session informaton
```{r}
sessionInfo()
```