Function optimizes Extraction windows for DIA/SWATH so we have the same number of precursor per window. This optimization is based on spectral library data or non redundant .blib files (Bibliospec).

```
library(prozor)
```

data("masses") cdsw <- Cdsw(masses , nbins = 25, digits = 1) cdsw$plot()

knitr::kable(cdsw$asTable())

constError <- cdsw$error()

`quantile`

Same number of MS1 precursors in each window

cdsw$quantile_breaks()

cdsw$plot()

knitr::kable(cdsw$asTable())

quantileError <- cdsw$error()

Using this method the window start and end is shifted to a mass range with as few MS1 peaks as possible.

knitr::kable(cdsw$optimizeWindows(maxbin = 10, plot = TRUE) )

- Mass range can be specified (
*mass_range*) - Maximal window size can be specified (
*max_window_size*). This is because windows should not be to large because of optimal collision energy (personal communication by Bernd R.). - Minimal window size can be specified (
*min_window_size*). - target number of windows can be specified (
*nr_windows*). - boundaries between windows are placed in regions were no precursors are observed.

cdsw$sampling_breaks(maxwindow = 100,plot = TRUE)

cdsw$plot()

knitr::kable(cdsw$asTable())

knitr::kable(cdsw$optimizeWindows(maxbin = 10, plot = TRUE) )

mixedError <- cdsw$error()

We compare the optimal number of MS1 peaks per SWATH window (same in each window) with the numbers obtained by using all of the 3 methods implemented.

barplot(c(const = constError$score1, quantile = quantileError$score1, mixed = mixedError$score1),ylab = "Manhattan distance") barplot(c(const = constError$score2, quantile = quantileError$score2, mixed = mixedError$score2),ylab = "Euclidean distance")

We can see that Method 3 has a relatively small error although it is able to fulfill constraints such as maximum window size.

```
sessionInfo()
```

**Any scripts or data that you put into this service are public.**

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.