Example #1
0
        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);
            }
        }
Example #2
0
 private void frmOPALArray_Load(object sender, EventArgs e)
 {
     thresholdEntry.SetInitialValues(0.5, 0.5);
     ResetSettings();
     GridUtil.FormatGrid(dgQuantification);
     GridUtil.FormatGrid(dgNormalized);
 }
 private void LoadQuantificationFromPermutationArrayToGrid()
 {
     GridUtil.LoadNumericMatrixToGrid(dgQuantification, PA.QuantificationMatrix, 1, 1);
     cbWildTypeXAxis.Checked = !PA.PermutationXAxis;
     FillGridHeaders(dgQuantification);
     quantificationLoaded = true;
 }
Example #4
0
 private void LoadQuantificationFromOPALArrayToGrid()
 {
     GridUtil.LoadNumericMatrixToGrid(dgQuantification, OA.QuantificationMatrix, 1, 1);
     PermutationXAxis = cbPermutationXAxis.Checked = OA.PermutationXAxis;
     FillGridHeaders(dgQuantification);
     quantificationLoaded = true;
 }
Example #5
0
 private void cmiPaste_Click(object sender, EventArgs e)
 {
     GridUtil.PasteClipboard(dgQuantification);
     quantificationLoaded = true;
     ResetSettings();
     Run();
 }
Example #6
0
 private void cmiPastePeptide_Click(object sender, EventArgs e)
 {
     try
     {
         string[,] matrix = MatrixUtil.ClipboardToMatrix();
         matrix           = MatrixUtil.StripHeaderRowColumns(matrix, false);
         rowCount         = matrix.GetLength(0);
         colCount         = matrix.GetLength(1);
         PA = new PeptideArray(rowCount, colCount, rowsFirst);
         PA.SetPeptideMatrix(matrix);
         peptidelength             = PA.PeptideLength;
         ePeptideLength.Text       = peptidelength.ToString();
         dgQuantification.RowCount = dgQuantification.ColumnCount = 0;
         dgNormalized.RowCount     = dgNormalized.ColumnCount = 0;
         SetRowColumnCount();
         GridUtil.LoadStringMatrixToGrid(dgPeptides, matrix);
         peptidesLoaded       = true;
         quantificationLoaded = false;
         FillPAValues();
         ClearMotifs();
     }
     catch
     {
     }
 }
Example #7
0
 private void cmiPasteQuantification_Click(object sender, EventArgs e)
 {
     try
     {
         if (PA == null)
         {
             MessageBox.Show("The peptide array needs to be loaded before the quantification array.", Analyzer.ProgramName);
             return;
         }
         string[,] matrix = MatrixUtil.ClipboardToMatrix();
         matrix           = MatrixUtil.StripHeaderRowColumns(matrix, true);
         if (matrix == null || rowCount != matrix.GetLength(0) || colCount != matrix.GetLength(1))
         {
             MessageBox.Show("The dimensions of the quantification data does not match the peptide matrix.", Analyzer.ProgramName);
             return;
         }
         double[,] dMatrix = MatrixUtil.ConvertToNumericMatrix(matrix);
         PA.SetQuantificationMatrix(matrix, false);
         GridUtil.LoadNumericMatrixToGrid(dgQuantification, dMatrix);
         PA.NormalizationValue = MatrixUtil.GetMaxValue(dMatrix);
         eNormalizeBy.Text     = PA.NormalizationValue.ToString();
         quantificationLoaded  = true;
         Renormalize();
     }
     catch
     {
     }
 }
Example #8
0
 private void frmPeptideArray_Load(object sender, EventArgs e)
 {
     ResetSettings();
     UpdateArrayInfo();
     GridUtil.FormatGrid(dgPeptides);
     GridUtil.FormatGrid(dgQuantification);
     GridUtil.FormatGrid(dgNormalized);
 }
 private void cmiPaste_Click(object sender, EventArgs e)
 {
     GridUtil.PasteClipboard(dgQuantification);
     quantificationLoaded  = true;
     dgPeptides.RowCount   = dgPeptides.ColumnCount = 0;
     dgNormalized.RowCount = dgNormalized.ColumnCount = 0;
     ResetSettings();
     Run();
 }
Example #10
0
        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;
        }
Example #11
0
 private void rbPerRowColumn_CheckedChanged(object sender, EventArgs e)
 {
     if (!rbMaxValue.Focused && !rbPerRowColumn.Focused)
     {
         return;
     }
     if (rbPerRowColumn.Checked && OA != null)
     {
         OA.NormMode = NormalizationMode.PerRowColumn;
         OA.Renormalize();
         GridUtil.LoadNumericMatrixToGrid(dgNormalized, OA.NormalizedMatrix, 1, 1);
         ColorGridsandDrawMotifs();
         DrawColorMatrix();
     }
 }
Example #12
0
        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 LoadPeptidesFromPermutationArrayToGrid()
 {
     GridUtil.LoadStringMatrixToGrid(dgPeptides, PA.PeptideMatrix, 1, 1);
     FillGridHeaders(dgPeptides);
 }
 private void LoadNormalizedMatrixFromPeptideArrayToGrid()
 {
     GridUtil.LoadNumericMatrixToGrid(dgNormalized, PA.NormalizedMatrix, 1, 1);
     FillGridHeaders(dgNormalized);
 }
Example #15
0
 public frmAnalyzePeptideArray()
 {
     InitializeComponent();
     dgPeptideHelper = new GridUtil(dgPeptides);
 }
Example #16
0
 private void LoadPeptidesFromPeptideArrayToGrid()
 {
     GridUtil.LoadStringMatrixToGrid(dgPeptides, PA.PeptideMatrix);
     peptidesLoaded = true;
 }
Example #17
0
 private void LoadQuantificationFromPeptideArrayToGrid()
 {
     GridUtil.LoadNumericMatrixToGrid(dgQuantification, PA.QuantificationMatrix);
     quantificationLoaded = true;
 }