Pyteomics documentation v3.4.2

ms1 - read and write MS/MS data in MS1 format

«  mgf - read and write MS/MS data in Mascot Generic Format   ::   Contents   ::   pepxml - pepXML file reader  »

ms1 - read and write MS/MS data in MS1 format

Summary

MS1 is a simple human-readable format for MS1 data. It allows storing MS1 peak lists and exprimental parameters.

This module provides minimalistic infrastructure for access to data stored in MS1 files. The most important function is read(), which reads spectra and related information as saves them into human-readable dicts. Also, common parameters can be read from MS1 file header with read_header() function.

Functions

read() - iterate through spectra in MS1 file. Data from a single spectrum are converted to a human-readable dict.

chain() - read multiple files at once.

chain.from_iterable() - read multiple files at once, using an iterable of files.

read_header() - get a dict with common parameters for all spectra from the beginning of MS1 file.


pyteomics.ms1.chain(*args, **kwargs)

Chain read() for several files. Positional arguments should be file names or file objects. Keyword arguments are passed to the read() function.

chain.from_iterable(files, **kwargs)

Chain read() for several files. Keyword arguments are passed to the read() function.

Parameters:

files : iterable

Iterable of file names or file objects.

pyteomics.ms1.read(*args, **kwargs)[source]

Read an MS1 file and return entries iteratively.

Read the specified MS1 file, yield spectra one by one. Each ‘spectrum’ is a dict with three keys: ‘m/z array’, ‘intensity array’, and ‘params’. ‘m/z array’ and ‘intensity array’ store numpy.ndarray’s of floats, and ‘params’ stores a dict of parameters.

Parameters:

source : str or file or None, optional

A file object (or file name) with data in MS1 format. Default is None, which means read standard input.

use_header : bool, optional

Add the info from file header to each dict. Spectrum-specific parameters override those from the header in case of conflict. Default is False.

convert_arrays : bool, optional

If False, m/z and intensities will be returned as regular lists. If True (default), they will be converted to regular numpy.ndarray’s. Conversion requires numpy.

dtype : type or str or dict, optional

dtype argument to numpy array constructor, one for all arrays or one for each key. Keys should be ‘m/z array’ and/or ‘intensity array’.

Returns:

out : FileReader

pyteomics.ms1.read_header(*args, **kwargs)[source]

Read the specified MS1 file, get the parameters specified in the header as a dict.

Parameters:

source : str or file

File name or file object representing an file in MS1 format.

Returns:

header : dict

«  mgf - read and write MS/MS data in Mascot Generic Format   ::   Contents   ::   pepxml - pepXML file reader  »