Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ralfg/pyrawr
Python wrapper around the ThermoRawFileParser command line interface.
https://github.com/ralfg/pyrawr
mass-spectrometry proteomics raw thermorawfileparser
Last synced: 8 days ago
JSON representation
Python wrapper around the ThermoRawFileParser command line interface.
- Host: GitHub
- URL: https://github.com/ralfg/pyrawr
- Owner: RalfG
- License: apache-2.0
- Created: 2021-04-22T08:51:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-22T10:29:36.000Z (over 3 years ago)
- Last Synced: 2024-11-19T09:15:37.422Z (about 1 month ago)
- Topics: mass-spectrometry, proteomics, raw, thermorawfileparser
- Language: Python
- Homepage: https://pyrawr.readthedocs.io/
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# pyrawr
[![](https://flat.badgen.net/pypi/v/pyrawr?icon=pypi)](https://pypi.org/project/pyrawr)
[![](https://flat.badgen.net/github/release/ralfg/pyrawr)](https://github.com/ralfg/pyrawr/releases)
[![](https://flat.badgen.net/github/checks/ralfg/pyrawr/)](https://github.com/ralfg/pyrawr/actions)
![](https://flat.badgen.net/github/last-commit/ralfg/pyrawr)
![](https://flat.badgen.net/github/license/ralfg/pyrawr)Python wrapper around the
[ThermoRawFileParser](https://github.com/compomics/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
- Install pyrawr with pip
```sh
$ pip install pyrawr
```- Install [ThermoRawFileParser](https://github.com/compomics/ThermoRawFileParser) or
Docker.For Docker, the current user must be
[added to the Docker group](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user),
that is, be callable as `docker run`, instead of `sudo docker run`.## Usage
See
[full API documentation](https://pyrawr.readthedocs.io/en/latest/api.html)
for all pyrawr functionality.Parse raw file to any supported output format:
```python
>>> 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:
```python
>>> trfp.metadata("OR4_110719_OB_PAR14_sSCX_fr10.raw")
{'FileProperties': [{'accession': 'NCIT:C47922', 'cvLabel': 'NCIT' ... }]}
```Query a specific spectrum:
```python
>>> 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:
```python
>>> 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](https://github.com/RalfG/pyrawr/issues/) or to make a pull
request! See
[Contributing.md](https://pyrawr.readthedocs.io/en/latest/contributing.html)
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](https://pyrawr.readthedocs.io/en/latest/changelog.html).