Beispiel #1
0
        public void ExportNET_andMass_AlignmentDataTest1()
        {
            string exportNETFilename  = Path.Combine(FileRefs.OutputFolderPath, "exportedNETAlignmentInfo1.txt");
            string exportMassFilename = Path.Combine(FileRefs.OutputFolderPath, "exportedMassAlignmentInfo1.txt");


            RunFactory rf  = new RunFactory();
            Run        run = rf.CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            string deconToolsResultFile = @"D:\Temp\output7\targetedFeatures.txt";

            UnlabelledTargetedResultFromTextImporter importer = new UnlabelledTargetedResultFromTextImporter(deconToolsResultFile);
            TargetedResultRepository repo = importer.Import();

            string                      massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt";
            MassTagCollection           mtc         = new MassTagCollection();
            MassTagFromTextFileImporter mtimporter  = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            NETAndMassAligner aligner = new NETAndMassAligner();

            aligner.SetFeaturesToBeAligned(repo.Results);
            aligner.SetReferenceMassTags(mtc.MassTagList);

            aligner.Execute(run);

            NETAlignmentInfoToTextExporter exporter = new NETAlignmentInfoToTextExporter(exportNETFilename);

            exporter.ExportAlignmentInfo(run.AlignmentInfo);

            MassAlignmentInfoToTextExporter massInfoexporter = new MassAlignmentInfoToTextExporter(exportMassFilename);

            massInfoexporter.ExportAlignmentInfo(run.AlignmentInfo);
        }
        public void tester()
        {
            Run run = new XCaliburRun(xcaliburTestfile);
            MassTagCollection        massTagColl  = new MassTagCollection();
            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(smartMethionineMatches, '\t');

            mtidImporter.Import(massTagColl);
            Console.WriteLine("SMART matches = " + massTagColl.MassTagIDList.Count());

            MassTagCollection        matchedMassTag = new MassTagCollection();
            MassTagIDGenericImporter matchImporter  = new MassTagIDGenericImporter(targetedMethionineMatches, '\t');

            matchImporter.Import(matchedMassTag);
            Console.WriteLine("Targeted matches = " + matchedMassTag.MassTagIDList.Distinct().Count());


            //List<long> common_massTags = massTagColl.MassTagIDList.Intersect(matchedMassTag.MassTagIDList).ToList();
            List <long> common_massTags = matchedMassTag.MassTagIDList.Intersect(massTagColl.MassTagIDList).ToList();

            List <long> targetedUniqueTags = matchedMassTag.MassTagIDList.Except(massTagColl.MassTagIDList).ToList();

            List <long> smartUniqueTags = massTagColl.MassTagIDList.Except(matchedMassTag.MassTagIDList).ToList();


            string listOfMTsForSMARTUnique = getStringListOfMassTags(smartUniqueTags);

            Console.WriteLine("Common matches = " + common_massTags.Count);
            Console.WriteLine("Unique to targeted = " + targetedUniqueTags.Count);
            Console.WriteLine("Unique to SMART = " + smartUniqueTags.Count);

            Console.WriteLine();
            Console.WriteLine(listOfMTsForSMARTUnique);
        }
Beispiel #3
0
        public void doAlignmentTest1()
        {
            RunFactory rf  = new RunFactory();
            Run        run = rf.CreateRun(FileRefs.RawDataMSFiles.OrbitrapStdFile1);

            string deconToolsResultFile = @"D:\Temp\output7\targetedFeatures.txt";

            UnlabelledTargetedResultFromTextImporter importer = new UnlabelledTargetedResultFromTextImporter(deconToolsResultFile);
            TargetedResultRepository repo = importer.Import();

            string                      massTagFile = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_allMassTags.txt";
            MassTagCollection           mtc         = new MassTagCollection();
            MassTagFromTextFileImporter mtimporter  = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            NETAndMassAligner aligner = new NETAndMassAligner();

            aligner.SetFeaturesToBeAligned(repo.Results);
            aligner.SetReferenceMassTags(mtc.MassTagList);

            aligner.Execute(run);

            Assert.IsNotNull(run.AlignmentInfo);
            Assert.IsNotNull(run.AlignmentInfo.marrNETFncTimeInput);
            Assert.AreEqual(2273.0f, run.AlignmentInfo.marrNETFncTimeInput[0]);

            float testScan = 6005;
            float testNET1 = run.AlignmentInfo.GetNETFromTime(testScan);

            Assert.AreEqual(0.3253423m, (decimal)testNET1);
        }
