Extracts the MSMS spectra that originate from the precursor(s) having the same MZ value as defined in theprec argument.

A warning will be issued of one or several of the precursor MZ values in prec are absent in the experiment precursor MZ values (i.e in precursorMz(object)).

Methods

signature(object = "MSnExp", prec = "numeric")

Returns an "MSnExp" containing MSMS spectra whose precursor MZ values are in prec.

Author

Laurent Gatto <lg390@cam.ac.uk>

Examples

file <- dir(system.file(package="MSnbase",dir="extdata"),
            full.name=TRUE,pattern="mzXML$")
aa <- readMSData(file,verbose=FALSE)
my.prec <- precursorMz(aa)[1]
my.prec
#>    F1.S1 
#> 645.3741 
bb <- extractPrecSpectra(aa,my.prec)
precursorMz(bb)
#>    F1.S1    F1.S3 
#> 645.3741 645.3741 
processingData(bb)
#> - - - Processing information - - -
#> Data loaded: Thu Mar 14 06:11:00 2024 
#> 1 (2) precursors (spectra) extracted: Thu Mar 14 06:11:00 2024 
#>  MSnbase version: 2.29.4