@Test public void testConditioning() { XTandemMain main = new XTandemMain( XTandemUtilities.getResourceStream("smallSample/tandem.params"), "smallSample/tandem.params"); main.loadScoringTest(); main.loadSpectra(); Scorer sa = main.getScoreRunner(); IScoredScan[] conditionedScans = sa.getScans(); final IScoredScan conditionedScan = conditionedScans[0]; SpectrumCondition sc = sa.getSpectrumCondition(); final IScoringAlgorithm alg = sa.getAlgorithm(); IMeasuredSpectrum scan = alg.conditionSpectrum(conditionedScan, sc); Set<Integer> goodMasses = buildMassSet(); final ISpectrumPeak[] sps = scan.getPeaks(); for (int i = 0; i < sps.length; i++) { ISpectrumPeak sp = sps[i]; validateMass(sp, peaks[2 * i], goodMasses); // validatePeak(sp,peaks[2 * i],peaks[2 * i + 1]); } Assert.assertEquals(goodMasses.size(), 0); XTandemUtilities.breakHere(); }
/** * return true if a mass such as that of a throretical peak is within the range to scpre * * @param mass positive testMass * @return as above */ @Override public boolean isMassWithinRange(double mass, int charge, IScoringAlgorithm alg) { if (m_PrecursorCharge == 0) { // try charge 2 double test1 = (getMassChargeRatio() - XTandemUtilities.getProtonMass()) * 2 + XTandemUtilities.getProtonMass(); if (alg.isWithinLimits(test1, mass, 0)) return true; // try charge 3 double test2 = (getMassChargeRatio() - XTandemUtilities.getProtonMass()) * 3 + XTandemUtilities.getProtonMass(); if (alg.isWithinLimits(test2, mass, 0)) return true; // try charge 1 -NOTE THIS IS NEW double test3 = getMassChargeRatio(); if (alg.isWithinLimits(test3, mass, 0)) return true; return false; // give up } else { double test = getPrecursorMass(); boolean withinLimits = alg.isWithinLimits(test, mass, m_PrecursorCharge); if (withinLimits) return true; return false; // give up } }