Beispiel #4
0
        public void analyzeMassTags(Run run, List <long> massTagIDList, List <Task> taskList)
        {
            MassTagCollection massTagColl = new MassTagCollection();

            run.ResultCollection.MassTagResultType = DeconTools.Backend.Globals.MassTagResultType.N14N15_MASSTAG_RESULT;
            massTagColl.MassTagIDList = massTagIDList;

            MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_R_sphaeroides241_P513", "Albert");

            importer.chargeStateFilterThreshold = 0.05;
            importer.Import(massTagColl);



            List <long> timingResults = new List <long>();


            foreach (MassTag mt in massTagColl.MassTagList)
            {
                run.CurrentMassTag = mt;
                mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS;

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------");
                Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NETVal.ToString("0.000") + "; Sequence = " + mt.PeptideSequence + "\n");


                Stopwatch sw = new Stopwatch();
                sw.Start();
                try
                {
                    foreach (var task in taskList)
                    {
                        task.Execute(run.ResultCollection);
                    }

                    MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[mt];
                    massTagResult.DisplayToConsole();


                    Console.WriteLine("------------------------------ end --------------------------");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Task failed. Message: " + ex.Message + ex.StackTrace);
                }
                sw.Stop();
                timingResults.Add(sw.ElapsedMilliseconds);
            }

            foreach (long tr in timingResults)
            {
                Console.WriteLine(tr);
            }
            Console.WriteLine("-------- Analysis time for all MTs = " + timingResults.Sum());
            Console.WriteLine("-------- Average time for each MT = " + timingResults.Average());

            Console.WriteLine();
        }
        public void SetMassTags(string massTagFilename)
        {
            MassTagFromTextFileImporter importer = new MassTagFromTextFileImporter(massTagFilename);
            MassTagCollection           mtc      = importer.Import();

            MassTagList = mtc.MassTagList;
        }
        public void test1()
        {
            MassTagCollection        massTagColl  = new MassTagCollection();
            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(mt_sourceFile1, ',');

            mtidImporter.Import(massTagColl);

            Assert.AreEqual(8353, massTagColl.MassTagIDList.Count);
        }
