Example #1
0
        public void Run()
        {
            logTB.Clear();
            logTB.BackColor = Color.White;

            string rawFileDirectory = textBox3.Text;
            string inputcsvfile = textBox1.Text;
            if (!File.Exists(inputcsvfile))
            {
                UpdateLog("Cannot open input csvfile: " + inputcsvfile + ", aborting!");
                return;
            }
            string outputDirectory = textBox2.Text;
            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                UpdateLog("Must provide a valid output folder!");
                return;
            }
            if (!Directory.Exists(outputDirectory))
            {
                UpdateLog("Output directory " + outputDirectory + " doesn't exist, creating it...");
                Directory.CreateDirectory(outputDirectory);
            }

            List<Modification> fixedModifications = listBox2.Items.OfType<Modification>().ToList();
            List<Modification> quantifiedModifications = new List<Modification>();

            List<string> modNames = checkedListBox1.CheckedItems.OfType<string>().ToList();
            if (modNames.Count > 0)
            {
                foreach (string modName in modNames)
                {
                    if (modName == Phosphorylation.Name)
                    {
                        quantifiedModifications.Add(Phosphorylation);
                    }
                    else
                    {
                        OmssaModification mod;
                        if (!OmssaModification.TryGetModification(modName, out mod))
                        {
                            UpdateLog("Unable to load mod " + modName + ". Did you load the correct modification file?");
                            return;
                        }
                        quantifiedModifications.Add(mod);
                    }
                }
            }
            else
            {
                UpdateLog("No modifications were selected to be quantified, please select mods from the list or one of the default options");
                return;
            }

            //double ascoreThreshold = (double)numericUpDown2.Value;
            double prodThreshold = (double)numericUpDown3.Value / 100.0;
            bool separateGroups = checkBox3.Enabled && checkBox3.Checked;
            bool ignoreCTerminal = checkBox2.Checked;
            bool reduceSites = checkBox1.Checked;
            int scoreCutoff = (int)numericUpDown2.Value;
            bool phosphoNeutralLoss = phosphoNeutralLossCB.Checked && quantifiedModifications.Contains(Phosphorylation);

            Tolerance prodTolerance = GetProductTolerance();
            _lotor = new Lotor(rawFileDirectory, inputcsvfile, outputDirectory, fixedModifications,
                quantifiedModifications, prodTolerance, scoreCutoff, separateGroups, prodThreshold, ignoreCTerminal, reduceSites,
                FragmentTypes.b | FragmentTypes.y, phosphoNeutralLoss);
            _lotor.UpdateLog += lotor_UpdateLog;
            _lotor.UpdateProgress += lotor_UpdateProgress;
            _lotor.Completed += _lotor_Completed;
            localizeB.Enabled = false;
            _mainThread = new Thread(_lotor.Localize);
            _mainThread.IsBackground = true;
            _mainThread.Start();
        }
Example #2
0
        public void Run()
        {
            logTB.Clear();
            logTB.BackColor = Color.White;

            string rawFileDirectory = textBox3.Text;
            string inputcsvfile     = textBox1.Text;

            if (!File.Exists(inputcsvfile))
            {
                UpdateLog("Cannot open input csvfile: " + inputcsvfile + ", aborting!");
                return;
            }
            string outputDirectory = textBox2.Text;

            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                UpdateLog("Must provide a valid output folder!");
                return;
            }
            if (!Directory.Exists(outputDirectory))
            {
                UpdateLog("Output directory " + outputDirectory + " doesn't exist, creating it...");
                Directory.CreateDirectory(outputDirectory);
            }

            List <Modification> fixedModifications      = listBox2.Items.OfType <Modification>().ToList();
            List <Modification> quantifiedModifications = new List <Modification>();

            List <string> modNames = checkedListBox1.CheckedItems.OfType <string>().ToList();

            if (modNames.Count > 0)
            {
                foreach (string modName in modNames)
                {
                    if (modName == Phosphorylation.Name)
                    {
                        quantifiedModifications.Add(Phosphorylation);
                    }
                    else
                    {
                        OmssaModification mod;
                        if (!OmssaModification.TryGetModification(modName, out mod))
                        {
                            UpdateLog("Unable to load mod " + modName + ". Did you load the correct modification file?");
                            return;
                        }
                        quantifiedModifications.Add(mod);
                    }
                }
            }
            else
            {
                UpdateLog("No modifications were selected to be quantified, please select mods from the list or one of the default options");
                return;
            }

            //double ascoreThreshold = (double)numericUpDown2.Value;
            double prodThreshold      = (double)numericUpDown3.Value / 100.0;
            bool   separateGroups     = checkBox3.Enabled && checkBox3.Checked;
            bool   ignoreCTerminal    = checkBox2.Checked;
            bool   reduceSites        = checkBox1.Checked;
            int    scoreCutoff        = (int)numericUpDown2.Value;
            bool   phosphoNeutralLoss = phosphoNeutralLossCB.Checked && quantifiedModifications.Contains(Phosphorylation);

            Tolerance prodTolerance = GetProductTolerance();

            _lotor = new Lotor(rawFileDirectory, inputcsvfile, outputDirectory, fixedModifications,
                               quantifiedModifications, prodTolerance, scoreCutoff, separateGroups, prodThreshold, ignoreCTerminal, reduceSites,
                               FragmentTypes.b | FragmentTypes.y, phosphoNeutralLoss);
            _lotor.UpdateLog        += lotor_UpdateLog;
            _lotor.UpdateProgress   += lotor_UpdateProgress;
            _lotor.Completed        += _lotor_Completed;
            localizeB.Enabled        = false;
            _mainThread              = new Thread(_lotor.Localize);
            _mainThread.IsBackground = true;
            _mainThread.Start();
        }