protected void PerformAlignment()
        {
            if (!string.IsNullOrEmpty(_alignmentFolder))
            {
                RunUtilities.AlignRunUsingAlignmentInfoInFiles(Run, _alignmentFolder);
            }


            if (Run.MassIsAligned)
            {
                ReportGeneralProgress("Run has been mass aligned");
            }
            else
            {
                ReportGeneralProgress("FYI - Run has NOT been mass aligned.");
            }

            if (Run.NETIsAligned)
            {
                ReportGeneralProgress("Run has been NET aligned using info in either the _NETAlignment.txt file or the _UMCs.txt file");
            }
            else
            {
                ReportGeneralProgress("Warning - Run has NOT been NET aligned.");
            }
        }
        public void findFeatureIn_dataset_with_bad_massCalibration_test1()
        {
            //mass error in this dataset is typically ~50ppm.

            var datasetFile = @"D:\Data\Orbitrap\Subissue01\QC_Shew_10_01-pt5-1_8Feb10_Doc_09-12-24.RAW";

            var massTagFile           = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\MassTags\QCShew_Formic_MassTags_Bin10_first10.txt";
            var workflowParameterFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\WorkflowParameterFiles\UnlabelledTargeted_WorkflowParameters_noSum.xml";


            var run = RunUtilities.CreateAndLoadPeaks(datasetFile, datasetFile.Replace(".RAW", "_peaks.txt"));

            RunUtilities.AlignRunUsingAlignmentInfoInFiles(run);

            Assert.IsTrue(run.MassIsAligned);
            Assert.IsTrue(run.NETIsAligned);


            var parameters = new BasicTargetedWorkflowParameters();

            parameters.LoadParameters(workflowParameterFile);
            var workflow = new BasicTargetedWorkflow(parameters);


            workflow.Run = run;

            var mtc        = new TargetCollection();
            var mtimporter = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            var mt1 = (from n in mtc.TargetList where n.ID == 24702 && n.ChargeState == 4 select n).First();

            run.CurrentMassTag = mt1;

            workflow.Execute();

            var repo = new TargetedResultRepository();

            repo.AddResult(workflow.Result);


            Console.WriteLine("theor mono mass = " + mt1.MonoIsotopicMass);
            Console.WriteLine("theorMZ = " + mt1.MZ);
            Console.WriteLine("theorNET = " + mt1.NormalizedElutionTime);
            Console.WriteLine("obsScan = " + repo.Results[0].ScanLC);
            Console.WriteLine("obsNET = " + repo.Results[0].NET);
            Console.WriteLine("NETError = " + repo.Results[0].NETError);
            Console.WriteLine("obsMZ = " + repo.Results[0].MonoMZ);
            Console.WriteLine("monoMass = " + repo.Results[0].MonoMass);
            Console.WriteLine("obsMonoMassCalibrated = " + repo.Results[0].MonoMassCalibrated);

            Console.WriteLine("MassErrorBeforeAlignment = " + (mt1.MZ - repo.Results[0].MonoMZ) / mt1.MZ * 1e6);
            Console.WriteLine("MassErrorAfterAlignment = " + repo.Results[0].MassErrorBeforeCalibration);
        }
        public void findSingleMassTag_checkAlignmentData_test1()
        {
            var testFile      = DeconTools.UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = DeconTools.UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500;
            var massTagFile   = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt";

            var run        = RunUtilities.CreateAndLoadPeaks(testFile, peaksTestFile);
            var mtc        = new TargetCollection();
            var mtimporter = new MassTagFromTextFileImporter(massTagFile);

            mtc = mtimporter.Import();

            var testMassTagID = 24800;

            run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First();


            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            var workflow = new BasicTargetedWorkflow(run, parameters);

            workflow.Execute();

            var result = run.ResultCollection.GetTargetedResult(run.CurrentMassTag) as MassTagResult;

            Assert.AreEqual(false, result.FailedResult);

            result.DisplayToConsole();

            Assert.IsNotNull(result.IsotopicProfile);
            Assert.IsNotNull(result.ScanSet);
            Assert.IsNotNull(result.ChromPeakSelected);
            Assert.AreEqual(2, result.IsotopicProfile.ChargeState);
            Assert.AreEqual(718.41m, (decimal)Math.Round(result.IsotopicProfile.GetMZ(), 2));
            Assert.AreEqual(5947m, (decimal)Math.Round(result.ChromPeakSelected.XValue));


            Assert.AreEqual(5.91, (decimal)(Math.Round(result.GetMassErrorAfterAlignmentInPPM(), 2)));
            Assert.AreEqual(0.0001585m, (decimal)(Math.Round(result.GetNETAlignmentError(), 7)));

            RunUtilities.AlignRunUsingAlignmentInfoInFiles(run);

            //these might change due to unit tests elsewhere. Need a better way of doing this
            //Assert.AreEqual(1.99290383722318m, (decimal)result.GetMassErrorAfterAlignmentInPPM());
            //Assert.AreEqual(0.00076708197593689m, (decimal)result.GetNETAlignmentError());
        }
Beispiel #4
0
        public void Test1()
        {
            var rawdataFile   = @"D:\Data\Orbitrap\QC_Shew_09_05-pt5-6_4Jan10_Doc_09-11-08.RAW";
            var massTagFile   = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt";
            var parameterFile = @"\\protoapps\UserData\Slysz\Data\QCShew_MassiveTargeted\WorkflowParameterFiles\UnlabelledTargeted_WorkflowParameters_noSum.xml";

            var mtimporter = new MassTagFromTextFileImporter(massTagFile);

            var mtc = new TargetCollection();

            mtc = mtimporter.Import();


            var run = new RunFactory().CreateRun(rawdataFile);
            //RunUtilities.AlignRunUsingAlignmentInfoInFiles(run);

            var expectedPeaksFilename = Path.Combine(run.DataSetPath, run.DatasetName + "_peaks.txt");

            var peakImporter = new DeconTools.Backend.Data.PeakImporterFromText(expectedPeaksFilename, null);

            peakImporter.ImportPeaks(run.ResultCollection.MSPeakResultList);


            var testMassTagID      = 3513677;
            var massTagChargeState = 2;

            run.CurrentMassTag = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == massTagChargeState select n).First();

            var parameters = WorkflowParameters.CreateParameters(parameterFile);

            var workflow = TargetedWorkflow.CreateWorkflow(parameters);

            workflow.Run = run;

            workflow.Execute();



            workflow.Result.DisplayToConsole();


            RunUtilities.AlignRunUsingAlignmentInfoInFiles(run);
            workflow.Execute();
            workflow.Result.DisplayToConsole();
        }