Skip to content

Commit

Permalink
Update uv_spectra.Rmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbass committed Oct 9, 2024
1 parent bfcd660 commit 6ce6db1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vignettes/articles/uv_spectra.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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}
Expand Down

0 comments on commit 6ce6db1

Please sign in to comment.