private void TETRAtoCSV_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.InitialDirectory = Project.folderFullPath; saveFileDialog1.FileName = Project.projectName + "_TETRA"; saveFileDialog1.Filter = "table (.csv)|*.csv"; saveFileDialog1.FilterIndex = 2; if (saveFileDialog1.ShowDialog() == true) { if (TETRA.GenerateCSVTETRA(saveFileDialog1.FileName) == true) { MainWindow.main.lblStatus.Content = "Table generated to: " + System.IO.Path.GetFileName(saveFileDialog1.FileName); } else { MainWindow.main.lblStatus.Content = "Failed (No results?)."; } } }
private void btnCompute_Click(object sender, RoutedEventArgs e) { btnCancel.IsEnabled = false; btnCompute.IsEnabled = false; lbSelection.IsEnabled = false; Status = "Calculation in progress, please wait"; foreach (var pair in uniqueFastaPairs) { if (pair.ANIB == true) { anib.Add(new Project.ItemsSelectedToCompute() { FullPath = pair.FullPath, FullPathB = pair.FullPathB, Title = pair.Title }); } if (pair.TETRA == true) { tetra.Add(new Project.ItemsSelectedToCompute() { FullPath = pair.FullPath, FullPathB = pair.FullPathB, Title = pair.Title } ); } } int tetrasToComp = tetra.Count; int anibToComp = anib.Count; int errorsANI = 0; bool successTETRA = false; if (tetrasToComp > 0) { successTETRA = TETRA.computeTetra(tetra); if (successTETRA == true) { string inf = "Tetranucleotide calculation successful. No errors."; MessageBox.Show(inf, "Success", MessageBoxButton.OK, MessageBoxImage.Information); Status = inf; MainWindow.main.Status = inf; MainWindow.main.EnableMatrixC(); } else { string error = "Tetranucleotide calculation failed for one or more pairs."; MessageBox.Show(error, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); lblStatusANIT.Content = error; MainWindow.main.lblStatus.Content = error; Project.ErrorLog.Add(error); } } if (anibToComp > 0) { string dir = Project.folderFullPath + "\\temp\\ani"; if (Directory.Exists(dir)) { Directory.Delete(dir, true); } Directory.CreateDirectory(dir); errorsANI = ANI.computeANIb(anib); if (errorsANI == 0) { string inf = "ANIb calculation successful. No errors."; MessageBox.Show(inf, "Success", MessageBoxButton.OK, MessageBoxImage.Information); Status = inf; MainWindow.main.Status = inf; MainWindow.main.EnableMatrixC(); } else if (errorsANI == 1) { string inf = " All pairs have already been processed and their ANIb results are available."; MessageBox.Show(inf, "Success", MessageBoxButton.OK, MessageBoxImage.Information); Status = inf; MainWindow.main.Status = inf; MainWindow.main.EnableMatrixC(); } else if (errorsANI == 2) { string inf = "ANIb calculation finished with errors.Missing files and respective pairs have been removed from the project.For more informations check logs."; MessageBox.Show(inf, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); Status = inf; MainWindow.main.Status = inf; MainWindow.main.EnableMatrixC(); } else if (errorsANI == 3) { string error = "ANIb calculation failed for all selected pairs. Missing files and respective pairs have been removed from the project. For more informations check logs."; MessageBox.Show(error, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); Status = error; MainWindow.main.Status = error; Project.ErrorLog.Add(error); } } this.Close(); }