I'm having trouble with extracting individual MS spectrum from my metadata based on precursor ion m/z.
rawdata <- readMSData("file.mzXML", msLevel = 2, mode = "onDisk")
I'm aware that I can assess individual MS spectrum objects by using index, like
rawdata[] . But I was trying to get the index I want based on retention time or m/z of precursor ion. For example, my
rawdata[] looks like this:
> rawdata[] Object of class "Spectrum2" Precursor: 808.5253 Retention time: 0:8 Charge: 2 MSn level: 2 Peaks count: 462 Total ion count: 1423873
For retention time, this worked:
head(rtime(rawdata)) #got exact retention time > which(rtime(rawdata)==7.81947) F1.S00029 1
But when I do the same for precursor ion m/z, I don't get an index as an answer.
> which(precursorMz(rawdata)==808.5253) named integer(0)
Why doesn't this work for precursor ion m/z? Is there any way to extract the index (and eventually the corresponding MS spectrum) based on precursor ion m/z?