Skip to main content

Python wrapper around the ThermoRawFileParser command line interface

Project description


Python wrapper around the ThermoRawFileParser command line interface.

This Python module uses the ThermoRawFileParser CLI to retrieve general run metadata, specific spectra, or specific XICs, directly as Python lists and dictionaries from mass spectrometry raw files. Parsing raw files to other file formats is also supported.


For Docker, the current user must be added to the Docker group, that is, be callable as docker run, instead of sudo docker run.


See full API documentation for all pyrawr functionality.

Parse raw file to any supported output format:

>>> from pyrawr import ThermoRawFileParser
>>> trfp = ThermoRawFileParser(
...     executable="thermorawfileparser",
...     docker_image=""
... )
>>> trfp.parse("OR4_110719_OB_PAR14_sSCX_fr10.raw", output_format="mzml")

Get raw file metadata:

>>> trfp.metadata("OR4_110719_OB_PAR14_sSCX_fr10.raw")
{'FileProperties': [{'accession': 'NCIT:C47922', 'cvLabel': 'NCIT' ... }]}

Query a specific spectrum:

>>> trfp.query("OR4_110719_OB_PAR14_sSCX_fr10.raw", "508,680")
[{'mzs': [204.8467254638672,

Retrieve one or more chromatograms based on a query:

>>> trfp.xic(
...     "OR4_110719_OB_PAR14_sSCX_fr10.raw",
...     [{"mz":488.5384, "tolerance":10, "tolerance_unit":"ppm"}],
... )
{'OutputMeta': {'base64': False, 'timeunit': 'minutes'},
 'Content': [{'Meta': {'MzStart': 488.53351461600005,
    'MzEnd': 488.543285384,
    'RtStart': 0.007536666666666666,
    'RtEnd': 179.99577166666666},
   'RetentionTimes': [0.007536666666666666,


Bugs, questions or suggestions? Feel free to post an issue in the issue tracker or to make a pull request! See for more info.

This module currently uses Python's to access ThermoRawFileParser. There are probably much better methods that would directly access the ThermoRawFileParser library, circumventing the CLI. Suggestions and PRs are always welcome.


See Changelog.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrawr-0.1.0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

pyrawr-0.1.0-py3-none-any.whl (8.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page