Search
Question: Extract whether list element is MS1 or MS2 from mzR::peaks() output
0
gravatar for jspmccain
14 months ago by
jspmccain10
jspmccain10 wrote:

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
ADD COMMENTlink modified 14 months ago by Laurent Gatto1.0k • written 14 months ago by jspmccain10
1
gravatar for Laurent Gatto
14 months ago by
Laurent Gatto1.0k
United Kingdom
Laurent Gatto1.0k wrote:

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 COMMENTlink written 14 months ago by Laurent Gatto1.0k
2
gravatar for Sebastian Gibb
14 months ago by
Germany
Sebastian Gibb80 wrote:

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 COMMENTlink written 14 months ago by Sebastian Gibb80
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 236 users visited in the last hour