2.1 Read mzIdentML File - PRIDE-Utilities/ms-data-core-api GitHub Wiki

/** Create an mzIdentML file **/ 
MzIdentMLControllerImpl mzIdentMlController = new MzIdentMLControllerImpl(inputFile, true);

/** Create the Spectra files **/
List<File> fileList = new ArrayList<File>();
fileList.add(filems);

/** Add MS files **/         
mzIdentMlController.addMSController(fileList);
        

/** Read the spectra **/

for(Comparable id: mzIdentMlController.getSpectrumIds()){
      Spectrum spectrum = mzIdentMlController.getSpectrumById(id);
      if(spectrum != null)
           System.out.println("Spectrum id: " + id + " Number of Peaks: " + spectrum.getMassIntensityMap().length);
}

/** Print Peptide sequence for all Peptides for every protein identification **/

Collection<Comparable> proteinIds = mzIdentMlController.getProteinIds();
for(Comparable proteinID: proteinIds){
     Collection<Comparable> peptideIds = mzIdentMlController.getPeptideIds(proteinID);
     for(Comparable peptideId: peptideIds)
  System.out.println(mzIdentMlController.getPeptideSequence(proteinID,peptideId));
}
⚠️ **GitHub.com Fallback** ⚠️