@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(); }
private static void validatePeak2(ISpectrumPeak pSp, double pPeak, double pPeak1) { Set<Integer> goodMasses = buildMassSet(); final double chargeRatio = pSp.getMassChargeRatio(); validateAsInts(chargeRatio, pPeak); double peak = pSp.getPeak(); Assert.assertEquals(pPeak1, peak, ALLOWED_INTENSITY_ERROR); }
private static void validateAsInts(double pChargeRatio, double pPeak) { Assert.assertEquals(asInt(pChargeRatio), asInt(pPeak)); }