Beispiel #7
0
        public void test2()
        {
            MassTagCollection mtc = new MassTagCollection();

            MassTagFromTextFileImporter massTagImporter = new MassTagFromTextFileImporter(massTagTestFile2);

            massTagImporter.Import(mtc);
            Assert.AreEqual(3, mtc.MassTagList.Count);

            //Assert.AreEqual("SAMPLER", mtc.MassTagList[0].PeptideSequence);
            //Assert.AreEqual(2, mtc.MassTagList[0].ChargeState);
            //Assert.AreEqual(0.34m, (decimal)mtc.MassTagList[0].NETVal);
            //Assert.AreEqual("C33H58N10O11S1", mtc.MassTagList[0].Peptide.GetEmpiricalFormula());
        }
        public void exporterTest1()
        {
            string testFile      = FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            string peaksTestFile = FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500;
            string massTagFile   = @"\\protoapps\UserData\Slysz\Data\MassTags\qcshew_standard_file_NETVals0.3-0.33.txt";

            string exportedResultFile = Path.Combine(FileRefs.OutputFolderPath, "UnlabelledTargetedResultsExporterOutput1.txt");

            if (File.Exists(exportedResultFile))
            {
                File.Delete(exportedResultFile);
            }


            Run run = RunUtilities.CreateAndAlignRun(testFile, peaksTestFile);


            MassTagCollection           mtc        = new MassTagCollection();
            MassTagFromTextFileImporter mtimporter = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();


            List <MassTag> selectedMassTags = mtc.MassTagList.OrderBy(p => p.ID).Take(10).ToList();


            DeconToolsTargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            BasicTargetedWorkflow workflow = new BasicTargetedWorkflow(run, parameters);

            foreach (var mt in selectedMassTags)
            {
                run.CurrentMassTag = mt;
                workflow.Execute();
            }

            TargetedResultRepository repo = new TargetedResultRepository();

            repo.AddResults(run.ResultCollection.GetMassTagResults());



            UnlabelledTargetedResultToTextExporter exporter = new UnlabelledTargetedResultToTextExporter(exportedResultFile);

            exporter.ExportResults(repo.Results);
        }
        public void import100MassTagIDs_andLookUpInDMSTest1()
        {
            this.massTagColl = new MassTagCollection();

            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(mt_sourceFile1, ',');

            mtidImporter.Import(massTagColl);

            Assert.AreEqual(100, massTagColl.MassTagIDList.Count);
            Assert.AreEqual(85, massTagColl.MassTagIDList.Distinct().Count());


            MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_Shewanella_ProdTest_P352", "porky");

            importer.Import(massTagColl);
            massTagColl.Display();

            Assert.AreEqual(114, massTagColl.MassTagList.Count);
        }
        public void get14864MassTagsTest()     // this takes about 1 minute on Gord's machine
        {
            MassTagCollection        massTagColl  = new MassTagCollection();
            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(mt_sourceFile2, ',');

            mtidImporter.Import(massTagColl);

            Assert.AreEqual(21047, massTagColl.MassTagIDList.Count);
            Assert.AreEqual(14864, massTagColl.MassTagIDList.Distinct().Count());

            massTagColl.MassTagIDList = massTagColl.MassTagIDList.Distinct().ToList();

            MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_Shewanella_ProdTest_P352", "porky");

            importer.SetMassTagsToRetrieve(massTagColl.MassTagIDList);
            importer.Import(massTagColl);
            massTagColl.Display();

            Assert.AreEqual(14864, massTagColl.MassTagList.Count);
        }
        public void test1()
        {
            Run run = new XCaliburRun(xcaliburTestfile);
            MassTagCollection        massTagColl  = new MassTagCollection();
            MassTagIDGenericImporter mtidImporter = new MassTagIDGenericImporter(cysteineMassTagSourceFile1, '\t');

            mtidImporter.Import(massTagColl);

            MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_Shewanella_ProdTest_P352", "porky");

            importer.Import(massTagColl);

            Assert.AreEqual(737, massTagColl.MassTagIDList.Count);

            Assert.AreEqual(826, massTagColl.MassTagList.Count);

            ChromAlignerUsingVIPERInfo chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);

            PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(xcaliburAllPeaksFile);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);

            Task peakChromGen = new PeakChromatogramGenerator(20);

            Task smoother     = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2);
            Task peakDet      = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 0.5);
            Task chromPeakSel = new DeconTools.Backend.ProcessingTasks.ChromPeakSelector(1, 0.01, Globals.PeakSelectorMode.CLOSEST_TO_TARGET);

            MSGeneratorFactory msgenFactory = new MSGeneratorFactory();
            Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType);


            DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 0.75, true, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC);
            Task mspeakDet             = new DeconToolsPeakDetector(peakParams);
            Task theorFeatureGen       = new TomTheorFeatureGenerator();
            Task targetedFeatureFinder = new BasicTFF(6);
            Task exporter = new BasicMTResultSQLiteExporter(cysteineAnalysisOutput1);


            IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator();

            int         successCounter = 0;
            List <long> timingResults  = new List <long>();

            foreach (MassTag mt in massTagColl.MassTagList)
            {
                run.CurrentMassTag = mt;
                mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS;

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------");
                Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NETVal.ToString("0.000") + "; Sequence = " + mt.PeptideSequence + "\n");


                Stopwatch sw = new Stopwatch();
                sw.Start();
                try
                {
                    peakChromGen.Execute(run.ResultCollection);
                    smoother.Execute(run.ResultCollection);
                    peakDet.Execute(run.ResultCollection);
                    chromPeakSel.Execute(run.ResultCollection);
                    msgen.Execute(run.ResultCollection);
                    mspeakDet.Execute(run.ResultCollection);
                    theorFeatureGen.Execute(run.ResultCollection);
                    targetedFeatureFinder.Execute(run.ResultCollection);
                    fitScoreCalc.Execute(run.ResultCollection);
                    MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[mt];
                    massTagResult.DisplayToConsole();


                    Console.WriteLine("------------------------------ end --------------------------");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Task failed. Message: " + ex.Message + ex.StackTrace);
                }
                sw.Stop();
                timingResults.Add(sw.ElapsedMilliseconds);

                if (mt == massTagColl.MassTagList.Last())
                {
                    exporter.Execute(run.ResultCollection);
                }
            }

            exporter.Cleanup();

            //List<IMassTagResult> successfulResults = run.ResultCollection.GetSuccessfulMassTagResults();

            foreach (long tr in timingResults)
            {
                Console.WriteLine(tr);
            }
            Console.WriteLine("-------- Analysis time for all MTs = " + timingResults.Sum());
            Console.WriteLine("-------- Average time for each MT = " + timingResults.Average());

            Console.WriteLine();
        }
