private void btnOK_Click(object sender, EventArgs e)
{
List<string> csv_filepaths = new List<string>(lstOmssaCsvFiles.Items.Count);
foreach(string csv_filepath in lstOmssaCsvFiles.Items)
{
csv_filepaths.Add(csv_filepath);
}
string raw_folder = txtRawFolder.Text;
List<Modification> fixed_modifications = new List<Modification>(lstSelectedFixedModifications.Items.Count);
foreach(ListViewItem checked_item in lstSelectedFixedModifications.Items)
{
fixed_modifications.Add((Modification)checked_item.Tag);
}
double max_precursor_mass_error = (double)numMaximumPrecursorMassError.Value;
double precursor_mass_error_increment = (double)numPrecursorMassErrorIncrement.Value;
bool higher_scores_are_better = chkHigherScoresAreBetter.Checked;
double max_false_discovery_rate = (double)numMaximumFalseDiscoveryRate.Value;
bool unique = chkUnique.Checked;
bool overall_outputs = chkOverallOutputs.Checked;
bool phosphopeptide_outputs = chkPhosphopeptideOutputs.Checked;
string output_folder = txtOutputFolder.Text;
if(precursor_mass_error_increment > max_precursor_mass_error)
{
MessageBox.Show("Precursor mass error increment (" + precursor_mass_error_increment.ToString() + " ppm) must not be greater than maximum precursor mass error (" + max_precursor_mass_error.ToString() + " ppm)");
return;
}
if(output_folder == null || output_folder == string.Empty)
{
MessageBox.Show("Output folder must be specified");
return;
}
BatchFdrOptimizer batch_fdr_optimizer = new BatchFdrOptimizer(csv_filepaths, raw_folder,
fixed_modifications,
max_precursor_mass_error, precursor_mass_error_increment,
higher_scores_are_better,
max_false_discovery_rate, unique,
overall_outputs, phosphopeptide_outputs, output_folder);
batch_fdr_optimizer.Starting += handleStarting;
batch_fdr_optimizer.StartingFile += handleStartingFile;
batch_fdr_optimizer.UpdateProgress += handleUpdateProgress;
batch_fdr_optimizer.ThrowException += handleThrowException;
batch_fdr_optimizer.FinishedFile += handleFinishedFile;
batch_fdr_optimizer.Finished += handleFinished;
lstOmssaCsvFiles.SelectedItem = null;
prgProgress.Value = prgProgress.Minimum;
Thread thread = new Thread(new ThreadStart(batch_fdr_optimizer.Optimize));
thread.IsBackground = true;
thread.Start();
}