Exemple #1
0
        protected override IqTarget ConvertTextToIqTarget(List <string> processedRow)
        {
            var target = new IqTargetMsgfFirstHit();

            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);
            target.MassError        = ParseDoubleField(processedRow, MassErrorHeaders, 0);
            target.MZTheor          = ParseDoubleField(processedRow, MzHeaders, 0);

            target.MonoMassTheor = (target.MZTheor - DeconTools.Backend.Globals.PROTON_MASS) * target.ChargeState;


            var targetUtilities = new IqTargetUtilities();



            return(target);
        }
        public void ImportIqTargetsFromMsgfTest1()
        {
            var targetsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Targets\Yellow_C13_070_23Mar10_Griffin_10-01-28_msgfplus.tsv";
            var importer    = new BasicIqTargetImporter(targetsFile);

            var targets = importer.Import();

            Assert.IsNotNull(targets);
            Assert.IsTrue(targets.Any());


            var utilities = new IqTargetUtilities();

            foreach (var iqTarget in targets)
            {
                utilities.UpdateTargetMissingInfo(iqTarget, false);
            }


            Assert.IsTrue(targets.Count > 10);
            foreach (var iqTarget in targets.Take(10))
            {
                Console.WriteLine(iqTarget.ToString() + "\t" + iqTarget.ScanLC + "\t" + iqTarget.QualityScore);
            }
        }
        public void CreateTargetsFromEmpiricalFormulaOnlyLargePeptideTest1()
        {
            var util = new IqTargetUtilities();

            var peptideSequence =
                "PEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDEPEPITIDE";

            var peptideUtil      = new PeptideUtils();
            var empiricalFormula = peptideUtil.GetEmpiricalFormulaForPeptideSequence(peptideSequence);



            var formulas = new string[] { empiricalFormula };


            var targets = util.CreateTargets(formulas);


            foreach (var parentTarget in targets)
            {
                Console.WriteLine(parentTarget.ID + "\t" + parentTarget.MonoMassTheor.ToString("0.00000") + "\tNumChildren= " + parentTarget.ChildTargets().Count());
                if (parentTarget.HasChildren())
                {
                    foreach (var childTarget in parentTarget.ChildTargets())
                    {
                        Console.WriteLine("\t\t\t" + childTarget.ID + "\t" + childTarget.MonoMassTheor.ToString("0.00000") + "\t" +
                                          childTarget.MZTheor.ToString("0.00000") + "\t" + childTarget.ChargeState + "\t" + (1.00235d / childTarget.ChargeState).ToString("0.0000"));
                    }
                }
            }
        }
        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);
            }
        }
        public void ExecutorCreatingTargetsTest1()
        {
            var util          = new IqTargetUtilities();
            var testFile      = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_scans5500-6500_peaks.txt";

            var targetsFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt";

            var resultsFolder = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Results";

            var expectedResultsFilename = Path.Combine(resultsFolder, RunUtilities.GetDatasetName(testFile) + "_iqResults.txt");

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


            WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();

            executorBaseParameters.ChromGenSourceDataPeakBR   = 3;
            executorBaseParameters.ChromGenSourceDataSigNoise = 2;
            executorBaseParameters.TargetsFilePath            = targetsFile;


            //create no more than two charge state targets per peptide
            executorBaseParameters.MaxNumberOfChargeStateTargetsToCreate = 2;

            var run = new RunFactory().CreateRun(testFile);

            var executor = new IqExecutor(executorBaseParameters, run);

            executor.ChromSourceDataFilePath = peaksTestFile;

            executor.LoadAndInitializeTargets(targetsFile);
            executor.Targets = (from n in executor.Targets where n.ElutionTimeTheor > 0.305 && n.ElutionTimeTheor < 0.325 select n).Take(10).ToList();

            foreach (var iqTarget in executor.Targets)
            {
                var numChildTargets = iqTarget.GetChildCount();

                Assert.IsTrue(numChildTargets <= 2);    //MaxNumberOfChargeStateTargetsToCreate = 2;

                Console.WriteLine(iqTarget + "\t" + numChildTargets);
            }
        }
        public void CreateTargetsFromEmpiricalFormulaOnlyTest1()
        {
            var util = new IqTargetUtilities();


            var formulas = new string[] { "C133H213N29O44", "C95H155N29O39", "C126H198N32O42", "C109H168N24O37", "C103H165N29O35" };


            var targets = util.CreateTargets(formulas);


            foreach (var parentTarget in targets)
            {
                Console.WriteLine(parentTarget.ID + "\t" + parentTarget.MonoMassTheor.ToString("0.00000") + "\tNumChildren= " + parentTarget.ChildTargets().Count());
                if (parentTarget.HasChildren())
                {
                    foreach (var childTarget in parentTarget.ChildTargets())
                    {
                        Console.WriteLine("\t\t\t" + childTarget.ID + "\t" + childTarget.MonoMassTheor.ToString("0.000") + "\t" +
                                          childTarget.MZTheor.ToString("0.000") + "\t" + childTarget.ChargeState);
                    }
                }
            }
        }
        public void ExecuteMultipleTargetsTest1()
        {
            var util          = new IqTargetUtilities();
            var testFile      = UnitTesting2.FileRefs.RawDataMSFiles.OrbitrapStdFile1;
            var peaksTestFile = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_scans5500-6500_peaks.txt";

            var targetsFile = @"\\protoapps\UserData\Slysz\Data\MassTags\QCShew_Formic_MassTags_Bin10_all.txt";

            WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();

            executorBaseParameters.ChromGenSourceDataPeakBR   = 3;
            executorBaseParameters.ChromGenSourceDataSigNoise = 2;
            executorBaseParameters.TargetsFilePath            = targetsFile;
            executorBaseParameters.OutputFolderBase           = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled";

            var expectedResultsFilename = Path.Combine(executorBaseParameters.OutputFolderBase,
                                                       "IqResults",
                                                       RunUtilities.GetDatasetName(testFile) + "_iqResults.txt");

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

            var run = new RunFactory().CreateRun(testFile);

            var executor = new IqExecutor(executorBaseParameters, run);

            executor.ChromSourceDataFilePath = peaksTestFile;

            executor.LoadAndInitializeTargets(targetsFile);
            executor.Targets = (from n in executor.Targets where n.ElutionTimeTheor > 0.305 && n.ElutionTimeTheor < 0.325 select n).Take(10).ToList();

            var targetedWorkflowParameters = new BasicTargetedWorkflowParameters();

            targetedWorkflowParameters.ChromNETTolerance = 0.5;

            //define workflows for parentTarget and childTargets
            var parentWorkflow = new BasicIqWorkflow(run, targetedWorkflowParameters);
            var childWorkflow  = new BasicIqWorkflow(run, targetedWorkflowParameters);

            var workflowAssigner = new IqWorkflowAssigner();

            workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets);
            workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets);


            //Main line for executing IQ:
            executor.Execute();

            //Test the results...
            Assert.IsTrue(File.Exists(expectedResultsFilename), "results file doesn't exist");
            var numResultsInResultsFile = 0;
            var outputToConsole         = true;

            using (var reader = new StreamReader(expectedResultsFilename))
            {
                while (reader.Peek() != -1)
                {
                    var line = reader.ReadLine();
                    numResultsInResultsFile++;

                    if (outputToConsole)
                    {
                        Console.WriteLine(line);
                    }
                }
            }

            Assert.IsTrue(numResultsInResultsFile > 1, "No results in output file");

            //the Result Tree is flattened out in the results file.
            Assert.IsTrue(numResultsInResultsFile == 11);

            //the results in the Executor are in the a Result tree. So there should be just 10.
            Assert.AreEqual(10, executor.Results.Count);
        }
