Extract whether list element is MS1 or MS2 from mzR::peaks() output
2
0
Entering edit mode
jspmccain ▴ 10
@jspmccain-13725
Last seen 5.9 years ago

I'm working the R package mzR for extracting raw data from a mzMXL file. I'd like to examine the distribution of ion intensities from MS1 only, is there a way to differentiate the MS1 scans from MS2 scans via the *peaks()* function?

Right now I'm just filtering the elements of the list by the range of *m/z* within each element, but I'm wondering if there is a simpler way.

Any tips are greatly appreciated, and thanks for such a well-documented package!

mzR • 1.5k views
ADD COMMENT
1
Entering edit mode
@laurent-gatto-5645
Last seen 24 days ago
Belgium

I would suggest you give the MSnbase package a go and load your data as an MSnExp object:

x <- readMSData("raw.mzML", mode = "onDisk")

If you want only MS1 data, you can either filter your data

x1 <- filterMsLevel(x, 1)

or directly load MS1 data only

x1 <- readMSData("raw.mzML", msLevel = 1, mode = "onDisk")

This would also work with multiple files and come with many additional features.

ADD COMMENT
2
Entering edit mode
@sebastian-gibb-6858
Last seen 6.1 years ago
Germany

You have to access the header information (?header) first. Subsequently you could subset peaks() (second argument, which is unfortunately missing in the Usage section of the manual page but present in the Details. (I opened an issue on github: https://github.com/sneumann/mzR/issues/134)):

library("mzR")

f <- openMSfile("yourfile.mzML")
h <- header(f)

idxMs1 <- which(h$msLevel == 1L)

if (length(idxMs1)) {
    ms1Peaks <- peaks(f, idxMs1)
}

close(f)
ADD COMMENT

Login before adding your answer.

Traffic: 879 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6