コード例 #1
0
        public void TestClassifyWithModelPipeline()
        {
            AnalysisPipeline pipeline = new AnalysisPipeline(MS1MatchFile, GlycosylationSitesFile, MS2DeconvolutionFile, ModelJsonFile, null, 1e-5, 2e-5, proteinProspectorXMLFilePath: ProteinProspectorXmlFile);

            ResultsRepresentation result = pipeline.RunClassification();
            Assert.IsInstanceOfType(result, typeof(ResultsRepresentation));
        }
コード例 #2
0
        static ResultsRepresentation TestFullRun()
        {
            Console.WriteLine("TestFullRun");
            AnalysisPipeline pipeline = new AnalysisPipeline(Properties.Resources.TestMS1Matches,
                Properties.Resources.TestGlycosylationSites, Properties.Resources.TestDeconvolutedMS2,
                Properties.Resources.TestGoldStandard,
                ms1MatchingTolerance:1e-5,
                ms2MatchingTolerance:2e-5,
                constantModifications: Modifications,
                variableModifications: Modifications,
                method:"default",
                outputFilePath:"test.csv",
                rscriptPath: Properties.Resources.DevelRscriptPath);
            ResultsRepresentation results = null;
            try
            {
                results = pipeline.RunClassification();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }

            int i = 0;
            foreach (GlycopeptidePrediction pred in results.MatchedPredictions)
            {
                Console.WriteLine(pred);
                i++;
                if (i > 5) break;
            }
            Console.WriteLine(pipeline.Scripter.LastCall.Out);
            return results;
        }
        /// <summary>
        /// Runs the Model Building Pipeline, yielding a partially annotated model in the form of a ResultsRepresentation object
        /// which is made from the parameters loaded into the Controller.
        /// </summary>
        /// <returns></returns>
        public ResultsRepresentation PrepareModelFile()
        {
            this.Pipeline = new AnalysisPipeline(MS1MatchFilePath,
                GlycosylationSiteFilePath, MS2DeconvolutionFilePath,
                modelFilePath: ModelFilePath, outputFilePath: null,
                proteinProspectorXMLFilePath: ProteinProspectorMSDigestFilePath,
                ms1MatchingTolerance: ConfigurationManager.Algorithm.MS1MassErrorTolerance,
                ms2MatchingTolerance: ConfigurationManager.Algorithm.MS2MassErrorTolerance,
                numProcesses: ConfigurationManager.Algorithm.NumProcesses,
                numDecoys: ConfigurationManager.Algorithm.NumDecoys,
                onlyRandomDecoys: ConfigurationManager.Algorithm.OnlyRandomDecoys,
                pythonInterpreterPath: ConfigurationManager.Scripting.PythonInterpreterPath,
                rscriptPath: null);

            ResultsRepresentation modelRepresentation = Pipeline.RunModelBuilder();
            File.Delete(modelRepresentation.SourceFile);
            return modelRepresentation;
        }
        public ResultsRepresentation ReclassifyWithModel(String reclassificationTargetFilePath)
        {
            this.Pipeline = new AnalysisPipeline(MS1MatchFilePath,
                GlycosylationSiteFilePath, MS2DeconvolutionFilePath,
                modelFilePath: ModelFilePath, outputFilePath: null,
                ms1MatchingTolerance: ConfigurationManager.Algorithm.MS1MassErrorTolerance,
                ms2MatchingTolerance: ConfigurationManager.Algorithm.MS2MassErrorTolerance,
                pythonInterpreterPath: ConfigurationManager.Scripting.PythonInterpreterPath,
                numProcesses: ConfigurationManager.Algorithm.NumProcesses,
                numDecoys: ConfigurationManager.Algorithm.NumDecoys,
                onlyRandomDecoys: ConfigurationManager.Algorithm.OnlyRandomDecoys,
                rscriptPath: null);

            ResultsRepresentation modelRepresentation = this.Pipeline.RunReclassification(reclassificationTargetFilePath, ModelFilePath);
            File.Delete(modelRepresentation.SourceFile);
            return modelRepresentation;
        }
        public ResultsRepresentation ClassifyGlycopeptideTandemMS()
        {
            try
            {

                this.Pipeline = new AnalysisPipeline(MS1MatchFilePath,
                    GlycosylationSiteFilePath, MS2DeconvolutionFilePath,
                    modelFilePath: ModelFilePath, outputFilePath: null,
                    proteinProspectorXMLFilePath: ProteinProspectorMSDigestFilePath,
                    ms1MatchingTolerance: ConfigurationManager.Algorithm.MS1MassErrorTolerance,
                    ms2MatchingTolerance: ConfigurationManager.Algorithm.MS2MassErrorTolerance,
                    numProcesses: ConfigurationManager.Algorithm.NumProcesses,
                    numDecoys: ConfigurationManager.Algorithm.NumDecoys,
                    onlyRandomDecoys: ConfigurationManager.Algorithm.OnlyRandomDecoys,
                    pythonInterpreterPath: ConfigurationManager.Scripting.PythonInterpreterPath,
                    rscriptPath: null);

                ResultsRepresentation results = Pipeline.RunClassification();
                File.Delete(results.SourceFile);
                return results;

            }
            catch (TandemGlycoPeptidePipelineException e)
            {
                Console.WriteLine(e.Message);
                MessageBox.Show("An error occurred during classification: " + e.Message, "Error");
                throw;
            }
        }