示例#1
0
        private void ValidateScanInfoUsingCachedSpectra(
            MsDataFileReaderBaseClass reader,
            int expectedScanCount,
            int expectedMS1,
            int expectedMS2,
            IReadOnlyDictionary <int, string> expectedScanInfo)
        {
            Console.WriteLine("Scan info for {0}", Path.GetFileName(reader.InputFilePath));

            WriteScanInfoColumnNames(reader);

            var scanCountMS1 = 0;
            var scanCountMS2 = 0;
            var scanCount    = 0;

            for (var spectrumIndex = 0; spectrumIndex < reader.CachedSpectrumCount; spectrumIndex++)
            {
                var validScan = reader.GetSpectrumByIndex(spectrumIndex, out var spectrumInfo);

                Assert.IsTrue(validScan, "GetSpectrumByScanNumber returned false for index {0}", spectrumIndex);

                if (expectedScanInfo.TryGetValue(spectrumInfo.ScanNumber, out _))
                {
                    ValidateScanInfo(expectedScanInfo, spectrumInfo);
                }

                if (spectrumInfo.MSLevel == 1)
                {
                    scanCountMS1++;
                }
                else if (spectrumInfo.MSLevel > 1)
                {
                    scanCountMS2++;
                }

                scanCount++;
            }

            Console.WriteLine("scanCountMS1={0}", scanCountMS1);
            Console.WriteLine("scanCountMS2={0}", scanCountMS2);

            Assert.AreEqual(expectedScanCount, reader.ScanCount, "reader.ScanCount mismatch");

            Assert.AreEqual(expectedScanCount, scanCount, "Scan count read mismatch");

            Assert.AreEqual(expectedMS1, scanCountMS1, "MS1 scan count mismatch");
            Assert.AreEqual(expectedMS2, scanCountMS2, "MS2 scan count mismatch");
        }
示例#2
0
        private void ValidateScanInfoUsingReader(
            MsDataFileReaderBaseClass reader,
            int expectedScanCount,
            int expectedMS1,
            int expectedMS2,
            IReadOnlyDictionary <int, string> expectedScanInfo)
        {
            Console.WriteLine("Scan info for {0}", Path.GetFileName(reader.InputFilePath));

            WriteScanInfoColumnNames(reader);

            var scanCountMS1 = 0;
            var scanCountMS2 = 0;
            var scanCount    = 0;

            while (reader.ReadNextSpectrum(out var spectrumInfo))
            {
                if (expectedScanInfo.TryGetValue(spectrumInfo.ScanNumber, out _))
                {
                    ValidateScanInfo(expectedScanInfo, spectrumInfo);
                }

                if (spectrumInfo.MSLevel == 1)
                {
                    scanCountMS1++;
                }
                else if (spectrumInfo.MSLevel > 1)
                {
                    scanCountMS2++;
                }

                scanCount++;
            }

            Console.WriteLine("scanCountMS1={0}", scanCountMS1);
            Console.WriteLine("scanCountMS2={0}", scanCountMS2);

            Assert.AreEqual(expectedScanCount, reader.ScanCount, "reader.ScanCount mismatch");

            Assert.AreEqual(expectedScanCount, scanCount, "Scan count read mismatch");

            Assert.AreEqual(expectedMS1, scanCountMS1, "MS1 scan count mismatch");
            Assert.AreEqual(expectedMS2, scanCountMS2, "MS2 scan count mismatch");
        }