private void linkLoadFromFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { DialogResult dlg = dlgOpenQuantification.ShowDialog(); if (dlg != DialogResult.OK) { return; } SetText(dlgOpenProject); string filename = dlgOpenQuantification.FileName; if (System.IO.File.Exists(filename)) { OA = FileUtil.ReadOPALArrayQuantificationData(filename); thresholdEntry.SetInitialValues(OA.GetPositiveThreshold(), OA.GetNegativeThreshold()); cbPermutationXAxis.Checked = PermutationXAxis; cbYAxisTopToBottom.Checked = OA.PositionYAxisTopToBottom; if (OA.QuantificationMatrix != null) { LoadQuantificationFromOPALArrayToGrid(); } GridUtil.LoadNumericMatrixToGrid(dgNormalized, OA.NormalizedMatrix, 1, 1); FillGridHeaders(dgNormalized); Run(); ColorGridsandDrawMotifs(); } } catch { MessageBox.Show("There is a problem with loading the quantification file.\r\nPlease make sure the quantification data is the only data in the loaded file.\r\n", Application.ProductName); } }
private void LoadProject() { try { DialogResult dlg = dlgOpenProject.ShowDialog(); if (dlg != DialogResult.OK) { return; } SetText(dlgOpenProject); string filename = dlgOpenProject.FileName; try { OA = OPALArray.ReadFromFile(filename); } catch { MessageBox.Show("The file may be corrupted or not a valid PeSA project file.", Analyzer.ProgramName); } thresholdEntry.SetInitialValues(OA.GetPositiveThreshold(), OA.GetNegativeThreshold()); rbMaxValue.Checked = OA.NormMode == NormalizationMode.Max; rbPerRowColumn.Checked = OA.NormMode != NormalizationMode.Max; cbPermutationXAxis.Checked = PermutationXAxis; cbYAxisTopToBottom.Checked = OA.PositionYAxisTopToBottom; if (OA.QuantificationMatrix != null) { LoadQuantificationFromOPALArrayToGrid(); } GridUtil.LoadNumericMatrixToGrid(dgNormalized, OA.NormalizedMatrix, 1, 1); FillGridHeaders(dgNormalized); bool gridOK = ColorGridsandDrawMotifs();//also creates/draws the motif eNotes.Text = OA.Notes; imageReference.Image = null; try { Image img = FileUtil.Base64ToImage(OA.ImageStr); imageReference.Image = img; } catch { } DrawColorMatrix(); if (!gridOK) { MessageBox.Show("There is a problem in loading the file. It is highly recommended to re-run the analysis.", Analyzer.ProgramName); } } catch { MessageBox.Show("There is a problem in loading the file. It is highly recommended to re-run the analysis.", Analyzer.ProgramName); } linkRun.Visible = true; }
private void Run() { string[,] values = new string[dgQuantification.RowCount, dgQuantification.ColumnCount]; for (int iRow = 0; iRow < dgQuantification.RowCount; iRow++) { for (int iCol = 0; iCol < dgQuantification.ColumnCount; iCol++) { values[iRow, iCol] = dgQuantification[iCol, iRow].Value?.ToString() ?? ""; } } string error = ""; bool xPossible = true, yPossible = true; OPALArray.CheckPermutationAxis(values, ref xPossible, ref yPossible); if (xPossible && yPossible) { PermutationXAxis = cbPermutationXAxis.Checked; } else if (xPossible) { PermutationXAxis = true; cbPermutationXAxis.Checked = true; } else if (yPossible) { PermutationXAxis = false; cbPermutationXAxis.Checked = false; } if (!xPossible && !yPossible) { MessageBox.Show("Please make sure one the axes have OPAL array (each amino acid has to exist at most once)", Analyzer.ProgramName); return; } ; OA = new OPALArray(values, PermutationXAxis, cbYAxisTopToBottom.Checked, out error); OA.SetPositiveThreshold(thresholdEntry.PositiveThreshold, out bool negChanged); OA.SetNegativeThreshold(thresholdEntry.NegativeThreshold, out bool posChanged2); if (error != "") { MessageBox.Show(error, Analyzer.ProgramName); return; } GridUtil.LoadNumericMatrixToGrid(dgNormalized, OA.NormalizedMatrix, 1, 1); FillGridHeaders(dgNormalized); ColorGridsandDrawMotifs(); DrawColorMatrix(); }
private void btnSave_Click(object sender, EventArgs e) { dlgSaveProject.FileName = ProjectName; DialogResult dlg = dlgSaveProject.ShowDialog(); if (dlg != DialogResult.OK) { return; } SetText(dlgSaveProject); OA.Notes = eNotes.Text; OA.ImageStr = FileUtil.ImageToBase64(imageReference.Image); string filename = dlgSaveProject.FileName; if (OPALArray.SaveToFile(filename, OA)) { MessageBox.Show(filename + " is saved", Analyzer.ProgramName); } }
private void btnLoadQuantification_Click(object sender, EventArgs e) { try { DialogResult dlg = dlgOpenQuantification.ShowDialog(); if (dlg != DialogResult.OK) { return; } SetText(dlgOpenQuantification); string filename = dlgOpenQuantification.FileName; if (System.IO.File.Exists(filename)) { OA = FileUtil.ReadOPALArrayQuantificationData(filename); LoadQuantificationFromOPALArrayToGrid(); } } catch { MessageBox.Show("There is a problem with loading the quantification file.\r\nPlease make sure the quantification data is the only data in the loaded file.\r\n", Application.ProductName); } }