예제 #1
0
        protected override IqResult CreateIqResult()
        {
            IqTarget target = new IqChargeStateTarget();
            var      result = new IqResult(target);

            return(result);
        }
        public void Test1()
        {
            TargetedWorkflowParameters o16o18workflowParameters = new O16O18WorkflowParameters();
            var parentWorkflow = new O16O18IqWorkflow(o16o18workflowParameters);

            TargetedWorkflowParameters workflowParameters = new BasicTargetedWorkflowParameters();
            var childWorkflow = new BasicIqWorkflow(workflowParameters);

            IqTarget parentTarget = new IqChargeStateTarget();

            IqTarget childTarget1 = new IqChargeStateTarget();
            IqTarget childTarget2 = new IqChargeStateTarget();
            IqTarget childTarget3 = new IqChargeStateTarget();


            parentTarget.AddTarget(childTarget1);
            parentTarget.AddTarget(childTarget2);
            parentTarget.AddTarget(childTarget3);

            var workflowAssigner = new IqWorkflowAssigner();

            workflowAssigner.AssignWorkflowToParent(parentWorkflow, parentTarget);
            workflowAssigner.AssignWorkflowToChildren(childWorkflow, parentTarget);

            Assert.IsNotNull(parentTarget.ChildTargets().First().Workflow);

            var childTargets = parentTarget.ChildTargets();

            foreach (var childTarget in childTargets)
            {
                Assert.IsTrue(childTarget.Workflow is BasicIqWorkflow);
            }

            Assert.IsTrue(parentTarget.Workflow is O16O18IqWorkflow);
        }
예제 #3
0
        public void FailureToFindAnyChromatogramDataTest1()
        {
            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);


            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();

            parameters.ChromGenTolerance = 1;    //very narrow tolerance



            IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters);
            IqTarget   target     = new IqChargeStateTarget(iqWorkflow);

            target.EmpiricalFormula = DeconTools.Backend.Utilities.IsotopeDistributionCalculation.IsotopicDistributionCalculator.Instance.GetAveragineFormulaAsString(1399);
            target.ElutionTimeTheor = 0.3;
            target.ChargeState      = 1;


            target.DoWorkflow();
            var result = target.GetResult();

            Assert.IsTrue(result.Target.TheorIsotopicProfile != null);
            Assert.IsTrue(result != null);
            Assert.IsTrue(result.IqResultDetail.Chromatogram == null);

            var reportString = result.ToStringWithDetailedReport();

            Console.WriteLine(reportString);
        }
예제 #4
0
        protected override IqTarget ConvertTextToIqTarget(List <string> processedRowOfText)
        {
            var child = new IqChargeStateTarget();

            child.ChargeState       = ParseIntField(processedRowOfText, ChargeHeader);
            child.ObservedScan      = ParseIntField(processedRowOfText, ScansHeader);
            child.AlternateID       = ParseIntField(processedRowOfText, PRSMIdHeader);
            child.DatabaseReference = ParseStringField(processedRowOfText, ProteinNameHeader);
            return(child);
        }
        public void ChromCorrelatorTest1()
        {
            var rawFilename = @"D:\Data\O16O18\Vlad_Mouse\mhp_plat_test_1_14April13_Frodo_12-12-04.raw";
            var run         = new RunFactory().CreateRun(rawFilename);

            WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();
            var executor = new IqExecutor(executorBaseParameters, run);

            executor.LoadChromData(run);

            var workflowAssigner = new IqWorkflowAssigner();

            TargetedWorkflowParameters workflowParameters = new O16O18WorkflowParameters();
            IqWorkflow workflow = new O16O18IqWorkflow(run, workflowParameters);

            IqTarget iqTarget = new IqChargeStateTarget();

            iqTarget.EmpiricalFormula = "C58H100N18O20";
            iqTarget.Code             = "GAAQNIIPASTGAAK";
            iqTarget.ID          = 1093;
            iqTarget.ChargeState = 0;

            var iqTargetList = new List <IqTarget>();

            iqTargetList.Add(iqTarget);

            var utilities = new IqTargetUtilities();

            utilities.CreateChildTargets(iqTargetList);



            workflowAssigner.AssignWorkflowToParent(workflow, iqTargetList);
            workflowAssigner.AssignWorkflowToChildren(workflow, iqTargetList);

            var theorFeatureGenerator = new JoshTheorFeatureGenerator();

            foreach (var target in iqTarget.ChildTargets())
            {
                utilities.UpdateTargetMissingInfo(target);
                target.TheorIsotopicProfile = theorFeatureGenerator.GenerateTheorProfile(target.EmpiricalFormula, target.ChargeState);
            }



            foreach (var childTarget in iqTarget.ChildTargets())
            {
                var result     = childTarget.CreateResult();
                var correlator = new O16O18ChromCorrelator(7, 0.1, 20, Globals.ToleranceUnit.PPM);
                var corrData   = correlator.CorrelateData(run, result, 5700, 6500);

                var corrDataItem1 = corrData.CorrelationDataItems.First();
                Console.WriteLine("z= \t" + childTarget.ChargeState + "\tCorrelationData (slope,intercept,rsquared)= \t" + corrDataItem1);
            }
        }
        public void NodeLevelTest1()
        {
            var util = new IqTargetUtilities();

            IqTarget iqTarget1 = new IqChargeStateTarget();
            IqTarget iqTarget2 = new IqChargeStateTarget();

            IqTarget iqTarget3_1 = new IqChargeStateTarget();

            iqTarget3_1.ID = 3001;


            IqTarget iqTarget3_2 = new IqChargeStateTarget();

            iqTarget3_2.ID = 3002;



            IqTarget iqTarget4 = new IqChargeStateTarget();

            IqTarget iqTarget5 = new IqChargeStateTarget();



            iqTarget4.AddTarget(iqTarget5);
            iqTarget3_1.AddTarget(iqTarget4);
            iqTarget2.AddTarget(iqTarget3_1);
            iqTarget2.AddTarget(iqTarget3_2);
            iqTarget1.AddTarget(iqTarget2);


            var rootNode = iqTarget5.RootTarget;

            Assert.AreEqual(rootNode, iqTarget1);


            var nodeLevelCount = util.GetTotalNodelLevels(iqTarget1);

            Assert.AreEqual(5, nodeLevelCount);

            nodeLevelCount = util.GetTotalNodelLevels(iqTarget5);

            Assert.AreEqual(5, nodeLevelCount);

            var targetList = new List <IqTarget>();

            targetList.Add(iqTarget1);

            var level2Targets = util.GetTargetsFromNodelLevel(targetList, 2);

            foreach (var level2Target in level2Targets)
            {
                Console.WriteLine(level2Target);
            }
        }
