-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-fticr_markdown.Rmd
91 lines (70 loc) · 2.46 KB
/
4-fticr_markdown.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
title: "fticr_markdown"
output: github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=FALSE,message=FALSE,warning=FALSE,
collapse = TRUE,
comment = "#>",
fig.path = "images/fticr_markdown/"
)
```
```{r}
source("0-packages.R")
fticr_data = read.csv(FTICR_LONG)
fticr_meta = read.csv(FTICR_META)
meta_hcoc = read.csv(FTICR_META_HCOC)
relabund_cores = read.csv(FTICR_RELABUND_CORES)
relabund_trt = read.csv(FTICR_RELABUND_TRT)
relabund_summary = read.csv(FTICR_RELABUND_SUMMARY)
```
## VAN KREVELEN DOMAINS
```{r vk_domains, fig.height=5, fig.width=5}
gg_vankrev(fticr_meta, aes(x = OC, y = HC, color = Class))+
scale_color_viridis_d(option = "inferno")+
theme_kp()
```
## VAN KREVELEN PLOTS {.tabset}
### simple VK plots
```{r vk, fig.height=6, fig.width=16}
fticr_hcoc =
fticr_data %>%
left_join(meta_hcoc, by = "formula")
gg_vankrev(fticr_hcoc, aes(x = OC, y = HC, color = sat_level))+
facet_grid(.~sat_level)+
theme_kp()
```
### VK plots with marginal plots
```{r vk_marginal, fig.height = 6, fig.width=6}
gg_fm = gg_vankrev(fticr_hcoc, aes(x = OC, y = HC, color = sat_level))+
stat_ellipse()+
annotate("text", label = "aliphatic", x = 1.2, y = 1.9, hjust="right")+
annotate("text", label = "polyphenolic", x = 1.2, y = 1.2, hjust="right")+
annotate("text", label = "condensed \n aromatic", x = 1.2, y = 0.2, hjust="right")+
theme_kp()
ggMarginal(gg_fm,groupColour = TRUE,groupFill = TRUE)
```
## RELATIVE ABUNDANCE FIGURES
```{r relabund_bar}
relabund_trt %>%
dplyr::mutate(Class = factor(Class, levels =
c("AminoSugar", "Carb","Lipid","Protein","UnsatHC",
"ConHC","Lignin","Tannin","Other"))) %>%
ggplot(aes(x = sat_level, y = rel_abund, fill = Class))+
geom_bar(stat = "identity")+
scale_fill_viridis_d(option = "inferno")+
labs(x = "percent saturation",
y = "relative abundance (%)")+
theme_kp()
```
## RELATIVE ABUNDANCE TABLES
Different letters denote significant differences among saturation levels at alpha = 0.05.
```{r}
relabund_summary %>%
dplyr::select(sat_level, Class, relative_abundance) %>%
dplyr::mutate(Class = factor(Class, levels =
c("AminoSugar", "Carb","Lipid","Protein","UnsatHC",
"ConHC","Lignin","Tannin","Other"))) %>%
spread(sat_level, relative_abundance) %>%
knitr::kable(align = "c")
```