peaks: Access the raw data from an 'mzR' object.

Description Usage Arguments Details Note Author(s) See Also Examples

Description

Access the MS raw data. The peaks, spectra (can be used interchangeably) and peaksCount functions return the (m/z, intensity) pairs and the number peaks in the spectrum/spectra. peaks and spectra return a single matrix if scans is a numeric of length 1 and a list of matrices if several scans are asked for or no scans argument is provided (i.e all spectra in the oject are retured). peaksCount will return a numeric of length n.

The header function returns a list containing seqNum, acquisitionNum, msLevel, peaksCount, totIonCurrent, retentionTime (in seconds), basePeakMZ, basePeakIntensity, collisionEnergy, ionisationEnergy, lowM, highMZ, precursorScanNum, precursorMZ, precursorCharge, precursorIntensity, mergedScan, mergedResultScanNum, mergedResultStartScanNum, mergedResultEndScanNum, filterString, spectrumId, centroided (logical whether the data of the spectrum is in centroid mode or profile mode; only for pwiz backend), injectionTime (ion injection time, in milliseconds), ionMobilityDriftTime (in milliseconds), isolationWindowTargetMZ, isolationWindowLowerOffset, isolationWindowUpperOffset, scanWindowLowerLimit and scanWindowUpperLimit. If multiple scans are queried, a data.frame is returned with the scans reported along the rows. For missing or not defined spectrum variables NA is reported.

The get3Dmap function performs a simple resampling between lowMz and highMz with reMz resolution. A matrix of dimensions length(scans) times seq(lowMz,highMz,resMz) is returned.

The chromatogram (chromatograms) accessors return chromatograms for the MS file handle. If a single index is provided, as data.frame containing the retention time (1st columns) and intensities (2nd column) is returned. The name of the former is always time, while the latter will depend on the run parameters.

If more than 1 or no chromatogram indices are provided, then a list of chromatograms is returned; either those passed as argument or all of them. By default, the first (and possibly only) chromatogram is the total ion count, which can also be accessed with the tic method.

The nChrom function returns the number of chromatograms, including the total ion chromatogram.

The chromatogramHeader returns (similar to the header function for spectra) a data.frame with metadata information for the individual chromatograms. The data.frame has the columns: "chromatogramId" (the ID of the chromatogram as specified in the file), "chromatogramIndex" (the index of the chromatogram within the file), "polarity" (the polarity for the chromatogram, 0 for negative, +1 for positive and -1 for not set), "precursorIsolationWindowTargetMZ" (the isolation window m/z of the precursor), "precursorIsolationWindowLowerOffset", "precursorIsolationWindowUpperOffset" (lower and upper offset for the isolation window m/z), "precursorCollisionEnergy" (collision energy), "productIsolationWindowTargetMZ", "productIsolationWindowLowerOffset" and "productIsolationWindowUpperOffset" (definition of the m/z isolation window for the product).

Note that access to chromatograms is only supported in the pwiz backend.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 header(object, scans, ...)

 peaksCount(object, scans, ...)

 ## S4 method for signature 'mzRpwiz'
peaks(object, scans)
 ## S4 method for signature 'mzRramp'
peaks(object, scans)
 ## S4 method for signature 'mzRnetCDF'
peaks(object, scans)

 ## S4 method for signature 'mzRpwiz'
spectra(object, scans)   ## same as peaks
 ## S4 method for signature 'mzRramp'
spectra(object, scans)
 ## S4 method for signature 'mzRnetCDF'
spectra(object, scans)

 get3Dmap(object, scans, lowMz, highMz, resMz, ...)

 ## S4 method for signature 'mzRpwiz'
chromatogram(object, chrom)

 ## S4 method for signature 'mzRpwiz'
chromatograms(object, chrom)  ## same as chromatogram

 ## S4 method for signature 'mzRpwiz'
chromatogramHeader(object, chrom)

 tic(object, ...)

 nChrom(object)

Arguments

object

An instantiated mzR object.

scans

A numeric specifying which scans to return. Optional for the header, peaks, spectra and peaksCount methods. If ommited, the requested data for all peaks is returned.

lowMz, highMz

