Recipe 2.8. Creating a peptide from molecules
Problem
You want to create a peptide from a list of molecules.
Solution
PeptideResidueManager can join a list of bio-elements such as N/C termini and its residues in a Peptide:
import org.expasy.jpl.core.mol.polymer.pept.PeptideResidueManager;
// get the manager unique instance
PeptideResidueManager manager =
PeptideResidueManager.getInstance();
// a list of molecules
List<Molecule> molecules =
new ArrayList<Molecule>();
// add bio elements
molecules.add(AminoAcid.RAD_P);
molecules.add(AminoAcid.RAD_E);
molecules.add(AminoAcid.RAD_P);
molecules.add(new ModifiedMolecule.Builder(AminoAcid.RAD_T,
ModificationFactory.valueOf(21.)).build());
molecules.add(AminoAcid.RAD_I);
molecules.add(AminoAcid.RAD_D);
molecules.add(AminoAcid.RAD_E);
molecules.add(new ModifiedMolecule.Builder(CTerminus.PEP_C,
ModificationFactory.valueOf(17.)).build());
// make the join and create a new instance of Peptide
Peptide pept = manager.join(l);
Assert.assertEquals("H_PEPT({21.00})IDE_HO({17.00})", pept.toString());
Discussion
See Also
See also how to create a ModifiedMolecule when modified amino-acids have to be inserted in the peptide.