Exemplo n.º 1
0
        public XYData GetSpectrumAMTTag23140708_Z3_Sum3()
        {
            Run run    = new MSScanFromTextFileRun(N14N15TestingUtilities.MS_AMTTag23140708_z3_sum3);
            var xydata = run.GetMassSpectrum(new ScanSet(1), 0, 50000);

            return(xydata);
        }
Exemplo n.º 2
0
        public static XYData GetTestSpectrum(string xydataFileName)
        {
            Run run    = new MSScanFromTextFileRun(xydataFileName);
            var xydata = run.GetMassSpectrum(new ScanSet(1), 0, 50000);

            return(xydata);
        }
Exemplo n.º 3
0
        public static XYData LoadXYDataFromFile(string testChromatogramDataFile)
        {
            var tempRun = new MSScanFromTextFileRun(testChromatogramDataFile);
            var xydata  = tempRun.GetMassSpectrum(new ScanSet(0));

            return(xydata);
        }
Exemplo n.º 4
0
        public void ZeroFillerCompareNewAndOld()
        {
            Run run        = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_std1);
            var msgen      = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var zeroFiller = new DeconToolsZeroFiller(3);

            msgen.Execute(run.ResultCollection);
            var numZerosToFill = 3;
            var newZeroFilled  = zeroFiller.ZeroFill(run.XYData.Xvalues, run.XYData.Yvalues, numZerosToFill);
            // var oldZeroFilled = zeroFiller.ZeroFillOld(run.XYData.Xvalues, run.XYData.Yvalues, numZerosToFill);


            var lowerMZ = 625.48;
            var upperMZ = 626.18;

            run.XYData    = run.XYData.TrimData(lowerMZ, upperMZ);
            newZeroFilled = newZeroFilled.TrimData(lowerMZ, upperMZ);
            // oldZeroFilled = oldZeroFilled.TrimData(lowerMZ, upperMZ);

            Console.WriteLine("---------- before zerofilling ---------------");
            TestUtilities.DisplayXYValues(run.XYData);

            Console.WriteLine("---------- after zerofilling ---------------");
            TestUtilities.DisplayXYValues(newZeroFilled);

            // Console.WriteLine("---------- after zerofilling using DeconEngine ---------------");
            // TestUtilities.DisplayXYValues(oldZeroFilled);
        }
        public void readInTextFileContainingMultipleHeaderLinesTest1()
        {
            Run textfiledata = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_multipleHeaderLines, '\t', 1, 2);

            textfiledata.GetMassSpectrum(new DeconTools.Backend.Core.ScanSet(0), 200, 2000);

            TestUtilities.DisplayXYValues(textfiledata.XYData);
        }
        public void readInTextFileContainingMultipleSpaceDelimitersTest2()
        {
            Run run = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_multipleDelimiters, ' ');

            var msgen = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);

            msgen.Execute(run.ResultCollection);

            TestUtilities.DisplayXYValues(run.XYData);
        }