Beispiel #12
0
        public void run_fullAnalysisTest1()
        {
            Run run = new BrukerRun(rsph_AOnly_28_run1File);
            MassTagCollection massTagColl = new MassTagCollection();

            run.ResultCollection.MassTagResultType = DeconTools.Backend.Globals.MassTagResultType.N14N15_MASSTAG_RESULT;


            massTagColl.MassTagIDList = fourTestMTs;

            MassTagFromSqlDBImporter importer = new MassTagFromSqlDBImporter("MT_R_sphaeroides241_P513", "Albert");

            importer.chargeStateFilterThreshold = 0.05;
            importer.Import(massTagColl);

            Assert.AreEqual(7, massTagColl.MassTagList.Count);

            ChromAlignerUsingVIPERInfo chromAligner = new ChromAlignerUsingVIPERInfo();

            chromAligner.Execute(run);

            PeakImporterFromText peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(rsph_Aonly_28_run1_scans500_1000_peaks);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);

            Task peakChromGen = new PeakChromatogramGenerator(20);

            Task smoother     = new DeconTools.Backend.ProcessingTasks.Smoothers.DeconToolsSavitzkyGolaySmoother(11, 11, 2);
            Task peakDet      = new DeconTools.Backend.ProcessingTasks.PeakDetectors.ChromPeakDetector(0.5, 0.5);
            Task chromPeakSel = new DeconTools.Backend.ProcessingTasks.ChromPeakSelector(1, 0.01, Globals.PeakSelectorMode.CLOSEST_TO_TARGET);

            MSGeneratorFactory msgenFactory = new MSGeneratorFactory();
            Task msgen = msgenFactory.CreateMSGenerator(run.MSFileType);


            DeconToolsV2.Peaks.clsPeakProcessorParameters peakParams = new DeconToolsV2.Peaks.clsPeakProcessorParameters(2, 3, false, DeconToolsV2.Peaks.PEAK_FIT_TYPE.QUADRATIC);
            Task mspeakDet       = new DeconToolsPeakDetector(peakParams);
            Task theorFeatureGen = new TomTheorFeatureGenerator();


            N14N15TFFTask finder = new N14N15TFFTask(0.01);



            N14N15QuantifierTask quant = new N14N15QuantifierTask(1);


            IsotopicProfileFitScoreCalculator fitScoreCalc = new IsotopicProfileFitScoreCalculator();

            List <long> timingResults = new List <long>();


            foreach (MassTag mt in massTagColl.MassTagList)
            {
                run.CurrentMassTag = mt;
                mt.MZ = mt.MonoIsotopicMass / mt.ChargeState + Globals.PROTON_MASS;

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("------------------- MassTag = " + mt.ID + "---------------------------");
                Console.WriteLine("monoMass = " + mt.MonoIsotopicMass.ToString("0.0000") + "; monoMZ = " + mt.MZ.ToString("0.0000") + "; ChargeState = " + mt.ChargeState + "; NET = " + mt.NETVal.ToString("0.000") + "; Sequence = " + mt.PeptideSequence + "\n");


                Stopwatch sw = new Stopwatch();
                sw.Start();
                try
                {
                    peakChromGen.Execute(run.ResultCollection);
                    smoother.Execute(run.ResultCollection);
                    peakDet.Execute(run.ResultCollection);
                    chromPeakSel.Execute(run.ResultCollection);
                    msgen.Execute(run.ResultCollection);
                    mspeakDet.Execute(run.ResultCollection);
                    theorFeatureGen.Execute(run.ResultCollection);
                    finder.Execute(run.ResultCollection);
                    quant.Execute(run.ResultCollection);
                    fitScoreCalc.Execute(run.ResultCollection);
                    MassTagResultBase massTagResult = run.ResultCollection.MassTagResultList[mt];
                    massTagResult.DisplayToConsole();


                    Console.WriteLine("------------------------------ end --------------------------");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Task failed. Message: " + ex.Message + ex.StackTrace);
                }
                sw.Stop();
                timingResults.Add(sw.ElapsedMilliseconds);
            }

            foreach (long tr in timingResults)
            {
                Console.WriteLine(tr);
            }
            Console.WriteLine("-------- Analysis time for all MTs = " + timingResults.Sum());
            Console.WriteLine("-------- Average time for each MT = " + timingResults.Average());

            Console.WriteLine();
        }