示例#1
0
        private void ProgressForm_Load(object sender, EventArgs e)
        {
            var boxShown = false;

            foreach (var item in _filesToProcess)
            {
                var info = new JobInfo();

                var textBox = new TextBox
                {
                    Text =
                        string.Format("{0}{1}{2}{1}Starting...{1}", item, Environment.NewLine,
                                      new string('-', 30)),
                    Dock       = DockStyle.Fill,
                    Multiline  = true,
                    Tag        = info,
                    ScrollBars = ScrollBars.Vertical
                };

                if (boxShown)
                {
                    textBox.Visible = false;
                }
                else
                {
                    textBox.Visible = true;
                    boxShown        = true;
                }

                ProgressSplit.Panel2.Controls.Add(textBox);
                info.updateTextbox = textBox;

                JobDataView.Rows.Add(item, 0);
                var row = JobDataView.Rows[JobDataView.Rows.Count - 1];
                row.Tag       = info;
                info.rowShown = row;

                var runProgram = new MainLogic(info)
                {
                    PercentageUpdate = UpdatePercentage,
                    LogUpdate        = UpdateLog,
                    StatusUpdate     = UpdateBarStatus
                };
                _tasksRunningList.Add(runProgram);
                info.workProcess = runProgram;

                string workItem = item;
                if (MainForm.IsNetworkSource(item))
                {
                    workItem = _unifiCredentialsByUrl[item].GetUrlWithAuthentication(item);
                }

                var config = runProgram.ParseCommandLine(_outputFolder, (workItem + "|" + _options).Trim('|'));
                runProgram.QueueWork(config);
            }

            MainLogic.RunQueue();
        }
示例#2
0
 private void ProgressForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     lock (_cancelMutex)
     {
         MainLogic.ClearQueue();
         foreach (var item in _tasksRunningList)
         {
             item.ForceExit();
         }
     }
 }
示例#3
0
        public static void Work()
        {
            while (true)
            {
                KeyValuePair <MainLogic, Config> item;
                lock (_workQueue)
                {
                    if (!_workQueue.Any())
                    {
                        return;
                    }
                    item = _workQueue.Dequeue();
                }

                MainLogic logic            = item.Key;
                Config    config           = item.Value;
                var       LogUpdate        = logic.LogUpdate;
                var       StatusUpdate     = logic.StatusUpdate;
                var       PercentageUpdate = logic.PercentageUpdate;
                var       _info            = logic._info;

                try
                {
                    var result = logic.Go(config) == 0 ? 100 : -99;

                    if (result == 100)
                    {
                        if (LogUpdate != null)
                        {
                            LogUpdate("Finished.", _info);
                        }
                        if (StatusUpdate != null)
                        {
                            StatusUpdate("Finished", ProgressBarStyle.Continuous, _info);
                        }
                        if (PercentageUpdate != null)
                        {
                            PercentageUpdate(100, 100, _info);
                        }
                    }
                    else
                    {
                        if (LogUpdate != null)
                        {
                            LogUpdate("Failed - " + logic._errorMessage, _info);
                        }
                        if (StatusUpdate != null)
                        {
                            StatusUpdate("Failed", ProgressBarStyle.Continuous, _info);
                        }
                        if (PercentageUpdate != null)
                        {
                            PercentageUpdate(-99, 100, _info);
                        }
                    }
                }
                catch (Exception e)
                {
                    try
                    {
                        if (LogUpdate != null)
                        {
                            LogUpdate("Failed - " + e, _info);
                        }
                        if (StatusUpdate != null)
                        {
                            StatusUpdate("Failed", ProgressBarStyle.Continuous, _info);
                        }
                        if (PercentageUpdate != null)
                        {
                            PercentageUpdate(-99, 100, _info);
                        }
                    }
                    catch (Exception)
                    {
                        //probably nothing left to report to
                    }
                }
            }
        }
示例#4
0
        private void ProgressForm_Load(object sender, EventArgs e)
        {
            var boxShown = false;

            foreach (var item in _filesToProcess)
            {
                var info = new JobInfo();

                var textBox = new TextBox
                                  {
                                      Text =
                                          string.Format("{0}{1}{2}{1}Starting...{1}", item, Environment.NewLine,
                                                        new string('-', 30)),
                                      Dock = DockStyle.Fill,
                                      Multiline = true,
                                      Tag = info,
                                      ScrollBars = ScrollBars.Vertical
                                  };

                if (boxShown)
                    textBox.Visible = false;
                else
                {
                    textBox.Visible = true;
                    boxShown = true;
                }

                ProgressSplit.Panel2.Controls.Add(textBox);
                info.updateTextbox = textBox;

                JobDataView.Rows.Add(item, 0);
                var row = JobDataView.Rows[JobDataView.Rows.Count - 1];
                row.Tag = info;
                info.rowShown = row;

                var runProgram = new MainLogic(info)
                                     {
                                         PercentageUpdate = UpdatePercentage,
                                         LogUpdate = UpdateLog,
                                         StatusUpdate = UpdateBarStatus
                                     };
                _tasksRunningList.Add(runProgram);
                info.workProcess = runProgram;

                var config = runProgram.ParseCommandLine(_outputFolder, (item + "|" + _options).Trim('|'));
                runProgram.QueueWork(config);
            }

            MainLogic.RunQueue();
        }
