Hey Paul,
many thanks for the explanations. Actually you're right:
I should have mentioned, that I am calling `getEIC` directly on a single chromatogram with the sole purpose to access ion traces of targeted compounds. I am not even calling `findPeaks`. My data are acquired by a qTOF with scan-to-scan accuracy around 35ppm.
I understand the need for binning when performing profile generation, although I do not really understand why this is necessary when trying to access ion traces on the raw data. And in case of over binning I would have expected that all bins within the given mz-range are collapsed, which is obviously not the case. I circumvent this now with this solution (which is not vectorized yet and could be improved by using `data.table` instead of `data.frame`):
getIonTrace <- function( obj, mz, ppm, rtRange ) {
# get table mz, intensity, scantime
scanTime <- rep( obj@scantime, times = diff( c( obj@scanindex, length( obj@env$mz ) ) ) )
eic <- data.frame( intensity = obj@env$intensity, mz = obj@env$mz, scantime = scanTime )
# filter RT
if( !missing( rtRange ) ) {
eic <- eic[ eic$scantime >= rtRange[1] & eic$scantime <= rtRange[2], ]
}
# filter mz
mzRange <- c( mz * (1 - 1E-6 * ppm) , mz * (1 + 1E-6 * ppm) )
eic <- eic[ eic$mz >= mzRange[1] & eic$mz <= mzRange[2], ]
# sum intensities of signals within single scans
eic <- aggregate( intensity ~ scantime, eic, sum )
return(eic)
}
eic <- getIonTrace( xcmsRaw( filename="test.mzdata.xml" ) , mz = 378.0977, ppm = 35 )
plot( intensity ~ scantime, eic )
As a follow-up question, which has nothing to do with `getEIC`: Does the step parameter influence the peak or ROI detection in `xcmsSet( files, method = "centWave", ... )`? I thought that no profMethod is applied when calling xcmsSet with centWave, but today I understood that every xcmsRaw is subject to binning. So, what would be a good parameter for our qTOF data, if the step parameter makes a difference?
Many thanks,
Isam