Ejemplo n.º 1
0
        private void cmiLoadPeptideMatrix_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dlg = dlgOpenPeptideMatrix.ShowDialog();
                if (dlg != DialogResult.OK)
                {
                    return;
                }

                string filename = dlgOpenPeptideMatrix.FileName;
                string[,] peptides = FileUtil.ReadPeptideMatrix(filename);
                rowCount           = peptides.GetLength(0);
                colCount           = peptides.GetLength(1);
                SetRowColumnCount();
                UpdateArrayInfo();
                if (peptides != null)
                {
                    PA = new PeptideArray(rowCount, colCount, rowsFirst);
                    PA.SetPeptideMatrix(peptides);
                    peptidelength       = PA.PeptideLength;
                    ePeptideLength.Text = peptidelength.ToString();
                    LoadPeptidesFromPeptideArrayToGrid();
                    peptidesLoaded       = true;
                    quantificationLoaded = false;
                    FillPAValues();
                    Renormalize();
                }
            }
            catch
            {
                MessageBox.Show("There is a problem with loading the peptide matrix file.\r\nPlease make sure the peptide matrix is the only data in the loaded file.\r\n", Application.ProductName);
            }
        }
Ejemplo n.º 2
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
     {
     }
 }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (PA == null)
            {
                return;
            }
            dlgSaveProject.FileName = ProjectName;
            DialogResult dlg = dlgSaveProject.ShowDialog();

            if (dlg != DialogResult.OK)
            {
                return;
            }
            SetText(dlgSaveProject);
            PA.Notes    = eNotes.Text;
            PA.ImageStr = FileUtil.ImageToBase64(imageReference.Image);
            string filename = dlgSaveProject.FileName;

            if (PeptideArray.SaveToFile(filename, PA))
            {
                MessageBox.Show(filename + " is saved", Analyzer.ProgramName);
            }
        }
Ejemplo n.º 4
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult dlg = dlgOpenProject.ShowDialog();
                if (dlg != DialogResult.OK)
                {
                    return;
                }
                SetText(dlgOpenProject);
                string filename = dlgOpenProject.FileName;
                try
                {
                    PA = PeptideArray.ReadFromFile(filename);
                }
                catch
                {
                    MessageBox.Show("The file may be corrupted or not a valid PeSA project file.", Analyzer.ProgramName);
                }
                peptidelength       = PA.PeptideLength;
                ePeptideLength.Text = peptidelength.ToString();
                rowsFirst           = PA.RowsFirst;
                colCount            = PA.ColCount;
                rowCount            = PA.RowCount;
                UpdateArrayInfo();

                eNormalizeBy.Text = PA.NormalizationValue.ToString();

                thresholdEntry.SetInitialValues(PA.GetPositiveThreshold(), PA.GetNegativeThreshold());

                eFreqThreshold.Text = PA.FrequencyThreshold.ToString();
                eAminoAcid.Text     = PA.KeyAA.ToString();
                eKeyPosition.Text   = PA.KeyPosition?.ToString() ?? "";
                SetRowColumnCount();
                if (PA.PeptideMatrix != null)
                {
                    LoadPeptidesFromPeptideArrayToGrid();
                }
                if (PA.QuantificationMatrix != null)
                {
                    LoadQuantificationFromPeptideArrayToGrid();
                }
                if (PA.NormalizedMatrix != null)
                {
                    LoadNormalizedMatrixFromPeptideArrayToGrid();
                }
                bool gridsOK = ColorGrids();
                eNotes.Text          = PA.Notes;
                imageReference.Image = null;
                try
                {
                    Image img = FileUtil.Base64ToImage(PA.ImageStr);
                    imageReference.Image = img;
                }
                catch { }
                if (!gridsOK)
                {
                    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;
        }