private void thresholdEntry_ThresholdChanged(object sender, EventArgs e)
 {
     if (PA == null)
     {
         return;
     }
     PA.SetPositiveThreshold(thresholdEntry.PositiveThreshold, out bool negChanged);
     PA.SetNegativeThreshold(thresholdEntry.NegativeThreshold, out bool posChanged2);
     ColorGrids();
     mdMatrix.SetThreshold(PA.PositiveThreshold, PA.NegativeThreshold);
 }
        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() ?? "";
                }
            }

            bool xPossible = true, yPossible = true;

            PermutationArray.CheckPermutationAxis(values, ref xPossible, ref yPossible);
            if (xPossible && !yPossible)
            {
                cbWildTypeXAxis.Checked = false;
            }
            else if (yPossible && !xPossible)
            {
                cbWildTypeXAxis.Checked = true;
            }
            else if (!xPossible && !yPossible)
            {
                MessageBox.Show("Please make sure one the axes have permutation array (each amino acid has to exist at most once)", Analyzer.ProgramName);
                return;
            }
            ;
            PA = new PermutationArray(values, !cbWildTypeXAxis.Checked, cbYAxisTopToBottom.Checked, out List <string> warnings, out string error);
            if (error != "")
            {
                MessageBox.Show(error, Analyzer.ProgramName);
                return;
            }
            if (warnings.Count > 0)
            {
                warnings.Insert(0, "Warning:");
                MessageBox.Show(String.Join("\r\n", warnings), Analyzer.ProgramName);
            }
            PA.SetPositiveThreshold(thresholdEntry.PositiveThreshold, out bool negChanged);
            PA.SetNegativeThreshold(thresholdEntry.NegativeThreshold, out bool posChanged2);
            LoadPeptidesFromPermutationArrayToGrid();
            LoadNormalizedMatrixFromPeptideArrayToGrid();

            dgPeptides.Rows[0].DefaultCellStyle      = dgPeptides.ColumnHeadersDefaultCellStyle;
            dgPeptides.Columns[0].DefaultCellStyle   = dgPeptides.ColumnHeadersDefaultCellStyle;
            dgNormalized.Rows[0].DefaultCellStyle    = dgPeptides.ColumnHeadersDefaultCellStyle;
            dgNormalized.Columns[0].DefaultCellStyle = dgPeptides.ColumnHeadersDefaultCellStyle;
            ColorGrids();
            DrawColorMatrix();
        }