precursorMzDeviations.add(precursorMzError);
Integer charge = peptideAssumption.getIdentificationCharge().value;
if (!charges.contains(charge)) {
charges.add(charge);
PsmFilter psmFilter = new PsmFilter(">30% Fragment Ion Sequence Coverage");
psmFilter.setDescription("<30% sequence coverage by fragment ions");
psmFilter.setSequenceCoverage(30.0); // @TODO: make the doubtfulThreshold editable by the user!
psmFilter.setSequenceCoverageComparison(RowFilter.ComparisonType.AFTER);
psmMap.addDoubtfulMatchesFilter(charge, spectrumFileName, psmFilter);
}
if (inputMap != null) {
Peptide bestPeptide = peptideAssumption.getPeptide();
ArrayList<Integer> agreementAdvocates = new ArrayList<Integer>();
for (int advocateId : spectrumMatch.getAdvocates()) {
for (SpectrumIdentificationAssumption spectrumIdentificationAssumption : spectrumMatch.getFirstHits(advocateId)) {
if (spectrumIdentificationAssumption instanceof PeptideAssumption) {
Peptide advocatePeptide = ((PeptideAssumption) spectrumIdentificationAssumption).getPeptide();
if (bestPeptide.isSameSequenceAndModificationStatus(advocatePeptide, sequenceMatchingPreferences)) {
agreementAdvocates.add(advocateId);
break;
}
}
}
}
boolean unique = agreementAdvocates.size() == 1;
for (int advocateId : agreementAdvocates) {
inputMap.addAdvocateContribution(advocateId, spectrumFileName, unique);
}
inputMap.addAdvocateContribution(Advocate.peptideShaker.getIndex(), spectrumFileName, agreementAdvocates.isEmpty());
}
}
}
// go through the peptide assumptions
if (inputMap != null) { //backward compatibility check
SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
for (Integer advocateId : spectrumMatch.getAdvocates()) {
HashMap<Double, ArrayList<SpectrumIdentificationAssumption>> assumptions = spectrumMatch.getAllAssumptions(advocateId);
for (double eValue : assumptions.keySet()) {
for (SpectrumIdentificationAssumption spectrumIdAssumption : assumptions.get(eValue)) {
if (spectrumIdAssumption instanceof PeptideAssumption) {
PeptideAssumption peptideAssumption = (PeptideAssumption) spectrumIdAssumption;
updatePeptideAssumptionValidationLevel(identificationFeaturesGenerator, searchParameters, annotationPreferences, inputMap, spectrumKey, peptideAssumption, peptideSpectrumAnnotator);
} else if (spectrumIdAssumption instanceof TagAssumption) {
TagAssumption tagAssumption = (TagAssumption) spectrumIdAssumption;
updateTagAssumptionValidationLevel(identificationFeaturesGenerator, searchParameters, annotationPreferences, inputMap, spectrumKey, tagAssumption);
}
}
}
}
}
if (waitingHandler != null) {
waitingHandler.increaseSecondaryProgressCounter();
if (waitingHandler.isRunCanceled()) {
return;
}
}
}
// check if we should narrow the mass accuracy window, if yes, do a second pass validation
if (!precursorMzDeviations.isEmpty()) {
NonSymmetricalNormalDistribution precDeviationDistribution = NonSymmetricalNormalDistribution.getRobustNonSymmetricalNormalDistribution(precursorMzDeviations);
Double minDeviation = precDeviationDistribution.getMinValueForProbability(0.0001);
Double maxDeviation = precDeviationDistribution.getMaxValueForProbability(0.0001);
boolean needSecondPass = false;
if (minDeviation < maxDeviation) {
String unit = "ppm";
if (!searchParameters.isPrecursorAccuracyTypePpm()) {
unit = "Da";
}
if (minDeviation != Double.NaN && minDeviation > -searchParameters.getPrecursorAccuracy()) {
needSecondPass = true;
PsmFilter psmFilter = new PsmFilter("Precursor m/z deviation > " + Util.roundDouble(minDeviation, 2) + " " + unit);
psmFilter.setDescription("Precursor m/z deviation < " + Util.roundDouble(minDeviation, 2) + " " + unit);
psmFilter.setMinPrecursorMzError(minDeviation);
psmFilter.setPrecursorMinMzErrorComparison(RowFilter.ComparisonType.AFTER);
for (int charge : charges) {
psmMap.addDoubtfulMatchesFilter(charge, spectrumFileName, psmFilter);
}
}
if (minDeviation != Double.NaN && maxDeviation < searchParameters.getPrecursorAccuracy()) {
needSecondPass = true;
PsmFilter psmFilter = new PsmFilter("Precursor m/z deviation < " + Util.roundDouble(maxDeviation, 2) + " " + unit);
psmFilter.setDescription("Precursor m/z deviation > " + Util.roundDouble(maxDeviation, 2) + " " + unit);
psmFilter.setMaxPrecursorMzError(maxDeviation);
psmFilter.setPrecursorMaxMzErrorComparison(RowFilter.ComparisonType.BEFORE);
for (int charge : charges) {
psmMap.addDoubtfulMatchesFilter(charge, spectrumFileName, psmFilter);
}
}
}