Numerics defining the m/z range to be returned.

resMz

a numeric defining the m/z resolution.

chrom

For chromatogram, chromatograms and chromatogramHeader: numeric specifying the index of the chromatograms to be extracted from the file. If omitted, data for all chromatograms is returned.

...

Other arguments. A scan parameter can be passed to peaks.

Details

The column acquisitionNum in the data.frame returned by the header method contains the index during the scan in which the signal from the spectrum was measured. The pwiz backend extracts this number from the spectrum's ID provided in the mzML file. In contrast, column seqNum contains the index of each spectrum within the file and is thus consecutively numbered. Spectra from files with multiple MS levels are linked to each other via their acquisitionNum: column precursorScanNum of an e.g. MS level 2 spectrum contains the acquisitionNum of the related MS level 1 spectrum.

Note

Spectrum identifiers are only specified in mzML files, thus, for all other file types the column "spectrumId" of the result data.frame returned by header contains "scan=" followed by the acquisition number of the spectrum. Also, only the pwiz backend supports extraction of the spectras' IDs from mzML files. Thus, only mzML files read with backend = "pwiz" provide the spectrum IDs defined in the file. The content of the spectrum identifier depends on the vendor and the instrument acquisition settings and is reported here as a character, in its raw form, without further parsing.

Author(s)

Steffen Neumann and Laurent Gatto

See Also

instrumentInfo for metadata access and the "mzR" class.

writeMSData and copyWriteMSData for functions to write MS data in mzML or mzXML format.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 library(msdata)
 filepath <- system.file("microtofq", package = "msdata")
 file <- list.files(filepath, pattern="MM14.mzML",
                     full.names=TRUE, recursive = TRUE)
 mz <- openMSfile(file)
 runInfo(mz)
 colnames(header(mz))
 close(mz)

 ## A shotgun LCMSMS experiment
 f <- proteomics(full.names = TRUE,
                 pattern = "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz")
 x <- openMSfile(f, backend = "pwiz")
 x
 nChrom(x)
 head(tic(x))
 head(chromatogram(x, 1L)) ## same as tic(x)
 str(chromatogram(x)) ## as a list

 p <- peaks(x) ## extract all peak information
 head(peaks(x, scan=4)) ## extract just peaks from the 4th scan

 ## An MRM experiment
 f <- proteomics(full.names = TRUE, pattern = "MRM")
 x <- openMSfile(f, backend = "pwiz")
 x
 nChrom(x)
 head(tic(x))
 head(chromatogram(x, 1L)) ## same as tic(x)
 str(chromatogram(x, 10:12))  

 ## get the header information for the chromatograms
 ch <- chromatogramHeader(x)
 head(ch)

Example output

Loading required package: Rcpp
$scanCount
[1] 112

$lowMz
[1] 0

$highMz
[1] 0

$dStartTime
[1] 270.334

$dEndTime
[1] 307.678

$msLevels
[1] 1

$startTimeStamp
[1] NA

 [1] "seqNum"                     "acquisitionNum"            
 [3] "msLevel"                    "polarity"                  
 [5] "peaksCount"                 "totIonCurrent"             
 [7] "retentionTime"              "basePeakMZ"                
 [9] "basePeakIntensity"          "collisionEnergy"           
[11] "ionisationEnergy"           "lowMZ"                     
[13] "highMZ"                     "precursorScanNum"          
[15] "precursorMZ"                "precursorCharge"           
[17] "precursorIntensity"         "mergedScan"                
[19] "mergedResultScanNum"        "mergedResultStartScanNum"  
[21] "mergedResultEndScanNum"     "injectionTime"             
[23] "filterString"               "spectrumId"                
[25] "centroided"                 "ionMobilityDriftTime"      
[27] "isolationWindowTargetMZ"    "isolationWindowLowerOffset"
[29] "isolationWindowUpperOffset" "scanWindowLowerLimit"      
[31] "scanWindowUpperLimit"      
Mass Spectrometry file handle.
Filename:  TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz 
Number of scans:  509 
[1] 1
        time     TIC
