SliceSparseMatrix { public List<VerticalSliceDataPoint> getVerticalSlice(int scanNumber) { List<Triplet> oneScanTriplet = new ArrayList<Triplet>(); List<VerticalSliceDataPoint> datapointList = new ArrayList<VerticalSliceDataPoint>(); Triplet searchTriplet = new Triplet(); searchTriplet.scanListIndex = scanNumber; int index1 = Collections.binarySearch(sortListAccordingToScan, searchTriplet, compareScan); int index2 = index1; oneScanTriplet.add(sortListAccordingToScan.get(index1)); while (index1 >= 0) { index1--; if (index1 < 0 || sortListAccordingToScan.get(index1).scanListIndex != scanNumber) { break; } oneScanTriplet.add(sortListAccordingToScan.get(index1)); } while (index2 >= 0) { index2++; if (index2 > filterListOfTriplet.size() - 1 || filterListOfTriplet.get(index2).scanListIndex != scanNumber) { break; } oneScanTriplet.add(filterListOfTriplet.get(index2)); } Collections.sort(oneScanTriplet, compareIntensity); int maxIntensityMZ = oneScanTriplet.get(0).mz; Collections.sort(oneScanTriplet, compareScanMz); Triplet searchMz = new Triplet(); for (int roundedMZ : mzValues) { VerticalSliceDataPoint datapoint = new VerticalSliceDataPoint(); searchMz.mz = roundedMZ; searchMz.scanListIndex = scanNumber; if (roundedMZ >= (maxIntensityMZ - roundMzFactor) && roundedMZ <= (maxIntensityMZ + roundMzFactor)) { int mzInex = Collections.binarySearch(oneScanTriplet, searchMz, compareScanMz); if (mzInex >= 0) { datapoint.intensity = oneScanTriplet.get(mzInex).intensity; datapoint.mz = (float) roundedMZ / roundMzFactor; datapointList.add(datapoint); } else { datapoint.intensity = (float) 0.0; datapoint.mz = (float) roundedMZ / roundMzFactor; datapointList.add(datapoint); } } } return datapointList; } SliceSparseMatrix(RawDataFile rawFile);  SliceSparseMatrix(RawDataFile rawFile, Predicate<MsScan> msScanPredicate); List<Triplet> getHorizontalSlice(double mz, int lowerScanBound, int upperScanBound); List<Triplet> getHorizontalSlice(int roundedMZ, int lowerScanBound, int upperScanBound); List<VerticalSliceDataPoint> getVerticalSlice(int scanNumber); Triplet findNextMaxIntensity(); List<ContinuousWaveletTransform.DataPoint> getCWTDataPoint(List<Triplet> slice); List<Triplet> removeDataPoints(int roundedmz, int lowerScanBound, int upperScanBound); List<Triplet> restoreDataPoints(int roundedmz, int lowerScanBound, int upperScanBound); int roundMZ(double mz); void setMaxIntensityIndexZero(); int getSizeOfRawDataFile(); float[] getRetentionTimeArray(int lowerScanBound, int upperScanbound); float[] getIntensities(GoodPeakInfo peak); double getRetentionTime(int scanNumber); float getFinishedPercent(Triplet maxIntensityTriplet); double numOfScans(); final List<Integer> mzValues; }
@Test public void getVerticalSlice() throws MSDKException, IOException { List<SliceSparseMatrix.VerticalSliceDataPoint> slice = objSliceSparseMatrix.getVerticalSlice(5); Assert.assertEquals(5389, slice.size()); }