Pyteomics documentation v4.3a1

mztab - mzTab file reader

Contents

mztab - mzTab file reader

Summary

mzTab is one of the standards developed by the Proteomics Informatics working group of the HUPO Proteomics Standard Initiative.

This module provides a way to read mzTab files into a collection of pandas.DataFrame instances in memory, along with a mapping of the file-level metadata.

Data access

MzTab - a class representing a single mzTab file
class pyteomics.mztab.MzTab(path, encoding='utf8', table_format='df')[source]

Bases: pyteomics.mztab._MzTabParserBase

Parser for mzTab format files.

Attributes:
comments : list

A list of comments across the file

file : _file_obj

A file stream wrapper for the file to be read

metadata : OrderedDict

A mapping of metadata that was entities.

peptide_table : _MzTabTable or pd.DataFrame

The table of peptides. Not commonly used.

protein_table : _MzTabTable or pd.DataFrame

The table of protein identifications.

small_molecule_table : _MzTabTable or pd.DataFrame

The table of small molecule identifications.

spectrum_match_table : _MzTabTable or pd.DataFrame

The table of spectrum-to-peptide match identifications.

table_format: ‘df’, ‘dict’, or callable

The structure type to replace each table with. The string ‘df’ will use pd.DataFrame instances. ‘dict’ will create a dictionary of dictionaries for each table. A callable will be called on each raw _MzTabTable object

Methods

collapse_properties(self, proplist) Collapse a flat property list into a hierchical structure.
items  
keys  
values  
__init__(self, path, encoding='utf8', table_format='df')[source]

Initialize self. See help(type(self)) for accurate signature.

collapse_properties(self, proplist)[source]

Collapse a flat property list into a hierchical structure.

This is intended to operate on Mapping objects, including dict, pandas.Series and pandas.DataFrame.

{
  "ms_run[1]-format": "Andromeda:apl file format",
  "ms_run[1]-location": "file://...",
  "ms_run[1]-id_format": "scan number only nativeID format"
}

to

{
  "ms_run": [
    {
      "format": "Andromeda:apl file format",
      "location": "file://...",
      "id_format": "scan number only nativeID format"
    }
  ]
}
Parameters:
proplist: :class:`Mapping`

Key-Value pairs to collapse

Returns:
OrderedDict:

The collapsed property list

Contents