Tools for analysis of Mass Spectrometry data using the Wasserstein metric
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Wasserstein MS

This repository contains software tools which allow to:

  1. Compare two spectra using the Wasserstein distance (,
  2. Deconvolve a spectrum to obtain proportions of overlapping isotopic distributions (

If you encounter any difficulties during installation or usage of these programs, or if you have any suggestions regarding their functionality, please send an email to


To be able to use the software provided in this repository, you will need to have a working Python 2.7 distribution installed on your computer. You will also need to have the following packages installed (availiable on PIP):

  • IsoSpecPy
  • Numpy
  • Scipy

After installing these packages, simply download or clone this repository. On Ubuntu linux, this can be done by typing into the command line:

git clone

The above command will create a folder wassersteinms in your current working directory. The folder contains the programs and some example data.


This repository contains two programs: and At this moment, both programs are commandline applications, and no graphical interface is provided. Example data for both programs is available in the examples folder.

The application allows to compute the Wasserstein distance between two spectra. Intuitively, the Wasserstein distance is the total distance that the ion current needs to travel from one spectrum into the other. The spectra need to be supplied as peak lists in text files. The basic usage is as follows:

python spectrum1.txt spectrum2.txt

This will perform a basic normalization and denoising of the spectra and print the distance into the command line. Additional options include fine-tuning the denoising procedure and printing the transport scheme. More details and usage examples are available in the help message of the application, which can be obtained by typing python -h.

The allows to obtain proportions of overlapping isotopic distributions of several compounds. The user needs to supply a file with a peak list of the spectrum and a file listing the elemental compositions of the molecules that are to be deconvolved. The program will automatically compute the theoretical isotopic envelopes of the supplied molecules, using the IsoSpec algorithm. The basic usage is similar to

python spectrum.txt molecule_list.txt

This will print the program configuration, followed by a table containing the molecules and the corresponding proportions of their isotopic envelopes. Typing python will print the help message with description of additional options.

Note that when specifying the molecules in the molecule list, after each element a number needs to be present. For example, S1N2 is the correct way to indicate one sulfur and one nitrogen atom, while SN2 will be interpreted as two atoms of tin.


We thank Youzhong Liu for porting the code to Python 3.