/// <summary>
        /// Wrapper class for driving all facets of the analysis pipeline
        /// </summary>
        /// <param name="MS1MatchFilePath"></param>
        /// <param name="glycosylationSiteFilePath"></param>
        /// <param name="MS2DeconFilePath"></param>
        /// <param name="modelFilePath"></param>
        /// <param name="pythonInterpreterPath">
        /// Passed along to the ScriptManager, used to locate the Python Interpreter executable
        /// </param>
        /// <param name="rscriptPath">
        /// Passed along to the ScriptManager, used to locate the Rscript executable
        /// </param>
        /// <param name="scriptsRoot">
        /// Passed along to the ScriptManager, used to locate the script pipeline files
        /// </param>
        public AnalysisPipeline(String MS1MatchFilePath, String glycosylationSiteFilePath,
            String MS2DeconFilePath, String modelFilePath = null,
            String outputFilePath = null, double ms1MatchingTolerance = 1e-5,
            double ms2MatchingTolerance = 2e-5, String proteinProspectorXMLFilePath = null, String method = "full_random_forest",
            String pythonInterpreterPath = null, String rscriptPath = null, 
            String scriptsRoot = null, int numProcesses = 2, bool onlyRandomDecoys = false, 
            int numDecoys = 20)
        {
            this.MS1MatchFilePath = MS1MatchFilePath;
            this.GlycosylationSiteFilePath = glycosylationSiteFilePath;
            this.MS2DeconFilePath = MS2DeconFilePath;
            this.ModelFilePath = modelFilePath;

            this.ResultFilePath = outputFilePath;
            this.ResultsTable = null;
            this.State = TandemGlycoPeptideTaskState.New;

            this.MS1MatchingTolerance = ms1MatchingTolerance;
            this.MS2MatchingTolerance = ms2MatchingTolerance;
            this.Method = method;
            this.ProteinProspectorXMLFilePath = proteinProspectorXMLFilePath;

            this.NumDecoys = numDecoys;
            this.NumProcesses = numProcesses;
            this.OnlyRandomDecoys = onlyRandomDecoys;

            //Make sure that all needed resources can be found
            this.Scripter = new ScriptManager(pythonInterpreterPath, rscriptPath, scriptsRoot);
            Scripter.VerifyFileSystemTargets();
        }
 public void ExecuteScriptManagerHelpCall()
 {
     PythonProcessManager.Verbose = true;
     ScriptManager scripter = new ScriptManager();
     Assert.IsTrue(scripter.VerifyFileSystemTargets());
     Console.WriteLine("Running Dependency Checks");
     scripter.InstallPythonDependencies();
 }
 public void ExecuteScriptManagerRunModelDiagnostics()
 {
     PythonProcessManager.Verbose = true;
     ScriptManager scripter = new ScriptManager();
     Assert.IsTrue(scripter.VerifyFileSystemTargets());
     Console.WriteLine("Running Model Diagnostics");
     String diagnosticOutput = scripter.RunModelDiagnosticTask(ModelJsonFile, "full_random_forest");
     Assert.IsTrue(File.Exists(diagnosticOutput));
 }
 private void CheckPythonDependenciesButton_Click(object sender, EventArgs e)
 {
     ScriptManager scriptingManager = new ScriptManager(ConfigurationManager.Scripting.PythonInterpreterPath);
     try
     {
         scriptingManager.VerifyFileSystemTargets();
         Console.WriteLine("Ping");
         scriptingManager.InstallPythonDependencies();
         Console.WriteLine("Pong");
         ConfigurationManager.Scripting.DependenciesFound = DependencyInstalledState.Yes;
         ConfigurationManager.WriteScriptingSettingsToFile(Application.StartupPath, ConfigurationManager.Scripting);
     }
     catch (Exception ex)
     {
         ConfigurationManager.Scripting.DependenciesFound = DependencyInstalledState.No;
         MessageBox.Show(ex.Message);
     }
     UpdateDependencyIndicator(ConfigurationManager.Scripting.DependenciesFound);
 }
 public void TestModelDiagnostics()
 {
     ScriptManager scripter = new ScriptManager();
     String resultsPlotsPath = scripter.RunModelDiagnosticTask(ModelJsonFile, "full_random_forest");
     Assert.IsTrue(File.Exists(resultsPlotsPath));
 }
        private void CSVExportButton_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "JSON file|*.json";
            DialogResult targetFileDialogResult = openFileDialog1.ShowDialog();
            if (targetFileDialogResult == DialogResult.OK)
            {
                try
                {
                    String targetFilePath = openFileDialog1.FileName;
                    SaveFileDialog fileSaver = new SaveFileDialog();
                    fileSaver.DefaultExt = "csv";
                    fileSaver.Filter = "Comma separated volume|*.csv";
                    fileSaver.FileName = Path.Combine(Path.GetDirectoryName(targetFilePath), Path.GetFileNameWithoutExtension(targetFilePath) + ".csv");
                    DialogResult resultFileDialog = fileSaver.ShowDialog();
                    if (resultFileDialog == DialogResult.OK)
                    {
                        String resultFileName = fileSaver.FileName;
                        ScriptManager scripter = new ScriptManager(ConfigurationManager.Scripting.PythonInterpreterPath);
                        scripter.ConvertToCSV(targetFilePath, resultFileName);
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show("An error occurred while processing this task: " + ex.Message);
                    WaitScreen.Close();
                }
            }
        }
        static void TestScriptingInstallDependencies()
        {
            Console.WriteLine("Test Scripting Install Dependencies");
            ScriptManager scripter = new ScriptManager(rscriptExecutablePath: Properties.Resources.DevelRscriptPath);

            Console.WriteLine(scripter);

            scripter.VerifyFileSystemTargets();

            scripter.InstallRDependencies();
            Console.WriteLine(scripter.LastCall.GenerateDumpMessage());
        }