예제 #7
0
        public void ChromPeakAnalyzerWorkflowWrongTargetTest()
        {
            //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-884

            var testFile = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var run      = new RunFactory().CreateRun(testFile);
            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            IqTarget testTarget = new IqChargeStateTarget();

            testTarget.SetWorkflow(new ChromPeakAnalyzerIqWorkflow(run, parameters));
            testTarget.DoWorkflow();
        }
예제 #8
0
        public void IqWorkflowTest1()
        {
            //see  https://jira.pnnl.gov/jira/browse/OMCS-709

            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.CreateAndAlignRun(testFile, peaksTestFile);

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

            mtc = mtimporter.Import();

            var testMassTagID  = 24800;
            var oldStyleTarget = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First();

            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();

            parameters.ChromatogramCorrelationIsPerformed = true;
            parameters.ChromSmootherNumPointsInSmooth     = 9;
            parameters.ChromPeakDetectorPeakBR            = 1;
            parameters.ChromPeakDetectorSigNoise          = 1;

            IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters);

            IqTarget target = new IqChargeStateTarget(iqWorkflow);

            target.ID               = oldStyleTarget.ID;
            target.MZTheor          = oldStyleTarget.MZ;
            target.ElutionTimeTheor = oldStyleTarget.NormalizedElutionTime;
            target.MonoMassTheor    = oldStyleTarget.MonoIsotopicMass;
            target.EmpiricalFormula = oldStyleTarget.EmpiricalFormula;
            target.ChargeState      = oldStyleTarget.ChargeState;

            Console.WriteLine(target.EmpiricalFormula + "\t" + target.ChargeState);


            target.DoWorkflow();
            var result = target.GetResult();

            Assert.IsNotNull(result, "result is null");

            var reportString = result.ToStringWithDetailedReport();

            Console.WriteLine(reportString);
        }
예제 #9
0
        public void ChromPeakAnalyzerWorkflowTest()
        {
            //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-884

            var testFile      = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = UnitTesting2.FileRefs.PeakDataFiles.OrbitrapPeakFile_scans5500_6500;
            var run           = new RunFactory().CreateRun(testFile);
            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();
            var testTarget = new ChromPeakIqTarget();
            ITheorFeatureGenerator TheorFeatureGen = new JoshTheorFeatureGenerator(DeconTools.Backend.Globals.LabellingType.NONE, 0.005);

            var testPeak = new ChromPeak(5184, 840963, 50, 0);

            var executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();
            var executor = new TopDownMSAlignExecutor(executorBaseParameters, run);

            executor.ChromSourceDataFilePath = peaksTestFile;

            var workflow = new ChromPeakAnalyzerIqWorkflow(run, parameters);

            testTarget.SetWorkflow(workflow);

            testTarget.ID                   = 1;
            testTarget.Code                 = "NGIIMMENR";
            testTarget.EmpiricalFormula     = "C43H76N14O14S2";
            testTarget.MonoMassTheor        = 1076.510631;
            testTarget.ChromPeak            = testPeak;
            testTarget.ChargeState          = 1;
            testTarget.TheorIsotopicProfile = TheorFeatureGen.GenerateTheorProfile(testTarget.EmpiricalFormula, testTarget.ChargeState);

            var      testTargetList = new List <IqTarget>();
            IqTarget testParent     = new IqChargeStateTarget();

            testParent.AddTarget(testTarget);
            testTargetList.Add(testTarget);

            executor.Execute(testTargetList);

            var result = testTarget.GetResult();

            Assert.NotNull(result.LCScanSetSelected);
            Assert.AreNotEqual(1, result.FitScore);
            Assert.AreEqual(true, result.IsotopicProfileFound);
        }
