// Check whether the base peak or secondary base peak are valid
// fragments
List<Integer> fameBasePeaks = Ints.asList(FameData.FAME_BASE_PEAKS);
if (s.getBasePeak() != null) {
DataPoint secondaryBasePeak = s.getSecondaryBasePeak();
if (fameBasePeaks.contains((int) s.getBasePeak().getMZ())
|| (secondaryBasePeak != null && (secondaryBasePeak
.getMZ() == 74 || secondaryBasePeak.getMZ() == 87))) {
allCandidates.add(new SimpleScan(s));
totalScans += 2 * FameData.N_FAMES;
}
}
processedScans++;
}
// Perform C13 Isotope filtering on candidates
for (SimpleScan s : allCandidates)
applyC13IsotopeFilter(s);
// Find spectrum with the highest similarity to a library spectrum
double maxSimilarity = 0;
int libraryMatch = -1;
SimpleScan highestMatch = null;
for (SimpleScan s : allCandidates) {
DataPoint basePeak = s.getBasePeak();
double bestSimilarity = 0;
int matchesCount = 0;
for (int i = 0; i < FameData.N_FAMES; i++) {