break;
}
SpectrumMatch spectrumMatch = identification.getSpectrumMatch(psmKey);
psParameter = (PSParameter) identification.getSpectrumMatchParameter(psmKey, psParameter);
PeptideAssumption bestAssumption = spectrumMatch.getBestPeptideAssumption();
writer.write(++psmCounter + SEPARATOR);
String proteinAccessions = "";
String proteinDescriptions = "";
for (String protein : bestAssumption.getPeptide().getParentProteins(peptideShakerGUI.getSequenceMatchingPreferences())) {
if (!proteinAccessions.equals("")) {
proteinAccessions += ", ";
proteinDescriptions += "; ";
}
proteinAccessions += protein;
proteinDescriptions += sequenceFactory.getHeader(protein).getSimpleProteinDescription();
}
writer.write(proteinAccessions + SEPARATOR);
writer.write(proteinDescriptions + SEPARATOR);
String sequence = bestAssumption.getPeptide().getSequence();
writer.write(sequence + SEPARATOR);
HashMap<String, ArrayList<Integer>> modMap = new HashMap<String, ArrayList<Integer>>();
for (ModificationMatch modificationMatch : bestAssumption.getPeptide().getModificationMatches()) {
if (modificationMatch.isVariable()) {
if (!modMap.containsKey(modificationMatch.getTheoreticPtm())) {
modMap.put(modificationMatch.getTheoreticPtm(), new ArrayList<Integer>());
}
modMap.get(modificationMatch.getTheoreticPtm()).add(modificationMatch.getModificationSite());
}
}
boolean first = true, first2;
ArrayList<String> mods = new ArrayList<String>(modMap.keySet());
Collections.sort(mods);
for (String mod : mods) {
if (first) {
first = false;
} else {
writer.write(", ");
}
first2 = true;
writer.write(mod + "(");
for (int aa : modMap.get(mod)) {
if (first2) {
first2 = false;
} else {
writer.write(", ");
}
writer.write(aa + "");
}
writer.write(")");
}
writer.write(SEPARATOR);
int nPhospho = 0;
ArrayList<String> modList = new ArrayList<String>();
for (ModificationMatch modificationMatch : bestAssumption.getPeptide().getModificationMatches()) {
if (modificationMatch.isVariable()) {
String ptmName = modificationMatch.getTheoreticPtm();
if (ptmName.contains("phospho")) {
nPhospho++;
}
PTM refPtm = ptmFactory.getPTM(ptmName);
for (String equivalentPtm : ptmProfile.getSimilarNotFixedModifications(refPtm.getMass())) {
if (!modList.contains(equivalentPtm)) {
modList.add(equivalentPtm);
}
}
}
}
Collections.sort(modList);
PSPtmScores ptmScores = new PSPtmScores();
first = true;
StringBuilder dLocalizations = new StringBuilder();
StringBuilder probabilisticLocalizations = new StringBuilder();
String mdLocation = "";
String mdScore = "";
String[] split = sequence.split("[STY]");
int nSites = split.length - 1;
ArrayList<String> phosphoNames = new ArrayList<String>();
for (String mod : modList) {
if (mod.contains("phospho")) {
phosphoNames.add(mod);
if (spectrumMatch.getUrParam(ptmScores) != null) {
ptmScores = (PSPtmScores) spectrumMatch.getUrParam(new PSPtmScores());
if (ptmScores != null && ptmScores.getPtmScoring(mod) != null) {
PtmScoring ptmScoring = ptmScores.getPtmScoring(mod);
ArrayList<Integer> sites = new ArrayList<Integer>(ptmScoring.getProbabilisticSites());
Collections.sort(sites);
for (Integer site : sites) {
if (probabilisticLocalizations.length() > 0) {
probabilisticLocalizations.append(", ");
}
probabilisticLocalizations.append(site.toString()).append(": ").append(ptmScoring.getProbabilisticScore(site));
}
sites = new ArrayList<Integer>(ptmScoring.getDSites());
Collections.sort(sites);
for (Integer site : sites) {
if (dLocalizations.length() > 0) {
dLocalizations.append(", ");
}
dLocalizations.append(site.toString()).append(": ").append(ptmScoring.getDeltaScore(site));
}
}
}
}
}
if (algorithms.size() == 1 && algorithms.get(0) == Advocate.mascot.getIndex()) {
if (!phosphoNames.isEmpty() && spectrumMatch.hasAssumption(Advocate.mascot.getIndex())) {
PeptideAssumption mascotAssumption = null;
double bestScore = 0;
for (ArrayList<SpectrumIdentificationAssumption> peptideAssumptionList : spectrumMatch.getAllAssumptions(Advocate.mascot.getIndex()).values()) {
for (SpectrumIdentificationAssumption assumption : peptideAssumptionList) {
PeptideAssumption peptideAssumption = (PeptideAssumption) assumption;
MascotScore mascotScore = new MascotScore();
mascotScore = (MascotScore) peptideAssumption.getUrParam(mascotScore);
if (mascotScore.getScore() > bestScore) {
mascotAssumption = peptideAssumption;
bestScore = mascotScore.getScore();
}
}