예제 #10
0
        protected override IqTarget ConvertTextToIqTarget(List <string> processedRow)
        {
            IqTarget target = new IqChargeStateTarget();

            target.ID = ParseIntField(processedRow, TargetIDHeaders, -1);

            if (target.ID == -1)
            {
                target.ID = GetAutoIncrementForTargetID();
            }


            target.EmpiricalFormula = ParseStringField(processedRow, EmpiricalFormulaHeaders, string.Empty);
            target.Code             = ParseStringField(processedRow, CodeHeaders, "");
            target.ElutionTimeTheor = ParseDoubleField(processedRow, NETHeaders, 0);
            target.ScanLC           = ParseIntField(processedRow, ScanHeaders, -1);
            target.QualityScore     = ParseDoubleField(processedRow, QualityScoreHeaders, -1);
            target.ChargeState      = ParseIntField(processedRow, ChargeStateHeaders, 0);

            return(target);
        }
예제 #11
0
        public static IqTarget GetIQTargetStandard(int standardNum)
        {
            //MassTagID	MonoisotopicMass	NET	NETStDev	Obs	minMSGF	mod_count	mod_description	pmt_quality_score	peptide	peptideex	Multiple_Proteins
            //86963986	1516.791851	0.227147	0.007416702	3	1	0		2.00000	AAKEGISCEIIDLR	M.AAKEGISCEIIDLR.T	0



            IqTarget target = new IqChargeStateTarget(null);

            target.ID               = 86963986;
            target.MonoMassTheor    = 1516.791851;
            target.EmpiricalFormula = "C64H112N18O22S";
            target.Code             = "AAKEGISCEIIDLR";
            target.ChargeState      = 2;
            target.ElutionTimeTheor = 0.227147;
            target.MZTheor          = target.MonoMassTheor / target.ChargeState + Globals.PROTON_MASS;


            var theorFeatureGenerator = new JoshTheorFeatureGenerator();

            target.TheorIsotopicProfile = theorFeatureGenerator.GenerateTheorProfile(target.EmpiricalFormula, target.ChargeState);

            return(target);
        }
예제 #12
0
        public void IqExportResultsTest()
        {
            //Reference JIRA: https://jira.pnnl.gov/jira/browse/OMCS-832

            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.CreateAndAlignRun(testFile, peaksTestFile);

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

            mtc = mtimporter.Import();

            var testMassTagID  = 24800;
            var oldStyleTarget = (from n in mtc.TargetList where n.ID == testMassTagID && n.ChargeState == 2 select n).First();

            TargetedWorkflowParameters parameters = new BasicTargetedWorkflowParameters();

            parameters.ChromatogramCorrelationIsPerformed = true;
            parameters.ChromSmootherNumPointsInSmooth     = 9;
            parameters.ChromPeakDetectorPeakBR            = 1;
            parameters.ChromPeakDetectorSigNoise          = 1;

            WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();

            IqWorkflow iqWorkflow = new BasicIqWorkflow(run, parameters);

            IqTarget target = new IqChargeStateTarget(iqWorkflow);

            target.ID               = oldStyleTarget.ID;
            target.MZTheor          = oldStyleTarget.MZ;
            target.ElutionTimeTheor = oldStyleTarget.NormalizedElutionTime;
            target.MonoMassTheor    = oldStyleTarget.MonoIsotopicMass;
            target.EmpiricalFormula = oldStyleTarget.EmpiricalFormula;
            target.ChargeState      = oldStyleTarget.ChargeState;

            var targets = new List <IqTarget>(1);

            targets.Add(target);

            var executor = new IqExecutor(executorBaseParameters, run);

            //executor.ChromSourceDataFilePath = peaksTestFile;
            executor.Execute(targets);

            Assert.IsTrue(File.Exists(@"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Results\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_iqResults.txt"));
            using (var reader = new StreamReader(@"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Results\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_iqResults.txt"))
            {
                var temp = reader.ReadLine();
                Assert.AreEqual(
                    "TargetID\tCode\tEmpiricalFormula\tChargeState\tMonomassTheor\tMZTheor\tElutionTimeTheor\tMonoMassObs\tMZObs\tElutionTimeObs\tChromPeaksWithinTolerance\tScan\tAbundance\tIsoFitScore\tInterferenceScore",
                    temp);
                temp = reader.ReadLine();
                Console.WriteLine(temp);
                Assert.AreEqual(
                    "24800\t\tC64H110N18O19\t2\t1434.8193888\t718.41697089\t0.321639209985733\t1434.81096195126\t718.412757465632\t0.318046778440475\t0\t5942\t1352176\t0.0850492709063084\t0.0942918054560866",
                    temp);
            }
        }