Exemplo n.º 7
0
        public void MSGeneratoronTextFileTest2()
        {
            Run run = new MSScanFromTextFileRun(textFile1);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(run.ResultCollection);

            Assert.AreEqual(19716, run.XYData.Xvalues.Length);
        }
        public void test1()
        {
            Run run = new MSScanFromTextFileRun(imfMSScanTextfile);
            ResultCollection resultcollection = new ResultCollection(run);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(resultcollection);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 3;
            detectorParams.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;
            detectorParams.SignalToNoiseThreshold = 3;
            detectorParams.ThresholdedData        = false;

            Task peakdetector = new DeconToolsPeakDetector(detectorParams);

            peakdetector.Execute(resultcollection);

            Task rapidDecon = new RapidDeconvolutor();

            rapidDecon.Execute(resultcollection);

            int counter = 0;

            foreach (StandardIsosResult result in resultcollection.ResultList)
            {
                IsotopicProfile profile = result.IsotopicProfile;
                Console.Write("------------ profile" + counter + "; Charge state = " + profile.ChargeState
                              + "; Score= " + profile.Score.ToString("0.00") + " ----------------\n");
                int peakcounter = 0;
                Console.Write("idx" + "\t" + "mz" + "\t" + "intensity" + "\t" + "SN" + "\t" + "FWHM" + "\n");
                foreach (MSPeak peak in profile.Peaklist)
                {
                    Console.Write(peakcounter + "\t" + peak.XValue + "\t" + peak.Height + "\t" + peak.SN + "\t" + peak.Width + "\n");
                    peakcounter++;
                }
                counter++;
            }

            Assert.AreEqual(9, resultcollection.ResultList.Count);
            Assert.AreEqual(582.820684517665, Convert.ToDecimal(resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].XValue));
            Assert.AreEqual(2984.0, resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].Height);
            Assert.AreEqual(0.05905123, (decimal)resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].Width);
            Assert.AreEqual(157.0526, (decimal)resultcollection.ResultList[0].IsotopicProfile.Peaklist[0].SN);


            Assert.AreEqual(4593, resultcollection.ResultList[0].IsotopicProfile.GetAbundance());

            Assert.AreEqual(1, resultcollection.ResultList[8].IsotopicProfile.GetNumOfIsotopesInProfile());
            Assert.AreEqual(2488.07303881522, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.AverageMass));
            Assert.AreEqual(3, resultcollection.ResultList[8].IsotopicProfile.ChargeState);
            Assert.AreEqual(18802, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.IntensityAggregate));
            Assert.AreEqual(2486.09777364184, Convert.ToDecimal(resultcollection.ResultList[8].IsotopicProfile.MonoIsotopicMass));
        }
Exemplo n.º 9
0
        public void MSGeneratorOnTextfileTest1()
        {
            Run run = new MSScanFromTextFileRun(imfMSScanTextfile, Globals.XYDataFileType.Textfile);
            ResultCollection resultcollection = new ResultCollection(run);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(resultcollection);

            Assert.AreEqual(2596, resultcollection.Run.XYData.Xvalues.Length);
        }
Exemplo n.º 10
0
        public void test1()
        {
            var textfiledata = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_std1);
            var xydata       = textfiledata.GetMassSpectrum(new DeconTools.Backend.Core.ScanSet(0), 0, 2000);

            TestUtilities.DisplayXYValues(xydata);

            Assert.AreEqual(2596, xydata.Xvalues.Length);
            Assert.AreEqual(582.822204589844, Convert.ToDecimal(xydata.Xvalues[418]));
            Assert.AreEqual(2984, xydata.Yvalues[418]);
            Assert.AreEqual(1, textfiledata.GetNumMSScans());
        }
Exemplo n.º 11
0
        public void DeconToolsPeakDetectionTest1()
        {
            Run run = new MSScanFromTextFileRun(imfMSScanTextfile);
            ResultCollection resultcollection = new ResultCollection(run);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(resultcollection);

            DeconToolsV2.Peaks.clsPeakProcessorParameters detectorParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters();
            detectorParams.PeakBackgroundRatio    = 3;
            detectorParams.PeakFitType            = DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC;
            detectorParams.SignalToNoiseThreshold = 3;
            detectorParams.ThresholdedData        = false;

            Task peakdetector = new DeconToolsPeakDetector(detectorParams);

            peakdetector.Execute(resultcollection);

            Assert.AreEqual(82, resultcollection.Run.PeakList.Count);
            Assert.AreEqual(167.243318707619, Convert.ToDecimal(resultcollection.Run.CurrentScanSet.BackgroundIntensity));

            detectorParams.PeakBackgroundRatio = 2;
            peakdetector = new DeconToolsPeakDetector(detectorParams);
            peakdetector.Execute(resultcollection);
            Assert.AreEqual(154, resultcollection.Run.PeakList.Count);
            Assert.AreEqual(167.243318707619, Convert.ToDecimal(resultcollection.Run.CurrentScanSet.BackgroundIntensity));

            detectorParams.PeakBackgroundRatio    = 2;
            detectorParams.SignalToNoiseThreshold = 1;
            peakdetector = new DeconToolsPeakDetector(detectorParams);
            peakdetector.Execute(resultcollection);
            Assert.AreEqual(156, resultcollection.Run.PeakList.Count);
            Assert.AreEqual(167.243318707619, Convert.ToDecimal(resultcollection.Run.CurrentScanSet.BackgroundIntensity));

            detectorParams.PeakBackgroundRatio    = 3;
            detectorParams.SignalToNoiseThreshold = 3;
            detectorParams.ThresholdedData        = true;
            peakdetector = new DeconToolsPeakDetector(detectorParams);
            peakdetector.Execute(resultcollection);

            Task scanresultUpdater = new ScanResultUpdater();

            scanresultUpdater.Execute(resultcollection);

            Assert.AreEqual(82, resultcollection.Run.PeakList.Count);
            Assert.AreEqual(1, resultcollection.ScanResultList.Count);
            Assert.AreEqual(82, resultcollection.ScanResultList[0].NumPeaks);
            Assert.AreEqual(167.243318707619, Convert.ToDecimal(resultcollection.Run.CurrentScanSet.BackgroundIntensity));
        }