1 0.00764000 9187505
2 0.01620833 9118685
3 0.03087333 9247653
4 0.04570667 9195261
5 0.06020667 9202081
6 0.07487500 9451720
        time     TIC
1 0.00764000 9187505
2 0.01620833 9118685
3 0.03087333 9247653
4 0.04570667 9195261
5 0.06020667 9202081
6 0.07487500 9451720
List of 1
 $ :'data.frame':	7534 obs. of  2 variables:
  ..$ time: num [1:7534] 0.00764 0.01621 0.03087 0.04571 0.06021 ...
  ..$ TIC : num [1:7534] 9187505 9118685 9247653 9195261 9202081 ...
         [,1]      [,2]
[1,] 100.0999  467.1394
[2,] 100.5178  446.3754
[3,] 104.5826  406.7346
[4,] 110.0711 1762.0354
[5,] 111.9731  555.5806
[6,] 111.9800  385.0784
Mass Spectrometry file handle.
Filename:  MRM-standmix-5.mzML.gz 
Number of scans:  0 
[1] 138
          time      TIC
1 1.666667e-05 45.37833
2 4.233333e-03 44.39301
3 8.450000e-03 45.33704
4 1.266667e-02 44.30909
5 1.686667e-02 45.40231
6 2.108333e-02 44.29813
          time      TIC
1 1.666667e-05 45.37833
2 4.233333e-03 44.39301
3 8.450000e-03 45.33704
4 1.266667e-02 44.30909
5 1.686667e-02 45.40231
6 2.108333e-02 44.29813
List of 3
 $ :'data.frame':	1073 obs. of  2 variables:
  ..$ time                                                        : num [1:1073] 0.00423 0.01267 0.02108 0.02952 0.03795 ...
  ..$ X..SRM.SIC.Q1.134.Q3.91.996.start.0.004233333333.end.9.77305: num [1:1073] 44.4 44.3 44.3 44.1 44.1 ...
 $ :'data.frame':	1073 obs. of  2 variables:
  ..$ time                                                               : num [1:1073] 1.67e-05 8.45e-03 1.69e-02 2.53e-02 3.37e-02 ...
  ..$ X..SRM.SIC.Q1.134.Q3.106.996.start.1.666666667e.005.end.9.772783333: num [1:1073] 45.4 45.3 45.4 45.6 45.6 ...
 $ :'data.frame':	640 obs. of  2 variables:
  ..$ time                                                         : num [1:640] 3.46 3.47 3.48 3.49 3.5 ...
  ..$ X..SRM.SIC.Q1.135.Q3.64.996.start.3.461933333.end.9.467483333: num [1:640] 129 137 141 147 156 ...
                                                chromatogramId
1                                                          TIC
2      - SRM SIC Q1=89 Q3=40.996 start=5.21145 end=15.20321667
3  - SRM SIC Q1=89 Q3=42.996 start=5.211116667 end=15.20308333
4 - SRM SIC Q1=115 Q3=26.996 start=10.14841667 end=16.16721667
5 - SRM SIC Q1=115 Q3=70.996 start=10.14816667 end=16.16706667
6     - SRM SIC Q1=117 Q3=72.996 start=10.14793333 end=16.1428
  chromatogramIndex polarity precursorIsolationWindowTargetMZ
1                 1       -1                               NA
2                 2        0                               89
3                 3        0                               89
4                 4        0                              115
5                 5        0                              115
6                 6        0                              117
  precursorIsolationWindowLowerOffset precursorIsolationWindowUpperOffset
1                                  NA                                  NA
2                                  NA                                  NA
3                                  NA                                  NA
4                                  NA                                  NA
5                                  NA                                  NA
6                                  NA                                  NA
  precursorCollisionEnergy productIsolationWindowTargetMZ
1                       NA                             NA
2                       20                         40.996
3                       10                         42.996
4                       10                         26.996
5                        2                         70.996
6                       10                         72.996
  productIsolationWindowLowerOffset productIsolationWindowUpperOffset
1                                NA                                NA
2                                NA                                NA
3                                NA                                NA
4                                NA                                NA
5                                NA                                NA
6                                NA                                NA

mzR documentation built on Nov. 20, 2020, 2 a.m.