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) {
return false;
}
}
}
// sequence pattern
if (peptideFilter.getSequence() != null && peptideFilter.getSequence().trim().length() > 0) {
PeptideMatch peptideMatch = identification.getPeptideMatch(peptideMatchKey);
String peptideSequence = peptideMatch.getTheoreticPeptide().getSequence();
Matcher m;
if (peptideFilter.getSequencePattern() != null) {
m = peptideFilter.getSequencePattern().matcher(peptideSequence);
} else {
Pattern p = Pattern.compile("(.*?)" + peptideFilter.getSequence() + "(.*?)");
m = p.matcher(peptideSequence);
}
if (!m.matches()) {
return false;
}
}
// protein pattern
if (peptideFilter.getProtein() != null && peptideFilter.getProtein().trim().length() > 0) {
PeptideMatch peptideMatch = identification.getPeptideMatch(peptideMatchKey);
String accessions = "";
for (String accession : peptideMatch.getTheoreticPeptide().getParentProteinsNoRemapping()) {
accessions += accession + " ";
}
Matcher m;
if (peptideFilter.getProteinPattern() != null) {
m = peptideFilter.getProteinPattern().matcher(accessions);