Module Development Tutorial

Let's demonstrate MZmine 2 module development by making a simple centroiding module. This module will take a continuous mode spectra represented by a continuous stream of data points which form m/z peaks, and convert it to centroided spectra, where each m/z peak is represened by a single data point (m/z and intensity pair). The algorithm used for centroiding is very simple: the intensity of all data points is summed over certain m/z interval and replaced with a single (centroid) data point. The width of this m/z interval will be the only parameter of our method.

We need to create 3 Java classes:
  • Centroider.java - this class is the core of the module and implements the MZmineModule interface
  • CentroiderParameters.java - this class contains the parameters of our method and implements the StorableParameterSet interface
  • CentroiderTask.java - this class contains the actual data processing logic (executed by the task controller) and implements the Task interface
Once compiled, the module has to be installed into the conf/config.xml file, for example by adding the following line in the <modules> section:
The commented source codes of these three classes follow:

Centroider.java source


CentroiderParameters.java source


CentroiderTask.java source