public void addModification(int zero_based_index, double modMass) throws UnimodRepositoryException { ModificationType modType = new ModificationType(); modType.setLocation(zero_based_index + 1); List<String> residues = modType.getResidues(); residues.add(String.valueOf(sequence.charAt(zero_based_index))); modType.setMonoisotopicMassDelta(modMass); // get the Unimod entry for this modification ModT unimod_mod = unimodRepository.getModification( sequence.charAt(zero_based_index), modMass, UnimodRepository.DELTA_MASS_TOLERANCE_1, true); if (unimod_mod != null) { CvParamMaker paramMaker = CvParamMaker.getInstance(); CVParamType param = paramMaker.make( "UNIMOD:" + unimod_mod.getRecordId(), unimod_mod.getTitle(), CvConstants.UNIMOD_CV); modType.getCvParam().add(param); } modifications.add(modType); }