Exemple #9
0
        public void ExecutorTest1()
        {
            Console.WriteLine(Environment.CurrentDirectory);
            var util     = new IqTargetUtilities();
            var testFile = @"\\proto-5\External_Waters_TOF_Xfer\MzML_Files\130716_iPRG14_004.mzML";
            //string peaksTestFile =
            //@"\\protoapps\UserData\Slysz\DeconTools_TestFiles\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_scans5500-6500_peaks.txt";
            var targetsFile = @"\\protoapps\UserData\Fujimoto\SangtaeBottomUp\msgfPlus\C~~data~iPRG 2014~130716_iPRG14_004.raw.-1_Filtered.tsv";

            WorkflowExecutorBaseParameters executorBaseParameters = new BasicTargetedWorkflowExecutorParameters();

            executorBaseParameters.ChromGenSourceDataPeakBR   = 3;
            executorBaseParameters.ChromGenSourceDataSigNoise = 2;
            executorBaseParameters.TargetsFilePath            = targetsFile;
            executorBaseParameters.OutputFolderBase           =
                @"\\protoapps\UserData\Fujimoto\SangtaeBottomUp\Results";


            var expectedResultsFilename = Path.Combine(executorBaseParameters.OutputFolderBase,
                                                       "IqResults",
                                                       RunUtilities.GetDatasetName(testFile) + "_iqResults.txt");

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


            var run = new RunFactory().CreateRun(testFile);

            var executor = new IqExecutor(executorBaseParameters, run);

            //executor.ChromSourceDataFilePath = peaksTestFile;

            executor.LoadAndInitializeTargets(targetsFile);

            var targetedWorkflowParameters = new BasicTargetedWorkflowParameters();

            targetedWorkflowParameters.ChromNETTolerance = 0.05;

            //define workflows for parentTarget and childTargets
            var parentWorkflow = new ChromPeakDeciderIqWorkflow(run, targetedWorkflowParameters);
            var childWorkflow  = new ChargeStateChildIqWorkflow(run, targetedWorkflowParameters);

            var workflowAssigner = new IqWorkflowAssigner();

            workflowAssigner.AssignWorkflowToParent(parentWorkflow, executor.Targets);
            workflowAssigner.AssignWorkflowToChildren(childWorkflow, executor.Targets);

            //SipperDataDump.DataDumpSetup(@"\\pnl\projects\MSSHARE\Merkley_Eric\For_Grant\IqResults\EXP6B_F1_CSCL_LIGHT_130520020056\EXP6B_F1_CSCL_LIGHT_FULLRESULTS.txt");

            //Main line for executing IQ:
            executor.Execute();

            //Test the results...
            var numResultsInResultsFile = 0;
            var outputToConsole         = true;

            using (var reader = new StreamReader(expectedResultsFilename))
            {
                while (reader.Peek() != -1)
                {
                    var line = reader.ReadLine();
                    numResultsInResultsFile++;

                    if (outputToConsole)
                    {
                        Console.WriteLine(line);
                    }
                }
            }
        }