get_scan_metadata: Creates the "Scan Metadata" object from an MS file

View source: R/get_scan_metadata.R

get_scan_metadataR Documentation

Creates the "Scan Metadata" object from an MS file

Description

Aligns both MS and ID metadata per scan number. MS data is required. ID data is optional.

Usage

get_scan_metadata(MSPath, IDPath = NULL)

Arguments

MSPath

Data path to the MS file. Currently, mzML, mzXML, and raw are supported.

IDPath

Data path to the ID file. Currently, mzID is supported.

Details

The data.table outputted by this function contains 16 main columns of data from both the MS and ID file.

Scan Number The number of the MS scan where scan 1 was taken at the first retention time.
MS Level Indiciates whether the scan is a MS1 (precursor) or MS2.
Retention Time The time, in minutes, that the fragment was eluted.
Precursor M/Z The M/Z value selected from the MS1 (precursor) scan to fragment for the MS2 scan. Will be NA for MS1 scans.
Precursor Charge The Z value, charge, from the selected MS1 (precursor) scan. Will be NA for MS1 scans.
Precursor Scan The MS1 scan number that the MS2 scan was fractioned from. Will be NA for MS1 scans.
Activation Method A string to indicate which activation (dissociation) method was used to fragment the proteins.
Sequence The amino acid sequence (fragment) assigned to the MS2 scan. Only included if IDPath is supplied.
Protein ID The name of the protein that the amino acid sequence is from. Only included if the IDPath is supplied.
Calculated Mass The calculated, or expected, mass of the peptide fragment. Only included if the IDPath is supplied.
Experimental Mass The experimental, or actual, mass that was matched in the MS2 file. Only included if the IDPath is supplied.
Score A measure of how well the calculated and experimental spectra match. A lower score is better. Only included if the IDPath is supplied.
Q Value An adjusted p-value that also measures how well the calculated and experimental spectra match. A lower score is preferred. Only included if the IDPath is supplied.
Decoy A logical (TRUE/FALSE/NA) indicating whether the identified protein is a protein decoy or not.
Modifications A string indicating whether a modification was identified or not. The format is "Name@Position=MW & Name2@Position2=MW2" etc

Objects of the class "scan_metadata" contain attributes that are referenced by downstream functions. The attributes are as follows:

MSPath The path the user supplied in the MSPath parameter.
IDPath The path the user supplied in the IDPath parameter. Default is NULL.
MSFileType A flag to indicate whether the inputted MS file is XML-based (will be read with the mzR package) or RAW (will be read with the rawrr package).
MSnbase An object from the MSnbase package used to pull XIC data when the MSFileType is XML. If not, then this attribute will be NULL.
MS1Scans An integer vector listing all the MS1 scans in order. Used by the MS1Plots function.

Examples

## Not run: 

# Create a temporary directory and copy example data there
tmpdir <- tempdir()

files <- c(
 "https://raw.githubusercontent.com/EMSL-Computing/PSpecteR/master/pspecter_container/TestFiles/BottomUp/BottomUp.mzML",
 "https://raw.githubusercontent.com/EMSL-Computing/PSpecteR/master/pspecter_container/TestFiles/BottomUp/BottomUp.mzid",
 "https://raw.githubusercontent.com/EMSL-Computing/PSpecteR/master/pspecter_container/TestFiles/TopDown/TopDown.mzML",
 "https://raw.githubusercontent.com/EMSL-Computing/PSpecteR/master/pspecter_container/TestFiles/TopDown/TopDown.mzid"
)

for (file in files) {
  download.file(file, file.path(tmpdir, tail(unlist(strsplit(file, "/")), 1)))
}

# Test with bottom up data
BU_ScanMetadata <- get_scan_metadata(MSPath = file.path(tmpdir, "BottomUp.mzML"),
                                     IDPath = file.path(tmpdir, "BottomUp.mzid"))

# Test with top down data
TD_ScanMetadata <- get_scan_metadata(MSPath = file.path(tmpdir, "TopDown.mzML"),
                                     IDPath = file.path(tmpdir, "TopDown.mzid"))

# Test with raw top down data
library(rawrr)
rawfile <- file.path(path.package(package = 'rawrr'), 'extdata', 'sample.raw')
RAW_ScanMetadata <- get_scan_metadata(MSPath = rawfile)


## End(Not run)


EMSL-Computing/pspecterlib documentation built on Jan. 28, 2024, 8:13 p.m.