Skip to main content

imzy: A new reader interface to imzML and other imaging mass spectrometry formats.

Project description

imzy

Dependencies Status Python Version Python package index Python package index download statistics

Code style: black Security: bandit Pre-commit Code coverage Semantic Versions License

imzy: A simple reader interface to imzML, Bruker (.tdf/.tsf) file formats

Getting started

Install using pip

pip install imzy

Analyse your data

import numpy as np
from imzy import get_reader

# we currently support imzML, Bruker .d (.tsf/.tdf) formats
reader = get_reader(PATH_TO_FILE)
# will extract mass spectrum for pixel index '0'
mz_x, mz_y = reader.get_mass_spectrum(0)
# will extract summed mass spectrum for pixel indices 0-100
mz_x, mz_y = reader.get_summed_spectrum(np.arange(100))
# iterate over all mass spectra in the dataset
for mz_x, mz_y in reader.spectra_iter():
  ...
# get tic array
tic = reader.get_tic()
# this array is 1d so needs to be reshaped to 2d if you want to view it as an image
tic = reader.reshape(tic)
# will extract the 885.549 ion image with 10 ppm window around it
image = reader.get_ion_image(885.549, ppm=10)
# you can also extract multiple images at the same time (which is much more efficient since the spectra
# only need to be loaded into memory once)
mzs = [...] # list of m/zs to extract
images = reader.get_ion_images(mzs, tol=0.05)

Planned features

  • add functionality to readers
  • improve performance
  • improve tests
  • add better caching support
  • add support for Waters (.raw) files
  • add support for Thermo (.raw) files

Contributing

Initialize your code

  1. Initialize git inside your repo:
cd imzy && git init
  1. Create conda environment. We are using imzy as its name.
conda create -n imzy python=3.9
  1. Initialize and install pre-commit hooks:
make develop
make pre-commit-install
  1. Run the codestyle:
make codestyle
  1. Upload initial code to GitHub:
git add .
git commit -m ":tada: Initial commit"
git branch -M main
git remote add origin https://github.com/imzy/imzy.git
git push -u origin main

🛡 License

License

This project is licensed under the terms of the BSD-3 license. See LICENSE for more details.

📃 Citation

@misc{imzy,
  author = {imzy},
  title = {imzy: A new reader/writer interface to imzML and other imaging mass spectrometry formats.},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/imzy/imzy}}
}

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

imzy-0.2.0.tar.gz (9.4 MB view hashes)

Uploaded Source

Built Distribution

imzy-0.2.0-py3-none-any.whl (5.8 MB 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