Opened 7 years ago

#608 new task

Use mzjava to compare spectra in spectrum libs

Reported by: Rene Ranzinger Owned by:
Priority: normal Milestone: Wish list
Component: GRITS core Version: GRITS 1.1.x
Severity: major Keywords:


Davide forwarded me your email with questions about MzJava.

  • I have a Thermo RAW data file (or alternative an mzXML) and I want to batch generate peaklists for all the 400 MS1, MS2 and MS3 scans in the file.

For this we use mscovert. What I usually do is the following:

msconvert.exe "source_dir"\*.raw -o mzxml --filter "peakPicking true 1-" false" --filter "zeroSamples removeExtra" --filter "msLevel 2-" --mzXML > mscovert.log

This converts all raw files in source_dir to mzXML. During the conversion the spectra are centroided and all peaks with 0 intensity are removed and only MS2 spectra are kept.

  • I have two MS scans (or alternative peaklists) and want to calculate the similarity of the two scans (spectrum matching). If the java MS library has functionality that can do this it would be nice to have some example code that shows how to call this functionality to get me started. Thank you for your help, René

The code to calculate spectrum similarity is:

final Spectrum spectrum1 = ...;
final Spectrum spectrum2 = ...;

final SimFunc<PeakAnnotation, PeakAnnotation> simFunc = new NdpSimFunc<>(0, new AbsoluteTolerance(0.3));

double sim = simFunc.calcSimilarity(spectrum1, spectrum2);

The NdpSimFunc calculates the normalized dot product and uses a fragment tolerance of 0.3 Da to align the two spectra. As well as calculating similarity MzJava also has functionality for pre processing the spectra. The best resource for more information is the MzJava paper or the webpage at

Let me know if you have further questions.

Change History (0)

Note: See TracTickets for help on using tickets.