readChromatogram {rawrr} | R Documentation

## Extracts chromatographic data from a raw file.

### Description

Extracts chromatographic data from a raw file.

### Usage

    readChromatogram(rawfile, mass = NULL, tol = 10, filter = "ms", type = "xic")

### Arguments

`rawfile` | the file name.
`mass` | a vector of mass values iff `type = 'xic'`.
`tol` | mass tolerance in ppm iff `type = 'xic'`.
`filter` | defines the scan filter, default is `filter="ms"` if a wrong filter is set the function will return `NULL` and draws a warning.
`type` | `c(xic, bpc, tic)` for extracted ion , base peak or total ion chromatogram.

### Details

Chromatograms come in different flavors but are always signal intensity values as a function of time. Signal intensities can be point estimates from scanning detectors or plain intensities from non-scanning detectors, e.g., UV trace. Scanning detector (mass analyzers) point estimates can be defined in different ways by, for instance, summing all signals of a given spectrum (total ion chromatogram or TIC), or by extracting signal around an expected value (extracted ion chromatogram = XIC), or by using the maximum signal contained in a spectrum (base peak chromatogram = BPC). On top, chromatograms can be computed from pre-filtered lists of scans. A total ion chromatogram (TIC), for instance, is typically generated by iterating over all MS1-level scans.

### Value

chromatogram object(s) containing of a vector of `times` and a corresponding vector of `intensities`.

### Author(s)

Christian Trachsel, Tobias Kockmann and Christian Panse <cp@fgz.ethz.ch> 2018, 2019, 2020.

### References

Automated quality control sample 1 (autoQC01) analyzed across different Thermo Scientific mass spectrometers, MSV000086542.

### See Also

- The Thermo Fisher Scientific RawFileReader C# code snippets https://planetorbitrap.com/rawfilereader.

- https://CRAN.R-project.org/package=protViz

- https://massive.ucsd.edu/ProteoSAFe/dataset.jsp?accession=MSV000086542

### Examples

    # Example 1: not meaningful but proof-of-concept
    (rawfile <- rawrr::sampleFilePath())

    rawrr::readChromatogram(rawfile, mass=c(669.8381, 726.8357), tol=1000) |> plot()
    rawrr::readChromatogram(rawfile, type='bpc') |> plot()
    rawrr::readChromatogram(rawfile, type='tic') |> plot()

    # Example 2: extract iRT peptides
     if (require(ExperimentHub) & require(protViz)){
    iRTpeptide <- c("LGGNEQVTR", "YILAGVENSK", "GTFIIDPGGVIR", "GTFIIDPAAVIR",
      "GAGSSEPVTGLDAK", "TPVISGGPYEYR", "VEATFGVDESNAK",
      "TPVITGAPYEYR", "DGLDAASYYAPVR", "ADVTPADFSEWSK",
      "LFLQFGAQGSPFLK")

    # fetch via ExperimentHub
    library(ExperimentHub)
    eh <- ExperimentHub::ExperimentHub()
    EH4547 <- normalizePath(eh[["EH4547"]])

    (rawfile <- paste0(EH4547, ".raw"))
    if (!file.exists(rawfile)){
        file.link(EH4547, rawfile)
    }
    op <- par(mfrow=c(2,1))
    readChromatogram(rawfile, type='bpc') |> plot()
    readChromatogram(rawfile, type='tic') |> plot()
    par(op)

    # derive [2H+] ions
    ((protViz::parentIonMass(iRTpeptide) + 1.008) / 2) |>
       readChromatogram(rawfile=rawfile) |>
       plot()
    }

[Package rawrr version 1.0.3 Index]