From 6ce6db109d8cf5a97ae0d0d4086c3fe2ddcd8b0e Mon Sep 17 00:00:00 2001 From: Ethan Bass Date: Wed, 9 Oct 2024 11:47:18 -0400 Subject: [PATCH] Update uv_spectra.Rmd --- vignettes/articles/uv_spectra.Rmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vignettes/articles/uv_spectra.Rmd b/vignettes/articles/uv_spectra.Rmd index cab336e..fb215dd 100644 --- a/vignettes/articles/uv_spectra.Rmd +++ b/vignettes/articles/uv_spectra.Rmd @@ -62,14 +62,14 @@ matplot(pktab$ref_spectra[,idx_99],type='l', ylab="Abs") legend("top", "t = 0.99", bty = "n") ``` -We can then extract retention times for spectra above the desired spectral similarity threshold with the reference spectra. +We can also extract retention times for spectra above the desired spectral similarity threshold with the reference spectra. ```{r} rts_99 = pk_tab$pk_meta["rt", idx_99] rts_99 ``` -And identify peaks that match the desired criteria. Below the `r length(idx_99)` peaks that match the reference peak at the 99% level are marked with solid black lines and the `r length(idx_97)` peaks that match the reference at the 97% level are marked with dotted gray lines. +Below we plot traces of our four chromatograms at 210 nm. The `r length(idx_99)` peaks that match the reference spectrum at the 99% level are marked with solid black lines and the `r length(idx_97)` peaks that match the reference spectrum at the 97% level are marked with dotted gray lines. ```{r} par(mfrow = c(1, 1)) @@ -81,6 +81,10 @@ abline(v = pk_tab$pk_meta["rt", idx_97], lty=2, col = "darkgray") If we are interested in the combined area of these peaks, we could also use these indices to sum them together. +```{r} +apply(pktab$tab[,idx_99], 1, sum) +``` + `chromatographR` also includes a function (`cluster_spectra`) to group spectra using hierarchical clustering. We can set the seed with the `iseed` argument to ensure repeatability among instantiations of this vignette. For simplicity, we use the argument `max.only = TRUE` to return only the largest clusters. ```{r}