Exemplo n.º 12
0
        public void ZeroFillerTest1()
        {
            Run run        = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_std1);
            var msgen      = MSGeneratorFactory.CreateMSGenerator(run.MSFileType);
            var zeroFiller = new DeconToolsZeroFiller(3);

            msgen.Execute(run.ResultCollection);

            // Delete data points such that we only retain 50% of the data
            var fractionToKeep        = 0.50;
            var distanceBetweenPoints = (int)(run.XYData.Xvalues.Length / (run.XYData.Xvalues.Length * fractionToKeep));

            var newXVals = new List <double>();
            var newYVals = new List <double>();

            for (var i = 0; i < run.XYData.Xvalues.Length; i += distanceBetweenPoints)
            {
                if (i < run.XYData.Xvalues.Length)
                {
                    newXVals.Add(run.XYData.Xvalues[i]);
                    newYVals.Add(run.XYData.Yvalues[i]);
                }
            }

            run.XYData.Xvalues = newXVals.ToArray();
            run.XYData.Yvalues = newYVals.ToArray();

            var numZerosToFill = 3;
            var newZeroFilled  = zeroFiller.ZeroFill(run.XYData.Xvalues, run.XYData.Yvalues, numZerosToFill);

            double lowerMZ = 1000;
            double upperMZ = 1300;

            run.XYData    = run.XYData.TrimData(lowerMZ, upperMZ);
            newZeroFilled = newZeroFilled.TrimData(lowerMZ, upperMZ);

            Console.WriteLine("---------- before zerofilling ---------------");
            TestUtilities.DisplayXYValues(run.XYData, lowerMZ, upperMZ);

            Console.WriteLine("---------- after zerofilling ---------------");
            TestUtilities.DisplayXYValues(newZeroFilled, lowerMZ, upperMZ);

            Assert.IsTrue(newZeroFilled.Xvalues.Length > run.XYData.Xvalues.Length);
        }
Exemplo n.º 13
0
        public void test1()
        {
            Run run = new MSScanFromTextFileRun(sourceXYData);

            MSGeneratorFactory fact = new MSGeneratorFactory();
            Task msGen = fact.CreateMSGenerator(run.MSFileType);

            msGen.Execute(run.ResultCollection);

            DeconToolsPeakDetector peakDet = new DeconToolsPeakDetector(1.3, 2, DeconTools.Backend.Globals.PeakFitType.QUADRATIC, false);

            peakDet.Execute(run.ResultCollection);

            HornDeconvolutor decon = new HornDeconvolutor();

            decon.Execute(run.ResultCollection);

            //TestUtilities.DisplayMSFeatures(run.ResultCollection.ResultList);
            //TestUtilities.DisplayPeaks(run.PeakList);
        }
        public void smootherTest1()
        {
            Run run = new MSScanFromTextFileRun(FileRefs.RawDataMSFiles.TextFileMS_std1);

            Task msgen = new GenericMSGenerator();

            msgen.Execute(run.ResultCollection);

            var peakdetector = new DeconToolsPeakDetectorV2(3, 3, Globals.PeakFitType.QUADRATIC, true);

            peakdetector.Execute(run.ResultCollection);

            Assert.AreEqual(84, run.PeakList.Count);

            Task smoother = new SavitzkyGolaySmoother(7, 2, false);

            smoother.Execute(run.ResultCollection);

            peakdetector.Execute(run.ResultCollection);

            Assert.AreEqual(46, run.PeakList.Count);
        }