Question: Using massifquant for peak detection of generic matrix data?
0
james.dalgleish30 wrote:

Is it possible to use massifquant for peak detection of non-MS data, but rather just finding traces that might look like MS peaks in a large matrix (150000x150000), for instance?

Answer: Using massifquant for peak detection of generic matrix data?
1
Johannes Rainer1.5k wrote:

The peak detection algorithms in xcms perform peak detection in retention time domain, i.e. in one dimension of the 2D matrix - with a lot of assumptions on peak shape, scattering of values in one dimension etc.

I would have a look at the yamss package instead. AFAIK, yamss uses a two-dimensional kernel to find peaks in 2D space.

cheers, jo

Can you provide an example of how that would work? creating a new CMSraw object from a datatable is not straightforward.

I haven't tried that yet, sorry.

Answer: Using massifquant for peak detection of generic matrix data?
1
james.dalgleish30 wrote:

So, the author provided an answer when I posed the question on the github site. I think this may be useful to many, so I'll post it here:

"

It is possible to phrase your question in terms of density estimation though. I've tried to illustrate with the following toy example:

library(yamss)
library(data.table)

set.seed(4)
num_rows <- 1000 # "m/z"
num_cols <- 2000 # "scan"
mat <- matrix(runif(num_rows*num_cols, 3, 5), nrow = num_rows, ncol = num_cols) # "intensities"

dt <- data.table(
mz = rep(seq_len(num_rows), num_cols),
scan = rep(seq_len(num_cols), each = num_rows),
intensity = as.numeric(mat),
sample = 1
)
cms_raw <- new("CMSraw")
yamss:::.mzParams(cms_raw) <- yamss:::.setMZParams(dt)
yamss:::.rawDT(cms_raw) <- dt
colData(cms_raw) <- DataFrame(sample = 1)
cms_proc <- bakedpi(cms_raw, dbandwidth = c(1e-5, 1), dgridstep = c(1e-5, 1))
cms_slice <- slicepi(cms_proc, cutoff = NULL, verbose = TRUE)"