-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathREADME.Rmd
100 lines (75 loc) · 4.82 KB
/
README.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
---
output: github_document
html_preview: false
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# GCalignR [<img src="vignettes/GCalignRLogo.png" height="200" align="right"/>](https://github.com/mottensmann/GCalignR)
![Build Status](https://travis-ci.org/mottensmann/GCalignR.svg?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/GCalignR)](https://cran.r-project.org/package=GCalignR)
[![](http://cranlogs.r-pkg.org/badges/grand-total/GCalignR)](https://cran.r-project.org/package=GCalignR)
`r badger::badge_doi("10.1371/journal.pone.0198311", "Darkorange")`
`r badger::badge_altmetric("43624695", "Darkorange")`
`GCalignR` provides simple functions to align peak lists obtained from Gas Chromatography Flame Ionization Detectors (GC-FID) based on retention times and plots to evaluate the quality of the alignment. The package supports any other one-dimensional chromatography technique that enables the user to create a peak list with at least one column specifying retention times as illustrated below.
```{r, fig.align='center', fig.height=6, fig.asp=1, echo=FALSE}
knitr::include_graphics(path = "vignettes/Two_Chromas_Peak_List.png", dpi = 300)
```
As with other software you need to get used to the input format which is shown in the illustration:
* Row 1: Sample names
* Row 2: Variable names
* Row 3-N: GC data
+ Each block belongs to a sample as shown for sample A (green) and sample B (orange) above
### Installing GCalignR:
The latest release v1.0.7 is on [CRAN](https://cran.r-project.org/package=GCalignR). [Click here](https://github.com/mottensmann/GCalignR/releases) for an overview of past releases and a brief description of applied changes.
```{r, eval = FALSE}
install.packages("GCalignR", dependencies = T)
```
*The developmental version, currently identical to the CRAN release, is available here:*
```{r, eval=FALSE}
if (!("devtools" %in% rownames(installed.packages()))) {
install.packages("devtools")
} else if (packageVersion("devtools") < 1.6) {
install.packages("devtools")
}
devtools::install_github("mottensmann/GCalignR", build_vignettes = TRUE)
```
### Get started with GCalignR
To get started read the vignettes:
```{r, eval = FALSE}
browseVignettes("GCalignR")
```
Basic usage of the main function to align peaks:
+ `data`: Path to a text file (see input format above), or list of data frames, each corresponding to a sample
+ `rt_col_name`: column name of retention time values
+ `max_linear_shift`: Here, no adjustment of systematic linear drift
+ `max_diff_peak2mean`: Here, sort all peaks strictly by retention time
+ `min_diff_peak2peak`: Here, try to merge peaks when rt differs by less than 0.1
```{r}
library(GCalignR)
aligned <- align_chromatograms(data = peak_data[1:4], # list of data frame
rt_col_name = "time", # retention time
max_linear_shift = 0, #
max_diff_peak2mean = 0,
min_diff_peak2peak = 0.08)
```
**The parameter values above differ from the defaults shown in the paper and the package vignette. In a nutshell, we now suggest in most cases to set `max_diff_peak2mean = 0`. This way peaks are first simply sorted based on the given retention time value and then purely `min_diff_peak2peak` specifies which peaks will be evaluated for a merge. Additionally, this enables the possibility for a considerable boost in computation speed of the first alignment steps (available since version 1.0.5, currently only on GitHub!)**
If you encounter bugs or if you have any suggestions for improvement (for instance on how to speed up the algorithm!), just contact meinolf.ottensmann[at]web.de
*Also I´m happy to provide help if you can´t get it to work. Usually it is easy to solve small problems. However, in order to simplify this process please send a short description of the problem along with the code you have been using as a script file (.R) together with a minimal example input file (.txt).*
### Published paper
[Ottensmann M, Stoffel MA, Nichols HJ, Hoffman JI (2018) GCalignR: An R package for aligning gas-chromatography data for ecological and evolutionary studies. PLoS ONE 13(6): e0198311. https://doi.org/10.1371/journal.pone.0198311](https://doi.org/10.1371/journal.pone.0198311)
```{r, eval=TRUE, echo=FALSE}
df <- scholar::get_article_cite_history(id = "jB8EJjQAAAAJ", article = "_kc_bZDykSQC")
df <- data.frame(Year = df[["year"]], Citations = df[["cites"]])
library(ggplot2)
ggplot(df, aes(Year, Citations)) +
geom_bar(stat = "identity", col = "black", fill = "#1B9E77") +
egg::theme_article(base_size = 14) +
scale_x_continuous(breaks = seq(2018,2024,1)) +
labs(title = "GCalignR citations on Google Scholar",
caption = paste(sum(df$Citations), "Citations as of", Sys.Date()))
```