Closed ismaRP closed 2 weeks ago
The addProcessing()
function is a way to allow custom processing/modification of peaks variables - it's actually not thought to be used for spectra variables. Also, because most backends support changing the spectra variables directly. So, unfortunately, that does not work with addProcessing()
. As a workaround, you could add some data processing function to a Spectra
, then calculate the tic on that Spectra
and assign/replace the $totIonCurrent
spectra variable and after that add eventual additional processing steps. Could that help?
Example:
sps <- addProcessing(sps, <some function modifying intensity values>)
sps$newTotIonCurrent <- tic(sps, initial = FALSE)
sps <- addProcessing(sps, <some other function to modify peaks data>)
That helps, and it's what I had in mind. Thanks for the detailed answer.
The same way I can pass a spectraVariable to a custom processing function through addProcessing, is there a way for those functions to also modify spectra variables in the spectra object. For example, say I want to recalculate the total ion current after a certain processing step, or as part of it. I know I could run something like this at any point:
But what I would like is to be able to update or create spectra variables as part of the processing queue, so that steps that come after in the queue can use the new values, and so that I can keep track of certain diagnostic values.
Thank you