* @throws java.lang.ClassNotFoundException
* @throws java.lang.InterruptedException
*/
public static boolean isValidated(String peptideMatchKey, PeptideFilter peptideFilter, Identification identification, IdentificationFeaturesGenerator identificationFeaturesGenerator) throws SQLException, IOException, ClassNotFoundException, InterruptedException {
SequenceFactory sequenceFactory = SequenceFactory.getInstance();
if (peptideFilter.getExceptions().contains(peptideMatchKey)) {
return false;
}
if (peptideFilter.getManualValidation().size() > 0) {
return peptideFilter.getManualValidation().contains(peptideMatchKey);
}
if (peptideFilter.getModificationStatus() != null) {
boolean found = false;
for (String ptm : peptideFilter.getModificationStatus()) {
if (ptm.equals(PtmPanel.NO_MODIFICATION)) {
if (!Peptide.isModified(peptideMatchKey)) {
found = true;
break;
}
} else {
if (Peptide.isModified(peptideMatchKey, ptm)) {
found = true;
break;
}
}
}
if (!found) {
return false;
}
}
PSParameter psParameter = new PSParameter();
psParameter = (PSParameter) identification.getPeptideMatchParameter(peptideMatchKey, psParameter);
if (peptideFilter.getPi() != 5) {
if (peptideFilter.getPiComparison() == ComparisonType.NOT_EQUAL
&& psParameter.getProteinInferenceClass() == peptideFilter.getPi()) {
return false;
} else if (peptideFilter.getPiComparison() == ComparisonType.EQUAL
&& psParameter.getProteinInferenceClass() != peptideFilter.getPi()) {
return false;
}
}
if (peptideFilter.getPeptideScore() != null) {
if (peptideFilter.getPeptideScoreComparison() == ComparisonType.AFTER) {
if (psParameter.getPeptideScore() <= peptideFilter.getPeptideScore()) {
return false;
}
} else if (peptideFilter.getPeptideScoreComparison() == ComparisonType.BEFORE) {
if (psParameter.getPeptideScore() >= peptideFilter.getPeptideScore()) {
return false;
}
} else if (peptideFilter.getPeptideScoreComparison() == ComparisonType.EQUAL) {
if (psParameter.getPeptideScore() != peptideFilter.getPeptideScore()) {
return false;
}
} else if (peptideFilter.getPeptideScoreComparison() == ComparisonType.NOT_EQUAL) {
if (psParameter.getPeptideScore() == peptideFilter.getPeptideScore()) {
return false;
}
}
}
if (peptideFilter.getPeptideConfidence() != null) {
if (peptideFilter.getPeptideConfidenceComparison() == ComparisonType.AFTER) {
if (psParameter.getPeptideConfidence() <= peptideFilter.getPeptideConfidence()) {
return false;
}
} else if (peptideFilter.getPeptideConfidenceComparison() == ComparisonType.BEFORE) {
if (psParameter.getPeptideConfidence() >= peptideFilter.getPeptideConfidence()) {
return false;
}
} else if (peptideFilter.getPeptideConfidenceComparison() == ComparisonType.EQUAL) {
if (psParameter.getPeptideConfidence() != peptideFilter.getPeptideConfidence()) {
return false;
}
} else if (peptideFilter.getPeptideConfidenceComparison() == ComparisonType.NOT_EQUAL) {
if (psParameter.getPeptideConfidence() == peptideFilter.getPeptideConfidence()) {
return false;
}
}
}
if (peptideFilter.getNSpectra() != null
|| peptideFilter.getNValidatedSpectra() != null
|| peptideFilter.getNConfidentSpectra() != null
|| peptideFilter.getProtein() != null) {
PeptideMatch peptideMatch = identification.getPeptideMatch(peptideMatchKey);
if (peptideFilter.getNSpectra() != null) {
if (peptideFilter.getnSpectraComparison() == ComparisonType.AFTER) {
if (peptideMatch.getSpectrumCount() <= peptideFilter.getNSpectra()) {
return false;
}
} else if (peptideFilter.getnSpectraComparison() == ComparisonType.BEFORE) {
if (peptideMatch.getSpectrumCount() >= peptideFilter.getNSpectra()) {
return false;
}
} else if (peptideFilter.getnSpectraComparison() == ComparisonType.EQUAL) {
if (peptideMatch.getSpectrumCount() != peptideFilter.getNSpectra()) {
return false;
}
} else if (peptideFilter.getnSpectraComparison() == ComparisonType.NOT_EQUAL) {
if (peptideMatch.getSpectrumCount() != peptideFilter.getNSpectra()) {
return false;
}
}
}
if (peptideFilter.getNValidatedSpectra() != null) {
int nValidatedSpectra = identificationFeaturesGenerator.getNValidatedSpectraForPeptide(peptideMatchKey);
if (peptideFilter.getnValidatedSpectraComparison() == ComparisonType.AFTER) {
if (nValidatedSpectra <= peptideFilter.getNValidatedSpectra()) {
return false;
}
} else if (peptideFilter.getnValidatedSpectraComparison() == ComparisonType.BEFORE) {
if (nValidatedSpectra >= peptideFilter.getNValidatedSpectra()) {
return false;
}
} else if (peptideFilter.getnValidatedSpectraComparison() == ComparisonType.EQUAL) {
if (nValidatedSpectra != peptideFilter.getNValidatedSpectra()) {
return false;
}
} else if (peptideFilter.getnValidatedSpectraComparison() == ComparisonType.NOT_EQUAL) {
if (nValidatedSpectra != peptideFilter.getNValidatedSpectra()) {
return false;
}
}
}
if (peptideFilter.getNConfidentSpectra() != null) {
int nConfidentPeptides = identificationFeaturesGenerator.getNConfidentSpectraForPeptide(peptideMatchKey);
if (peptideFilter.getnConfidentSpectraComparison() == ComparisonType.AFTER) {
if (nConfidentPeptides <= peptideFilter.getNConfidentSpectra()) {
return false;
}
} else if (peptideFilter.getnConfidentSpectraComparison() == ComparisonType.BEFORE) {
if (nConfidentPeptides >= peptideFilter.getNConfidentSpectra()) {
return false;
}
} else if (peptideFilter.getnConfidentSpectraComparison() == ComparisonType.EQUAL) {
if (nConfidentPeptides != peptideFilter.getNConfidentSpectra()) {
return false;
}
} else if (peptideFilter.getnConfidentSpectraComparison() == ComparisonType.NOT_EQUAL) {
if (nConfidentPeptides != peptideFilter.getNConfidentSpectra()) {
return false;
}
}
}
if (peptideFilter.getProtein() != null) {
boolean found = false;
for (String accession : peptideMatch.getTheoreticPeptide().getParentProteinsNoRemapping()) {
if (accession.split(peptideFilter.getProtein()).length > 1) {
found = true;
break;
}
if (sequenceFactory.getHeader(accession).getSimpleProteinDescription() != null
&& sequenceFactory.getHeader(accession).getSimpleProteinDescription().split(peptideFilter.getProtein()).length > 1) {
found = true;
break;
}
}
if (!found) {