Skip to main content

Python wrapper around the ThermoRawFileParser command line interface

Project description

pyrawr

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.


Installation

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

Usage

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="quay.io/biocontainers/thermorawfileparser:1.3.3--ha8f3691_1"
... )
>>> 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,
   262.4529113769531,
   309.53961181640625,
   ...

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,
    0.022771666666666666,
    0.036936666666666666,
    ...

Contributing

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

This module currently uses Python's subprocess.run() 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.

Changelog

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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file pyrawr-0.1.0.tar.gz.

File metadata

  • Download URL: pyrawr-0.1.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1046-azure

File hashes

Hashes for pyrawr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8c3c6ca41c592d8ca42ce3bf5c540374655f413a4f539041b2fa9c700aa0bc5
MD5 9ca53c7b9cfd918a277037a8c7e75f16
BLAKE2b-256 2508f097116e0c7c9f6bdcb31db4468f0938c87ae3643d84ac5d18af68b9ca7c

See more details on using hashes here.

File details

Details for the file pyrawr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyrawr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.4 Linux/5.4.0-1046-azure

File hashes

Hashes for pyrawr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2394233f6b347d384c71a40e75a015ddadf7a44b34f59acb4a54fb5c3d3e3a01
MD5 3e635c05430758ca3921de3459e3111c
BLAKE2b-256 972226f1e3d6297a2c5a8518c0e7cb5277b7ad29050586510dd0003b3f59fe93

See more details on using hashes here.

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