Skip to main content

Move DIA window boundaries to regions with few precursors

Description

Moves each window start down, and each window end up, to the mid of the nearest empty bin. A boundary already on such a mid stays, so readjust_windows() returns its own result unchanged.

Usage

readjust_windows(windows, masses, bin_width = 0.1, min_count = 15)

Arguments

windows A data frame or list with the columns from and to, e.g. from Cdsw$as_table().
masses Precursor masses (m/z): a numeric vector of finite values.
bin_width Width of the bins (m/z) into which the masses are binned.
min_count Bins with fewer than min_count precursors count as empty; a number, at least 0.

Value

A data frame with one row per window and the columns from, to, mid, width and n_precursors (precursors with from < m/z <= to).

See Also

Other DIA windows: Cdsw, masses, plot_windows()

Examples

library("prozor")

data(masses)
cdsw <- Cdsw$new(masses, max_window = 100)
windows <- cdsw$as_table()
head(readjust_windows(windows, masses, min_count = 10))
    from     to    mid width n_precursors
1 349.63 381.95 365.79 32.32         6177
2 380.45 408.35 394.40 27.90         6431
3 407.05 432.35 419.70 25.30         6695
4 431.15 454.65 442.90 23.50         6613
5 453.45 476.05 464.75 22.60         6658
6 474.85 496.85 485.85 22.00         6842