generated from KopfLab/project_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_getting_started.Rmd
180 lines (135 loc) · 3.63 KB
/
2_getting_started.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
---
title: "Getting started with isoverse"
subtitle: "workshop"
author: "Seb"
date: "`r format(Sys.Date(), '%d %b %Y')`"
output:
html_document:
df_print: paged
css: stylesheet.css
number_sections: yes
toc: yes
toc_float: true
toc_depth: 3
code_folding: show
editor_options:
chunk_output_type: console
---
# Introduction
Isoreader supports various dual inlet, continuous flow, and scan file formats. This vignette shows how to get started reading these raw IRMS data files and exporting the information to Excel. For more details on isoreader functionality and each file type, please read the **Full Examples** vignettes. For more information on downstream processing with isoverse, check out the [isoprocessor](https://isoprocessor.isoverse.org) package.
```{r, message=FALSE}
# load isoreader package
library(isoreader)
```
# Data files
For demonstration purposes, this vignette simply reads all supported dual inlet, continuous flow, and scan files that are bundled with the isoreader package.
```{r}
# all available examples
iso_get_reader_examples() %>% rmarkdown::paged_table()
```
# Dual Inlet Files
## Read
```{r}
# read all available examples
di_files <- iso_read_dual_inlet(iso_get_reader_examples_folder())
```
## Save
```{r}
# save as r data storage (read back in with iso_read_dual_inlet)
iso_save(di_files, filepath = "data_output/di_save")
di_files <- iso_read_dual_inlet("data_output/di_save.di.rds")
```
## Export
```{r}
# export to excel
iso_export_to_excel(di_files, filepath = "data_output/di_export")
```
# Continuous Flow Files
## Read
```{r}
# read all available examples
cf_files <- iso_read_continuous_flow(iso_get_reader_examples_folder())
```
## Save
```{r}
# save as r data storage (read back in with iso_read_continuous_flow)
iso_save(cf_files, filepath = "data_output/cf_save")
cf_files <- iso_read_continuous_flow("data_output/cf_save.cf.rds")
```
## Export
```{r}
# export to excel
iso_export_to_excel(cf_files, filepath = "data_output/cf_export")
```
# Scan Files
## Read
```{r}
# read all available examples
scan_files <- iso_read_scan(iso_get_reader_examples_folder())
```
## Save
```{r}
# save as r data storage (read back in with iso_read_scan)
iso_save(scan_files, filepath = "data_output/scan_save")
scan_files <- iso_read_scan("data_output/scan_save.scan.rds")
```
## Export
```{r}
# export to excel
iso_export_to_excel(scan_files, filepath = "data_output/scan_export")
```
# Visualization
```{r, message=FALSE}
library(isoprocessor)
library(tidyverse)
```
```{r}
# continuous flow files
cf_files
```
## Pick relevant files & information
```{r}
my_cf_files <- cf_files %>%
# filter files
iso_filter_files(str_detect(file_id, "continuous")) %>%
# set peak table
iso_set_peak_table_from_auto_vendor_data_table() %>%
# select relevant file info
iso_select_file_info(
file_datetime,
analysis = Analysis, id1 = `Identifier 1`, id2 = `Identifier 2`,
prep = Preparation, comment = Comment
)
my_cf_files
```
```{r}
peak_table <- my_cf_files %>% iso_get_peak_table()
```
```{r}
peak_table
```
## Plot
```{r}
iso_plot_continuous_flow_data(my_cf_files)
# ggsave("fig_output/my_chrom.pdf", width = 8, height = 6)
```
```{r}
iso_plot_continuous_flow_data(
iso_files = my_cf_files,
data = c("2", "3"),
time_interval = c(700, 900),
time_interval_units = "s",
panel = NULL,
color = data,
peak_label = iso_format(rt),
peak_label_size = 5,
peak_bounds = TRUE,
peak_marker = TRUE,
peak_label_filter = data == "2 [mV]",
)
ggsave("fig_output/my_fancy_chromatogram.pdf")
```
```{r, warning=FALSE, message=FALSE}
# library(plotly)
# ggplotly(dynamicTicks = TRUE)
```