Skip to content

lukasz-migas/msalign

Repository files navigation

msalign - signal calibration and alignment

Tests codecov CodeFactor Netlify Status

Wheel PyPI Versions Downloads

This package was inspired by MATLAB's msalign function which allows alignment of multiple signals to reference peaks.

Installation

Install from PyPi

pip install msalign

Install directly from GitHub

pip install -e git+https://github.com/lukasz-migas/msalign.git

Install in development mode

python setup.py develop

Usage

Usage is relatively straightforward. Simply import msalign from the package and provide x, array and peaks values. msalign accepts a lot of other parameters that might improve your alignment - simply provide them as keyword parameters.

import numpy as np
from msalign import msalign


filename = r"./example_data/msalign_test_data.csv"
data = np.genfromtxt(filename, delimiter=",")
x = data[1:, 0]
array = data[1:, 1:].T
peaks = [3991.4, 4598, 7964, 9160]

aligned = msalign(x, array, peaks, weights=[60, 100, 60, 100], only_shift=False)

spectrum

Zoom-in on each peak the spectrum was aligned against

peaks

Reference

Monchamp, P., Andrade-Cetto, L., Zhang, J.Y., and Henson, R. (2007) Signal Processing Methods for Mass Spectrometry. In Systems Bioinformatics: An Engineering Case-Based Approach, G. Alterovitz and M.F. Ramoni, eds. Artech House Publishers).

MATLAB's msalign

Citing msalign

If you find msalign useful in your research and wish to cite it, please use the following BibTex entry:

@software{msalign2024,
  author = {Lukasz G. Migas},
  title = {{msalign}: Spectral alignment based on MATLAB's `msalign` function.},
  url = {https://github.com/lukasz-migas/msalign},
  version = {0.2.0},
  year = {2024},
}

About

Python implementation of MATLAB's msalign function

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •