protected virtual void SetupLogging()
        {
            string loggingFolder;

            if (string.IsNullOrEmpty(ExecutorParameters.OutputFolderBase))
            {
                loggingFolder = RunUtilities.GetDatasetParentFolder(DatasetPath);
            }
            else
            {
                loggingFolder = Path.Combine(ExecutorParameters.OutputFolderBase, "Logs");
            }

            try
            {
                if (!Directory.Exists(loggingFolder))
                {
                    Directory.CreateDirectory(loggingFolder);
                }
            }
            catch (Exception ex)
            {
                throw new System.IO.IOException("Trying to set up logging folder but there was a critical error. Details:\n\n" + ex.Message, ex);
            }


            _loggingFileName = Path.Combine(loggingFolder, RunUtilities.GetDatasetName(DatasetPath) + "_log.txt");
        }
Ejemplo n.º 2
0
        public void TopDownWorkflowTest1()
        {
            //see https://jira.pnnl.gov/jira/browse/OMCR-98

            string baseFolder =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Topdown_standard_testing\Test1_MSAlign_ProteusPeriIntact";

            const string executorParameterFile =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Topdown_standard_testing\Test1_MSAlign_ProteusPeriIntact\Parameters\topdownExecutorParameters1.xml";
            var executorParameters = new TopDownTargetedWorkflowExecutorParameters();

            executorParameters.LoadParameters(executorParameterFile);
            executorParameters.ExportChromatogramData = false;
            executorParameters.OutputFolderBase       =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Topdown_standard_testing\Test1_MSAlign_ProteusPeriIntact";


            const string testDatasetPath =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Topdown_standard_testing\Test1_MSAlign_ProteusPeriIntact\RawData\Proteus_Peri_intact_ETD.raw";


            string testDatasetName = RunUtilities.GetDatasetName(testDatasetPath);

            string expectedResultsFilename = executorParameters.OutputFolderBase + "\\IqResults" + "\\" + testDatasetName + "_quant.txt";

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

            var executor = new TopDownTargetedWorkflowExecutor(executorParameters, testDatasetPath);

            string proteinSeq =
                @"A.VDKTNPYALMEDAAQKTFDKLKTEQPEIRKNPELLREIVQQELLPYVHIKYAGALVLGPYYRNATPAQRDAYFAAFKDYLAQVYGQALAMYEGQEYRIEPAKPFADKSNLTIRVTIIDKNGRPPVRLDFQWRKNSKTGEWQAYDMIAEGVSMITTKQNEWSDILSAKGVDGLTKQLEISAKTPITLDEKK.";

            executor.Targets.TargetList = executor.Targets.TargetList.Where(p => p.Code == proteinSeq).ToList();
            executor.Execute();

            Assert.IsNotNull(executor.TargetedWorkflow.Run);

            Console.WriteLine("Num targetedResults in Run = " + executor.TargetedWorkflow.Run.ResultCollection.MassTagResultList.Count);

            Assert.IsTrue(File.Exists(expectedResultsFilename), "Results file does not exist!");


            //TODO: fix _quant.txt output column headers
            TopDownTargetedResultFromTextImporter importer = new TopDownTargetedResultFromTextImporter(expectedResultsFilename);
            var results = importer.Import();

            Assert.IsNotNull(results);
            Assert.IsTrue(results.HasResults);
            Assert.AreEqual(1, results.Results.Count);

            //foreach (var r in results.Results)
            //{
            //    Console.WriteLine(r.TargetID + "\t" + r.ScanLC + "\t" + r.Intensity);
            //}
        }
