Пример #1
0
        // The test mzxml contains 4 ms2 scans with +/- 10 ms1 scans
        // around each. This method reads one ms2 scan and its ms1 scans.
        private void GetBlock(MzXmlReader reader, int block, ref Scan ms2Scan, ref Scan parentScan, ref List <Scan> ms1Scans)
        {
            int  skipCount = (block - 1) * 21;
            Scan lastMs1   = null;

            foreach (Scan scan in reader)
            {
                if (skipCount > 0)
                {
                    --skipCount;
                    continue;
                }
                if (scan.MsOrder == 1)
                {
                    ms1Scans.Add(scan);
                    lastMs1 = scan;
                }
                else if (scan.MsOrder == 2)
                {
                    ms2Scan    = scan;
                    parentScan = lastMs1;
                }
                if (ms1Scans.Count >= 20)
                {
                    break;
                }
            }
        }
Пример #2
0
        public void Mono3()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var  scans      = new List <Scan>();
            Scan ms2Scan    = new Scan();
            Scan parentScan = new Scan();

            GetBlock(reader, 3, ref ms2Scan, ref parentScan, ref scans);
            MonocleOptions options = new MonocleOptions();

            Monocle.Run(scans, parentScan, ms2Scan.Precursors[0], options);
            Assert.Equal(869.449817, ms2Scan.Precursors[0].Mz, 3);
        }
Пример #3
0
        public void Mono2()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());
            var  scans      = new List <Scan>();
            Scan ms2Scan    = new Scan();
            Scan parentScan = new Scan();

            GetBlock(reader, 2, ref ms2Scan, ref parentScan, ref scans);
            MonocleOptions options = new MonocleOptions();

            Monocle.Run(scans, parentScan, ms2Scan.Precursors[0], options);
            Assert.Equal(1009.98842, ms2Scan.Precursors[0].Mz, 2);
        }
Пример #4
0
        public void testOutput()
        {
            var reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());

            string dir = Directory.GetCurrentDirectory();

            var writer = new MzXmlWriter();

            writer.Open("data/mzxml-writer-test.mzxml");

            var header = new ScanFileHeader();

            header.FileName = "mzxml-writer-test.mzxml";
            header.FilePath = "data/mzxml-writer-test.mzxml";
            writer.WriteHeader(header);

            var scans = reader.GetEnumerator();

            scans.MoveNext();
            Scan scan1 = (Scan)scans.Current;

            scans.MoveNext();
            Scan scan2 = (Scan)scans.Current;

            writer.WriteScan(scan1);
            writer.WriteScan(scan2);
            writer.Close();

            reader = new MzXmlReader();
            reader.Open("data/mzxml-writer-test.mzxml", new ScanReaderOptions());

            scans = reader.GetEnumerator();
            scans.MoveNext();
            Scan scan3 = (Scan)scans.Current;

            scans.MoveNext();
            Scan scan4 = (Scan)scans.Current;

            Assert.Equal(scan1.ScanNumber, scan3.ScanNumber);
            Assert.Equal(scan1.RetentionTime, scan3.RetentionTime);
            Assert.Equal(scan1.PeakCount, scan3.PeakCount);
            Assert.Equal(scan1.Centroids[0].Mz, scan3.Centroids[0].Mz);
            Assert.Equal(scan1.Centroids[11].Intensity, scan3.Centroids[11].Intensity);
        }
Пример #5
0
        public void TestReadMs2()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            var ms2Scan = scans[10];

            Assert.Equal(2, ms2Scan.MsOrder);
            Assert.Equal(1d, ms2Scan.Precursors.Count, 3);
            Assert.Equal(687.3921, ms2Scan.Precursors[0].Mz, 3);
        }
Пример #6
0
        public void TestReadScans()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            Assert.Equal(84, scans.Count);
            Assert.Equal(1, scans[0].ScanNumber);
            Assert.Equal(1, scans[0].MsOrder);
            Assert.Equal(1396, scans[0].PeakCount);
            Assert.Equal(1396, scans[0].Centroids.Count);
            Assert.Equal(356.43359375, scans[0].Centroids[0].Mz, 6);
        }
Пример #7
0
        public void WindowTest()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            MonocleOptions options = new MonocleOptions();

            options.AveragingVector            = AveragingVector.Both;
            options.Number_Of_Scans_To_Average = 6;
            var nearby = Monocle.GetNearbyScans(ref scans, scans[scans[10].PrecursorMasterScanNumber - 1], options);

            Assert.Equal(13, nearby.Count);
        }
Пример #8
0
        public void MonoAll()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
            var scans = new List <Scan>();

            foreach (Scan scan in reader)
            {
                scans.Add(scan);
            }
            MonocleOptions options = new MonocleOptions();

            options.AveragingVector = AveragingVector.Both;
            Monocle.Run(ref scans, options);

            Assert.Equal(687.39195, scans[10].Precursors[0].Mz, 3);
            Assert.Equal(1009.98842, scans[31].Precursors[0].Mz, 2);
            Assert.Equal(869.449817, scans[52].Precursors[0].Mz, 3);
        }
Пример #9
0
        public void TestOpen()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml", new ScanReaderOptions());
        }
Пример #10
0
        public void TestOpen()
        {
            MzXmlReader reader = new MzXmlReader();

            reader.Open("data/orbixl-mini.mzxml");
        }