public static void Run(Samples samples, DBOptions options) { //PeptidAce.Utilities.Methods.UptimizeOptions upper = new Utilities.Methods.UptimizeOptions(options, samples); //upper.Run(); Ace ace = new Ace(options, samples); ace.Preload(false, false); ace.PrepareQueries(); bool keepUptimizing = true; int bestCount = 0; while (keepUptimizing) { try { foreach (Query query in ace.AllQueries) { query.psms.Clear(); query.precursor.psms_AllPossibilities.Clear(); if (query.precursor.psms != null) { query.precursor.psms.Clear(); } } Result rez = ace.LaunchSearch(ace.AllQueries); int nbCorrectMatches = 0; int nbTarget = 0; foreach (Query query in rez.queries) { if (query.psms.Count > 0) { if (query.Target) { nbTarget++; if (query.psms[0].Peptide.Sequence.CompareTo(query.sample.nameColumn) == 0) { nbCorrectMatches++; } } } } options.ConSole.WriteLine("NbCorrectMatches : " + nbCorrectMatches + " (" + nbTarget + " targets)");//332 if (nbCorrectMatches > bestCount) { bestCount = nbCorrectMatches; options.Save(options.OutputFolder + "Options_" + bestCount + ".csv"); } options.RandomizeParams(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } options.Save(options.OutputFolder + "UptimizedOptions.csv"); //*/ }