示例#5
0
 public void FilterSubsetTest ()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths.Where(o => o.EndsWith(".mzML")),
                             logicAccessor,
                             new string[] { "--filter|\"scanNumber 1-50\"", "--filter|\"scanTime [1.2,4.2]\"", "--filter|\"mzWindow [400,800]\"" },
                             "mzML");
     CompareFiles(extension);
 }
示例#6
0
 public void FilterETDFilterTest ()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths.Where(o => o.EndsWith(".mzML")),
                             logicAccessor,
                             new string[] { "--filter|\"msLevel 2-\"", "--filter|\"activation ETD\"", "--filter|\"ETDFilter true true true false 3.1 mz\"" },
                             "mzML");
     CompareFiles(extension);
 }
示例#7
0
 public void FilterActivationTest ()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths,
                             logicAccessor,
                             new string[] { "--filter|\"activation ETD\"" },
                             "mzML");
     CompareFiles(extension);
 }
示例#8
0
 public void FilterZeroSamplesTest()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths,
                             logicAccessor,
                             new string[] { "--filter|\"zeroSamples removeExtra 1-3\"", "--filter|\"msLevel 1\"" },
                             "mzML");
     CompareFiles(extension);
 }
示例#9
0
 public void FilterPeakPickingTest ()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths,
                             logicAccessor,
                             new string[] { "--filter|\"peakPicking true 1\"", "--filter|\"msLevel 1\"" },
                             "mzML");
     CompareFiles(extension);
 }
示例#10
0
 public void Vendor_To_MzML_Test ()
 {
     var logicAccessor = new MainLogic(new ProgressForm.JobInfo());
     var extension = RunFile(_testPaths.Where(o => !o.EndsWith(".mzML")),
                             logicAccessor,
                             new string[] { },
                             "mzML");
     CompareFiles(extension);
 }
示例#11
0
        private string RunFile(IEnumerable<string> testPaths, MainLogic logicAccessor, string[] extraArgs, string extension)
        {
            foreach (string filepath in testPaths)
            {
                var outputDirectory = Path.GetFileName(filepath);
                if (!Directory.Exists(outputDirectory))
                    Directory.CreateDirectory(outputDirectory);

                string[] runIds = ReaderList.FullReaderList.readIds(filepath);

                var psi = new ProcessStartInfo(Path.Combine(_workingDirectory, "msconvert.exe"))
                              {
                                  Arguments = String.Format("{0} --64 --outdir \"{1}\" \"{2}\"",
                                                            String.Join(" ", extraArgs).Replace('|', ' '),
                                                            outputDirectory,
                                                            filepath),
                                  UseShellExecute = false,
                                  CreateNoWindow = true
                              };
                var proc = new Process { StartInfo = psi };

                // start console conversion
                proc.Start();
                proc.WaitForExit();

                foreach (string runId in runIds)
                {
                    var outputFilepath = Directory.GetFiles(outputDirectory, "*" + runId + "." + extension).First();
                    var consoleOutput = Path.ChangeExtension(outputFilepath, ".console." + extension);
                    Assert.IsTrue(File.Exists(outputFilepath), "Console result file not found");
                    File.Move(outputFilepath, consoleOutput);
                }

                // start GUI conversion
                var config = logicAccessor.ParseCommandLine(outputDirectory, String.Format("{0}|{1}", String.Join("|", extraArgs).Replace("\"", String.Empty), filepath).Trim('|'));
                logicAccessor.QueueWork(config);
                MainLogic.Work();

                foreach (string runId in runIds)
                {
                    var outputFilepath = Directory.GetFiles(outputDirectory, "*" + runId + "." + extension).First();
                    var guiOutput = Path.ChangeExtension(outputFilepath, ".gui." + extension);
                    Assert.IsTrue(File.Exists(outputFilepath), "GUI result file not found");
                    File.Move(outputFilepath, guiOutput);
                }
            }

            return extension;
        }