}
}
}
} else if (tagComponent instanceof AminoAcidSequence) {
AminoAcidSequence aminoAcidSequence = (AminoAcidSequence) tagComponent;
for (int aa : aminoAcidSequence.getModificationIndexes()) {
for (ModificationMatch modificationMatch : aminoAcidSequence.getModificationsAt(aa)) {
if (modificationMatch.isVariable()) {
if (advocateId == Advocate.pepnovo.getIndex()) {
String pepnovoPtmName = modificationMatch.getTheoreticPtm();
PepnovoParameters pepnovoParameters = (PepnovoParameters) searchParameters.getIdentificationAlgorithmParameter(advocateId);
String utilitiesPtmName = pepnovoParameters.getUtilitiesPtmName(pepnovoPtmName);
if (utilitiesPtmName == null) {
throw new IllegalArgumentException("PepNovo+ PTM " + pepnovoPtmName + " not recognized.");
}
modificationMatch.setTheoreticPtm(utilitiesPtmName);
} else if (advocateId == Advocate.direcTag.getIndex()) {
Integer directagIndex = new Integer(modificationMatch.getTheoreticPtm());
String utilitiesPtmName = searchParameters.getModificationProfile().getVariableModifications().get(directagIndex);
if (utilitiesPtmName == null) {
throw new IllegalArgumentException("DirecTag PTM " + directagIndex + " not recognized.");
}
modificationMatch.setTheoreticPtm(utilitiesPtmName);
PTM ptm = ptmFactory.getPTM(utilitiesPtmName);
ArrayList<Character> aaAtTarget = ptm.getPattern().getAminoAcidsAtTarget();
if (aaAtTarget.size() > 1) {
throw new IllegalArgumentException("More than one amino acid can be targeted by the modification " + ptm + ", tag duplication required.");
}
int aaIndex = aa - 1;
aminoAcidSequence.setAaAtIndex(aaIndex, aaAtTarget.get(0));
} else {
Advocate notImplemented = Advocate.getAdvocate(advocateId);
if (notImplemented == null) {
throw new IllegalArgumentException("Advocate of id " + advocateId + " not recognized.");
}