Processing of mass spectrometry imaging and micro X-Ray fluorescence data.
Project description
Mass Spectrometry Imaging Workflow (maspim)
maspim is a python package that allows users to read, process and interpret mass spectrometry imaging (MSI) data from Bruker instruments.
This package implements methods to process mass spectra, combine them with image information or other measurements (such as micro X-Ray fluorescence, µXRF) and special functionality for laminated sediments to combine spectra in the same layers.
Prerequisites
Before you begin, ensure you have met the following requirements:
-
You have a version of
python3installed (preferentially the up-to-date version) -
You have
Rinstalled -
You have the
Rpackagertmsinstalled
You may also want to check out msiAlign, which is not directly a prerequisite, but useful for setting the punch-holes when the automatic detection fails and msi_feature_extraction if you want to work with exported txt files from DataAnalysis.
Installing maspim
maspim is now on PyPI. E.g. run
pip install maspim
to install the basic version of maspim. Processing raw MALDI data depends on the R package rtms. If you need that functionality, run
pip install maspim['all']
or, equivalently
pip install maspim rpy2==3.5.12
Also, checkout our github page for the up-to-date version and additional resources.
To get the freshest version, run
pip install git+https://github.com/yaza11/maspim.git
in your console.
Using maspim
This is just a quick overview. For more comprehensive tutorials please have a look at the Notebooks.
Generally it is advised to stick to the objects provided at the top level of maspim, which are
-
ProjectMSIandProjectXRFto manage MSI and µXRF measurements respectively and fetched with theget_projectfunction -
ImageSample,ImageROIandImageClassifiedto set photo properties and finding the sample area -
Transformationto register images -
ReadBrukerMCFandhdf5handlerfor reading and storing data files. -
Spectrato extract intensities from the mass spectra -
MSIandXRFfor handling MSI and µXRF measurements. -
XRayfor adding information from an X-Ray -
AgeModelto set an age model
and a few others. ProjectMSI and ProjectXRF are the core objects of this package, which manage most of the aforementioned objects. So unless you have a very specific application in mind, it is recommended to do everything with the methods provided by ProjectMSI and ProjectXRF.
Let's look at a short example of how to define the ${U_{37}^{k}}^\prime$ proxy, which you can use to check that your installation worked.
from maspim import get_project
from maspim.res.compound_masses import mC37_2, mC37_3
p = get_project(is_MSI=True, path_folder='path/to/your/measurement.i', is_laminated=False)
# sets or loads ImageHandler, ImageSample, ImageROI and ImageClassified
p.require_images()
# perform all steps to extract intensities from alkenones
p.set_spectra(targets=[mC37_2, mC37_3], suppress_warnings=True)
p.set_data_object()
p.add_pixels_ROI()
# we did not provide any ages, so a time series does not make much sense, but
# this is just a test, so don't try to interpret the results
p.set_time_series(average_by_col='x', is_continuous=True)
p.set_UK37(method_SST='prahl', n_successes_required=0)
# we can use the index instead of the age for now
p.uk37_proxy.feature_table.loc[:, 'age'] = p.uk37_proxy.feature_table.x
# you should see a plot after this
p.uk37_proxy.plot_comp('SST', errors=False)
Contributing to maspim
If you find any bugs or missing features, you are welcome to contribute to maspim, just follow these steps:
-
Fork this repository.
-
Create a branch:
git checkout -b <branch_name>. -
Make your changes and commit them:
git commit -m '<commit_message>' -
Push to the original branch:
git push origin <project_name>/<location> -
Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
Contributors
Thanks to @weimin-liu who has contributed to this project.
Contact
Feel free to reach out at me via yzander@marum.de.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maspim-1.3.2.tar.gz.
File metadata
- Download URL: maspim-1.3.2.tar.gz
- Upload date:
- Size: 262.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69327a8fe13f32883935919e01b46789e0021647bf38434aa69f6ba0a142fd17
|
|
| MD5 |
086d7128b275d6afcb87ad4ec03e044c
|
|
| BLAKE2b-256 |
7fa4e0bdddb50034c1eb859076e59b5af71ccb6698f6780e52d67060a749d7f2
|
File details
Details for the file maspim-1.3.2-py3-none-any.whl.
File metadata
- Download URL: maspim-1.3.2-py3-none-any.whl
- Upload date:
- Size: 293.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a24a632fbae0215ccbb51c06f860aaa5b28bae736952b121790539b2d9e2507a
|
|
| MD5 |
3853894f1cb5a42f1fe77d293ca3cc3c
|
|
| BLAKE2b-256 |
baede760ea4fb96d2e29e0a8a527fd08a781b99fe993bacc6249d48120491955
|