Recipe 2.9. Shuffling a peptide
Problem
You want to shuffle a peptide.
Solution
PeptideResidueManager propose methods to shuffle Peptides:
import org.expasy.jpl.core.mol.polymer.pept.PeptideResidueManager; // the peptide to shuffle Peptide peptide = new Peptide.Builder("H_A({128.10})CHUHEUHU({11.90})RHE_OH") .build(); // generate 5 peptides for (int i = 0; i < 5; i++) { Peptide shuffled = manager.shuffle(peptide); System.out.println(shuffled); } // output H_EHRA({128.10})CHHHUUU({11.90})E_HO H_HU({11.90})HHREUA({128.10})CHUE_HO H_HUU({11.90})HREEUCHA({128.10})H_HO H_CEHU({11.90})A({128.10})HHRHUUE_HO H_RA({128.10})HHEUEU({11.90})HUHC_HO
It is also possible to fixed some positions and while scrambling the others:
// the peptide to shuffle Peptide peptide = new Peptide.Builder("H_A({128.10})CHUHEUHU({11.90})RHE_OH") .build(); // generate 5 peptides with positions 0 and 8 fixed for (int i = 0; i < 5; i++) { Peptide shuffled = manager.shuffle(peptide, new HashSet<Integer>(Arrays.asList(0,8))); System.out.println(shuffled); } // output H_A({128.10})CHHHUUEU({11.90})RHE_HO H_A({128.10})HCEEHURU({11.90})HUH_HO H_A({128.10})ERHHUUHU({11.90})HEC_HO H_A({128.10})UUCHEEHU({11.90})HRH_HO H_A({128.10})EHHCURHU({11.90})EUH_HO
Discussion
See Also