Ejemplo n.º 3
0
        public void TopDownWorkflowFullTargetSet()
        {
            var executorParameters = new TopDownTargetedWorkflowExecutorParameters();

            executorParameters.CopyRawFileLocal = false;
            executorParameters.DeleteLocalDatasetAfterProcessing = false;
            executorParameters.TargetsFilePath        = @"\\protoapps\UserData\Fujimoto\TopDownTesting\Targets\fullTargetSet\Proteus_Peri_intact_ETD_MSAlign_ResultTable.Filtered05FDR.txt";
            executorParameters.TargetType             = Globals.TargetType.LcmsFeature;
            executorParameters.ExportChromatogramData = true;

            var workflowParameters = new TopDownTargetedWorkflowParameters();

            workflowParameters.AreaOfPeakToSumInDynamicSumming    = 2;
            workflowParameters.ChromatogramCorrelationIsPerformed = false;
            workflowParameters.ChromGeneratorMode             = Globals1.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK;
            workflowParameters.ChromGenSourceDataPeakBR       = 4;
            workflowParameters.ChromGenSourceDataSigNoise     = 3;
            workflowParameters.ChromNETTolerance              = 0.025;
            workflowParameters.ChromPeakDetectorPeakBR        = 0.1;
            workflowParameters.ChromPeakDetectorSigNoise      = 0.1;
            workflowParameters.ChromPeakSelectorMode          = Globals1.PeakSelectorMode.Smart;
            workflowParameters.ChromSmootherNumPointsInSmooth = 9;
            workflowParameters.MaxScansSummedInDynamicSumming = 100;
            workflowParameters.MSPeakDetectorPeakBR           = 1.3;
            workflowParameters.MSPeakDetectorSigNoise         = 2;
            workflowParameters.ChromGenTolerance              = 15;
            workflowParameters.MSToleranceInPPM = 25;
            workflowParameters.MultipleHighQualityMatchesAreAllowed = true;
            workflowParameters.NumChromPeaksAllowedDuringSelection  = 10;
            workflowParameters.NumMSScansToSum = 5;
            workflowParameters.ResultType      = Globals1.ResultType.TOPDOWN_TARGETED_RESULT;
            workflowParameters.SummingMode     = SummingModeEnum.SUMMINGMODE_STATIC;

            const string testDatasetPath =
                @"\\protoapps\UserData\Fujimoto\TopDownTesting\RawData\Proteus_Peri_intact_ETD.raw";


            string resultsFolderLocation = Path.Combine(executorParameters.OutputFolderBase, "Results");

            string testDatasetName = RunUtilities.GetDatasetName(testDatasetPath);

            string expectedResultsFilename = Path.Combine(resultsFolderLocation, testDatasetName + "_quant.txt");

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

            var executor = new TopDownTargetedWorkflowExecutor(executorParameters, workflowParameters, testDatasetPath);

            executor.Execute();

            Assert.IsNotNull(executor.TargetedWorkflow.Run);
            Assert.IsTrue(File.Exists(expectedResultsFilename), "Results file does not exist!");
        }
        protected string TryFindTargetsForCurrentDataset()
        {
            var datasetName = RunUtilities.GetDatasetName(DatasetPath);

            string[] possibleFileSuffixs = { "_iqTargets.txt", "_targets.txt", "_LCMSFeatures.txt", "_MSGFPlus.tsv", "_msgfdb_fht.txt" };


            var possibleTargetFiles = new List <FileInfo>();

            var targetsBaseFolder = ExecutorParameters.TargetsBaseFolder;

            if (string.IsNullOrEmpty(ExecutorParameters.TargetsBaseFolder))
            {
                targetsBaseFolder = Path.Combine(ExecutorParameters.OutputFolderBase, "Targets");
            }

            var dirinfo = new DirectoryInfo(targetsBaseFolder);

            foreach (var suffix in possibleFileSuffixs)
            {
                var fileInfos = dirinfo.GetFiles("*" + suffix);


                foreach (var fileInfo in fileInfos)
                {
                    if (fileInfo.Name.StartsWith(datasetName, StringComparison.OrdinalIgnoreCase))
                    {
                        possibleTargetFiles.Add(fileInfo);
                    }
                }
            }

            if (possibleTargetFiles.Count == 0)
            {
                return(string.Empty);
            }
            else if (possibleTargetFiles.Count == 1)
            {
                return(possibleTargetFiles.First().FullName);
            }
            else
            {
                var sb = new StringBuilder();

                sb.Append("Error in getting IQ target file. Multiple files were found for the dataset: " + datasetName + Environment.NewLine);
                sb.Append("Candidate IQ target files: " + Environment.NewLine);

                foreach (var possibleTargetFile in possibleTargetFiles)
                {
                    sb.Append(possibleTargetFile.FullName + Environment.NewLine);
                }

                throw new NotSupportedException(sb.ToString());
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        public void WorkflowTestUsingParameterFile1()
        {
            var parameterFile =
                @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\DeconMSn\ParameterFiles\DeconMSn_LTQ_Orb_SN2_PeakBR1pt3_PeptideBR1_scans6000_6050.xml";

            var rawdataFile = FileRefs.RawDataMSFiles.OrbitrapStdFile1;

            var outputFolder = @"\\protoapps\UserData\Slysz\DeconTools_TestFiles\DeconMSn\Output";

            var datasetName = RunUtilities.GetDatasetName(rawdataFile);

            var expectedResultsFile1 = Path.Combine(outputFolder, datasetName + ".mgf");
            var expectedResultsFile2 = Path.Combine(outputFolder, datasetName + "_DeconMSn_log.txt");
            var expectedResultsFile3 = Path.Combine(outputFolder, datasetName + "_profile.txt");

            if (File.Exists(expectedResultsFile1))
            {
                File.Delete(expectedResultsFile1);
            }
            if (File.Exists(expectedResultsFile2))
            {
                File.Delete(expectedResultsFile2);
            }
            if (File.Exists(expectedResultsFile3))
            {
                File.Delete(expectedResultsFile3);
            }

            var workflow = ScanBasedWorkflow.CreateWorkflow(rawdataFile, parameterFile, outputFolder);

            workflow.Execute();

            Assert.IsTrue(File.Exists(expectedResultsFile1));
            Assert.IsTrue(File.Exists(expectedResultsFile2));
            Assert.IsTrue(File.Exists(expectedResultsFile3));
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public void IqExecutor_StandardO16O18Testing_VladAlz()
        {
            //see JIRA https://jira.pnnl.gov/jira/browse/OMCS-628

            var executorParametersFile =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Parameters\ExecutorParameters1.xml";

            var executorParameters = new BasicTargetedWorkflowExecutorParameters();

            executorParameters.LoadParameters(executorParametersFile);

            executorParameters.OutputFolderBase =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz";

            var testDatasetPath =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\RawData\Alz_P01_A01_097_26Apr12_Roc_12-03-15.RAW";

            executorParameters.IsMassAlignmentPerformed = true;
            executorParameters.IsNetAlignmentPerformed  = true;

            executorParameters.ReferenceTargetsFilePath =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2.txt";


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

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



            var autoSavedExecutorParametersFile =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Parameters\ExecutorParameters1_autosaved.xml";

            executorParameters.SaveParametersToXML(autoSavedExecutorParametersFile);

            var run      = new RunFactory().CreateRun(testDatasetPath);
            var executor = new IqExecutor(executorParameters, run);

            var targetsFile =
                @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2_First60.txt";

            targetsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\O16O18_standard_testing\Test1_VladAlz\Targets\MT_Human_ALZ_O18_P836\MassTags_PMT2.txt";


            executor.LoadAndInitializeTargets(targetsFile);
            executor.SetupMassAndNetAlignment();

            var testTarget = 9282;

            executor.Targets = (from n in executor.Targets where n.ID == testTarget select n).ToList();

            var targetedWorkflowParameters = new BasicTargetedWorkflowParameters();

            targetedWorkflowParameters.ChromNETTolerance  = 0.025;
            targetedWorkflowParameters.ChromGeneratorMode = Globals.ChromatogramGeneratorMode.O16O18_THREE_MONOPEAKS;

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

            var workflowAssigner = new IqWorkflowAssigner();

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

            executor.DoAlignment();
            executor.Execute();

            IqResultImporter importer = new IqResultImporterBasic(expectedResultsFilename);
            var allResults            = importer.Import();

            var result1 = allResults.First(p => p.Target.ID == 9282 && p.Target.ChargeState == 2);

            Assert.AreEqual(9282, result1.Target.ID);
            Assert.AreEqual(0.32678m, (decimal)result1.ElutionTimeObs);
            Assert.AreEqual(4545, result1.LcScanObs);
            Assert.AreEqual(0.02, (decimal)result1.FitScore);
        }
Ejemplo n.º 9
0
        public void TopDownWorkflowTestNoChargeStateList()
        {
            //see https://jira.pnnl.gov/jira/browse/OMCR-101

            var executorParameters = new TopDownTargetedWorkflowExecutorParameters();

            executorParameters.CopyRawFileLocal = false;
            executorParameters.DeleteLocalDatasetAfterProcessing = false;
            executorParameters.TargetsFilePath        = @"\\protoapps\UserData\Fujimoto\TopDownTesting\Targets\noChargeStateList\Proteus_Peri_intact_ETD_MSAlign_ResultTable.txt";
            executorParameters.TargetType             = Globals.TargetType.LcmsFeature;
            executorParameters.ExportChromatogramData = true;

            var workflowParameters = new TopDownTargetedWorkflowParameters();

            workflowParameters.AreaOfPeakToSumInDynamicSumming    = 2;
            workflowParameters.ChromatogramCorrelationIsPerformed = false;
            workflowParameters.ChromGeneratorMode             = Globals1.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK;
            workflowParameters.ChromGenSourceDataPeakBR       = 4;
            workflowParameters.ChromGenSourceDataSigNoise     = 3;
            workflowParameters.ChromNETTolerance              = 0.025;
            workflowParameters.ChromPeakDetectorPeakBR        = 0.1;
            workflowParameters.ChromPeakDetectorSigNoise      = 0.1;
            workflowParameters.ChromPeakSelectorMode          = Globals1.PeakSelectorMode.Smart;
            workflowParameters.ChromSmootherNumPointsInSmooth = 9;
            workflowParameters.MaxScansSummedInDynamicSumming = 100;
            workflowParameters.MSPeakDetectorPeakBR           = 1.3;
            workflowParameters.MSPeakDetectorSigNoise         = 2;
            workflowParameters.ChromGenTolerance              = 15;
            workflowParameters.MSToleranceInPPM = 25;
            workflowParameters.MultipleHighQualityMatchesAreAllowed = true;
            workflowParameters.NumChromPeaksAllowedDuringSelection  = 10;
            workflowParameters.NumMSScansToSum = 5;
            workflowParameters.ResultType      = Globals1.ResultType.TOPDOWN_TARGETED_RESULT;
            workflowParameters.SummingMode     = SummingModeEnum.SUMMINGMODE_STATIC;

            const string testDatasetPath =
                @"\\protoapps\UserData\Fujimoto\TopDownTesting\RawData\Proteus_Peri_intact_ETD.raw";


            string resultsFolderLocation = Path.Combine(executorParameters.OutputFolderBase, "Results");

            string testDatasetName = RunUtilities.GetDatasetName(testDatasetPath);

            string expectedResultsFilename = Path.Combine(resultsFolderLocation, testDatasetName + "_quant.txt");

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

            var executor = new TopDownTargetedWorkflowExecutor(executorParameters, workflowParameters, testDatasetPath);

            executor.Execute();

            /*
             * var currentTarget = executor.TargetedWorkflow.Result.Target;
             * Console.WriteLine("Target info:");
             * Console.WriteLine(currentTarget.ID + "\t" + currentTarget.MonoIsotopicMass + "\t" + currentTarget.MZ + "\t" + currentTarget.ChargeState + "\t"+ currentTarget.EmpiricalFormula);
             * Console.WriteLine("Theor profile");
             * TestUtilities.DisplayIsotopicProfileData(executor.TargetedWorkflow.Result.Target.IsotopicProfile);
             * TestUtilities.DisplayXYValues(executor.TargetedWorkflow.MassSpectrumXYData);
             * TestUtilities.DisplayXYValues(executor.TargetedWorkflow.ChromatogramXYData);
             * TestUtilities.DisplayPeaks(executor.TargetedWorkflow.ChromPeaksDetected.Select(p=>(Peak)p).ToList());
             */

            Assert.IsNotNull(executor.TargetedWorkflow.Run);

            Console.WriteLine("Num targetedResults in Run = " + executor.TargetedWorkflow.Run.ResultCollection.MassTagResultList.Count);

            Assert.IsTrue(File.Exists(expectedResultsFilename), "Results file does not exist!");

            //var resultsfile = new StreamReader(@"\\protoapps\UserData\Fujimoto\TopDownTesting\Results\noChargeStateList\Proteus_Peri_intact_ETD_quant.txt");
            //string line = resultsfile.ReadLine();
            //line = resultsfile.ReadLine();
            //string[] chargestatelist = line.Split('\t');
            //Assert.AreEqual("10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22", chargestatelist[2]);
            //resultsfile.Close();
        }
Ejemplo n.º 10
0
        public void TopDownWorkflowTestMissingChargeState()
        {
            //see https://jira.pnnl.gov/jira/browse/OMCR-102

            var executorParameters = new TopDownTargetedWorkflowExecutorParameters();

            executorParameters.CopyRawFileLocal = false;
            executorParameters.DeleteLocalDatasetAfterProcessing = false;
            executorParameters.TargetsFilePath        = @"\\protoapps\UserData\Fujimoto\TopDownTesting\Targets\missingChargeState\Proteus_Peri_intact_ETD_MSAlign_ResultTable.txt";
            executorParameters.TargetType             = Globals.TargetType.LcmsFeature;
            executorParameters.ExportChromatogramData = true;

            var workflowParameters = new TopDownTargetedWorkflowParameters();

            workflowParameters.AreaOfPeakToSumInDynamicSumming    = 2;
            workflowParameters.ChromatogramCorrelationIsPerformed = false;
            workflowParameters.ChromGeneratorMode             = Globals1.ChromatogramGeneratorMode.MOST_ABUNDANT_PEAK;
            workflowParameters.ChromGenSourceDataPeakBR       = 4;
            workflowParameters.ChromGenSourceDataSigNoise     = 3;
            workflowParameters.ChromNETTolerance              = 0.025;
            workflowParameters.ChromPeakDetectorPeakBR        = 0.1;
            workflowParameters.ChromPeakDetectorSigNoise      = 0.1;
            workflowParameters.ChromPeakSelectorMode          = Globals1.PeakSelectorMode.Smart;
            workflowParameters.ChromSmootherNumPointsInSmooth = 9;
            workflowParameters.MaxScansSummedInDynamicSumming = 100;
            workflowParameters.MSPeakDetectorPeakBR           = 1.3;
            workflowParameters.MSPeakDetectorSigNoise         = 2;
            workflowParameters.ChromGenTolerance              = 15;
            workflowParameters.MSToleranceInPPM = 25;
            workflowParameters.MultipleHighQualityMatchesAreAllowed = true;
            workflowParameters.NumChromPeaksAllowedDuringSelection  = 10;
            workflowParameters.NumMSScansToSum = 5;
            workflowParameters.ResultType      = Globals1.ResultType.TOPDOWN_TARGETED_RESULT;
            workflowParameters.SummingMode     = SummingModeEnum.SUMMINGMODE_STATIC;

            const string testDatasetPath =
                @"\\protoapps\UserData\Fujimoto\TopDownTesting\RawData\Proteus_Peri_intact_ETD.raw";


            string resultsFolderLocation = executorParameters.OutputFolderBase + "\\Results";

            string testDatasetName = RunUtilities.GetDatasetName(testDatasetPath);

            string expectedResultsFilename = Path.Combine(resultsFolderLocation, testDatasetName + "_quant.txt");

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

            var executor = new TopDownTargetedWorkflowExecutor(executorParameters, workflowParameters, testDatasetPath);

            string proteinSeq1 =
                @"A.AENVVHHKLDGMPISEAVEINAGNNLVFLSGKVPTKKSADAPEGELASYGNTEEQTINVLEQIKTNLNNLGLDMKDVVKMQVFLVGGEENNGTMDFKGFMNGYSKFYDASKTNQLPARSAFQVAKLANPAWRVEIEVIAVRPAK.";

            executor.Targets.TargetList = executor.Targets.TargetList.Where(p => (p.Code == proteinSeq1)).ToList();
            executor.Execute();

            Assert.IsNotNull(executor.TargetedWorkflow.Run);

            Console.WriteLine("Num targetedResults in Run = " + executor.TargetedWorkflow.Run.ResultCollection.MassTagResultList.Count);

            Assert.IsTrue(File.Exists(expectedResultsFilename), "Results file does not exist!");

            var    resultsfile = new StreamReader(@"\\protoapps\UserData\Fujimoto\TopDownTesting\Results\missingChargeState\Proteus_Peri_intact_ETD_quant.txt");
            string line        = resultsfile.ReadLine();

            line = resultsfile.ReadLine();
            string[] chargestatelist = line.Split('\t');
            Assert.AreEqual("10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22", chargestatelist[2]);
            resultsfile.Close();
        }
Ejemplo n.º 11
0
        public new void InitializeWorkflow()
        {
            //_loggingFileName = GetLogFileName(ExecutorParameters.LoggingFolder);

            Check.Require(WorkflowParameters is SipperWorkflowExecutorParameters, "Parameters are not of the right type.");


            var db     = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbName;
            var server = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbServer;
            var table  = ((SipperWorkflowExecutorParameters)WorkflowParameters).DbTableName;


            var massTagIDsForFiltering =
                GetMassTagsToFilterOn(((SipperWorkflowExecutorParameters)WorkflowParameters).TargetsToFilterOn).Distinct().ToList();

            _loggingFileName = Path.Combine(ExecutorParameters.OutputFolderBase, "Logs", RunUtilities.GetDatasetName(DatasetPath) + "_log.txt");


            TargetsAreFromPeakMatchingDataBase = (!String.IsNullOrEmpty(db) && !String.IsNullOrEmpty(server));

            var targetsFilePathIsEmpty = (String.IsNullOrEmpty(ExecutorParameters.TargetsFilePath));


            if (TargetsAreFromPeakMatchingDataBase)
            {
                Targets = LoadTargetsFromPeakMatchingResultsForGivenDataset(RunUtilities.GetDatasetName(DatasetPath));
            }
            else
            {
                if (targetsFilePathIsEmpty)
                {
                    var currentTargetsFilePath = TryFindTargetsForCurrentDataset();     //check for a _targets file specifically associated with dataset

                    if (String.IsNullOrEmpty(currentTargetsFilePath))
                    {
                        Targets = null;
                    }
                    else
                    {
                        Targets = GetLcmsFeatureTargets(currentTargetsFilePath);
                    }
                }
                else
                {
                    Targets = GetLcmsFeatureTargets(ExecutorParameters.TargetsFilePath);
                }
            }

            Check.Ensure(Targets != null && Targets.TargetList.Count > 0, "Failed to initialize - Target list is empty. Please check parameter file.");


            if (massTagIDsForFiltering.Count > 0)
            {
                Targets.TargetList =
                    (from n in Targets.TargetList
                     where massTagIDsForFiltering.Contains(((LcmsFeatureTarget)n).FeatureToMassTagID)
                     select n).ToList();
            }



            MassTagIDsinTargets = Targets.TargetList.Select(p => (long)((LcmsFeatureTarget)p).FeatureToMassTagID).Where(n => n > 0).ToList();

            if (TargetsAreFromPeakMatchingDataBase)
            {
                var mtImporter = new MassTagFromSqlDbImporter(db, server, MassTagIDsinTargets);
                MassTagsForReference = mtImporter.Import();
            }
            else
            {
                MassTagsForReference = GetMassTagTargets(((SipperWorkflowExecutorParameters)WorkflowParameters).ReferenceDataForTargets, MassTagIDsinTargets.Select(p => (int)p).ToList());
            }

            MassTagsForReference.TargetList = (from n in MassTagsForReference.TargetList
                                               group n by new
            {
                n.ID,
                n.ChargeState
            }
                                               into grp
                                               select grp.First()).ToList();



            UpdateTargetMissingInfo();


            _resultsFolder = GetResultsFolder(ExecutorParameters.OutputFolderBase);


            _workflowParameters = WorkflowParameters.CreateParameters(ExecutorParameters.WorkflowParameterFile);
            _workflowParameters.LoadParameters(ExecutorParameters.WorkflowParameterFile);

            TargetedWorkflow = TargetedWorkflow.CreateWorkflow(_workflowParameters);
        }
Ejemplo n.º 12
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);
                    }
                }
            }
        }