Recipe 2.4. Adding modifications in polypeptide
Problem
You want to add modifications on peptides.
Solution
You need a manager to add modifications on peptides:
// a simple peptide (peptide type by default) Peptide peptide = new Peptide.Builder("MQRSTATGCFKL").build(); // get the modif manager ModifContainerManager modifManager = ModifContainerManager.getInstance(); // add modifications modifManager.addModifAt(peptide, ModificationFactory.valueOf(134), 5); modifManager.addCtModif(peptide, ModificationFactory.valueOf(16)); Assert.assertEquals("H_MQRSTA({134.00})TGCFKL_HO({16.00})", peptide.toString());
As some amino-acids are ionizable as some modifications:
import org.expasy.jpl.core.mol.modif.*; // a new ionizable modification IonizableModification phospho = IonizableModification.newInstance( ModificationFactory.withLabel("phosphorylation", ChemicalFacade.getMolecule("H2PO3")), new IonizableGroup.Builder(7.21, NeutralMoleculeType.ACID) .addPKa(12.67).build()); // a simple peptide Peptide peptide = new Peptide.Builder("QEAYEGK").build(); // the modif manager ModifContainerManager manager = ModifContainerManager.getInstance(); // add ionizable modif manager.addModifAt(peptide, phospho, 3); // toString() modif format // 1. default display is contextual (phospho is based on a formula): // => "H_QEAY(H2O3P)EGK_HO" System.out.println(peptide); // 2a. format can be defined at building time: peptide = new Peptide.Builder("QEAYEGK").doubleDisplayPrecision(2) .forceModifDoubleDisplay().build(); // 2b. ... or after building peptide: peptide.setModifFormatDisplay(new ModifFormat.Builder().decimal(2) .format(Format.DOUBLE).build()); // add ionizable modif manager.addModifAt(peptide, phospho, 3); // => "H_QEAY({80.97})EGK_HO" System.out.println(peptide); // display "partial charge at pH 7 = -1.6189328858092091" System.out.println("partial charge at pH 7 = "+ + BioPolymerUtils.getPartialCharges(peptide, 7));
Discussion
See Also
See also this recipe to create a modified peptide at building time or this one to create modifications.