2.3 Read mgf File - PRIDE-Utilities/ms-data-core-api GitHub Wiki
/** Retrieve all the spectra frm the mgf**/
PeakControllerImpl peakController = new PeakControllerImpl(inputFile);
for(Comparable id: peakController.getSpectrumIds()){
Spectrum spectrum = peakController.getSpectrumById(id);
if(spectrum != null)
System.out.println("Spectrum id: " + id + " Number of Peaks: " + spectrum.getMassIntensityMap().length);
}