Ejemplo n.º 1
0
        public SpectrumLibraryInfoDlg(LibraryDetails libraryDetails)
        {
            InitializeComponent();

            Icon = Resources.Skyline;

            cutoffScoreCol.DefaultCellStyle.NullValue = TextUtil.EXCEL_NA;
            scoreTypeCol.DefaultCellStyle.NullValue   = TextUtil.EXCEL_NA;

            // library details
            SetDetailsText(libraryDetails);

            // links to library source(s)
            SetLibraryLinks(libraryDetails);

            // Data grid view
            var dataGridViewHeight = 0;

            if (libraryDetails.DataFiles.Any())
            {
                PopulateScoreGrid(libraryDetails);

                const int maxDisplayRows = 10;
                dataGridViewHeight = Math.Min(libraryGridView.Rows.Count, maxDisplayRows) * libraryGridView.Rows[0].Height +
                                     libraryGridView.ColumnHeadersHeight + libraryGridView.Rows[0].Height / 2;
            }
            else
            {
                libraryGridView.Hide();
            }
            var _height = labelLibInfo.Height + linkSpecLibLinks.Height + dataGridViewHeight + btnOk.Height + 70;

            Height = _height;
        }
Ejemplo n.º 2
0
        private void SetDataFileList(LibraryDetails libraryDetails)
        {
            if(!libraryDetails.DataFiles.Any())
                return;

            var fileList = new StringBuilder();
            foreach (var filename in libraryDetails.DataFiles)
            {
                fileList.AppendLine(Path.GetFileName(filename));
            }
            textBoxDataFiles.Text = fileList.ToString();
        }
Ejemplo n.º 3
0
        private void SetDataFileList(LibraryDetails libraryDetails)
        {
            if (!libraryDetails.DataFiles.Any())
            {
                return;
            }

            var fileList = new StringBuilder();

            foreach (var filename in libraryDetails.DataFiles)
            {
                fileList.AppendLine(Path.GetFileName(filename));
            }
            textBoxDataFiles.Text = fileList.ToString();
        }
Ejemplo n.º 4
0
        private void SetLibraryLinks(LibraryDetails libraryDetails)
        {
            linkSpecLibLinks.Text = string.Empty;

            if (libraryDetails.LibLinks.Any())
            {
                string labelStr = libraryDetails.LibLinks.Count() == 1
                                      ? Resources.SpectrumLibraryInfoDlg_SetLibraryLinks_Library_source
                                      : Resources.SpectrumLibraryInfoDlg_SetLibraryLinks_Library_sources;

                foreach (LibraryLink link in libraryDetails.LibLinks)
                {
                    labelStr += TextUtil.SEPARATOR_SPACE;
                    linkSpecLibLinks.Links.Add(labelStr.Length, link.Name.Length, link.Link);
                    labelStr += link.Name + "  "; // Not L10N
                }

                linkSpecLibLinks.Text = labelStr;
            }
        }
Ejemplo n.º 5
0
 private void PopulateScoreGrid(LibraryDetails libraryDetails)
 {
     // Populates DataGridView with files and their given scores
     foreach (var file in libraryDetails.DataFiles)
     {
         var fileName      = Path.GetFileName(file.FilePath);
         var spectrumCount = file.BestSpectrum;
         var matchedCount  = file.MatchedSpectrum;
         if (file.CutoffScores.Any())
         {
             foreach (var cuttoffScore in file.CutoffScores)
             {
                 libraryGridView.Rows.Add(fileName, cuttoffScore.Key, cuttoffScore.Value, matchedCount, spectrumCount);
             }
         }
         else
         {
             libraryGridView.Rows.Add(fileName, null, null, matchedCount, spectrumCount);
         }
     }
 }
Ejemplo n.º 6
0
        private void SetDetailsText(LibraryDetails libraryDetails)
        {
            const string numFormat = "#,0"; // Not L10N

            var detailsText = new StringBuilder();

            detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText__0__library, libraryDetails.Format));
            if (!string.IsNullOrEmpty(libraryDetails.Id))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_ID__0__, libraryDetails.Id));
            }
            if (!string.IsNullOrEmpty(libraryDetails.Revision))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Revision__0__, libraryDetails.Revision));
            }
            if (!string.IsNullOrEmpty(libraryDetails.Version))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Version__0__, libraryDetails.Version));
            }
            if (libraryDetails.UniquePeptideCount > 0)
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Unique_peptides__0__, libraryDetails.UniquePeptideCount.ToString(numFormat)));
            }
            detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Unique_Precursors___0_,
                                                 libraryDetails.SpectrumCount.ToString(numFormat)));

            if (libraryDetails.TotalPsmCount > 0)
            {
                detailsText.AppendLine(
                    string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Matched_spectra__0__,
                                  libraryDetails.TotalPsmCount.ToString(numFormat)));
            }
            if (libraryDetails.DataFiles.Any())
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Data_files___0_,
                                                     libraryDetails.DataFiles.Count()));
            }
            labelLibInfo.Text = detailsText.ToString();
        }
Ejemplo n.º 7
0
        public SpectrumLibraryInfoDlg(LibraryDetails libraryDetails)
        {
            InitializeComponent();

            Icon = Resources.Skyline;

            // library details
            SetDetailsText(libraryDetails);

            // links to library source(s)
            SetLibraryLinks(libraryDetails);

            // list of data files, if available
            if (libraryDetails.DataFiles.Any())
            {
                SetDataFileList(libraryDetails);
                textBoxDataFiles.Show();

                // TODO:  This makes no sense.  This always adds 100 pixels to the form height.
                Height += Math.Max(0, 100);
            }
        }
Ejemplo n.º 8
0
        public SpectrumLibraryInfoDlg(LibraryDetails libraryDetails)
        {
            InitializeComponent();

            Icon = Resources.Skyline;

            // library details
            SetDetailsText(libraryDetails);

            // links to library source(s)
            SetLibraryLinks(libraryDetails);

            // list of data files, if available
            if(libraryDetails.DataFiles.Any())
            {
                SetDataFileList(libraryDetails);
                textBoxDataFiles.Show();

                // TODO:  This makes no sense.  This always adds 100 pixels to the form height.
                Height += Math.Max(0, 100);
            }
        }
Ejemplo n.º 9
0
        private void SetDetailsText(LibraryDetails libraryDetails)
        {
            const string numFormat = "#,0"; // Not L10N

            var detailsText = new StringBuilder();

            detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText__0__library, libraryDetails.Format));
            if(!string.IsNullOrEmpty(libraryDetails.Id))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_ID__0__, libraryDetails.Id));
            }
            if (!string.IsNullOrEmpty(libraryDetails.Revision))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Revision__0__, libraryDetails.Revision));
            }
            if (!string.IsNullOrEmpty(libraryDetails.Version))
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Version__0__, libraryDetails.Version));
            }
            detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Unique_peptides__0__,
                                                 libraryDetails.PeptideCount.ToString(numFormat)));

            if (libraryDetails.TotalPsmCount > 0)
            {
                detailsText.AppendLine(
                    string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Matched_spectra__0__,
                                  libraryDetails.TotalPsmCount.ToString(numFormat)));
            }
            if (libraryDetails.DataFiles.Any())
            {
                detailsText.AppendLine(string.Format(Resources.SpectrumLibraryInfoDlg_SetDetailsText_Data_files___0_,
                                                     libraryDetails.DataFiles.Count()));
            }
            labelLibInfo.Text = detailsText.ToString();
        }
Ejemplo n.º 10
0
        private void SetLibraryLinks(LibraryDetails libraryDetails)
        {
            linkSpecLibLinks.Text = string.Empty;

            if(libraryDetails.LibLinks.Any())
            {
                string labelStr = libraryDetails.LibLinks.Count() == 1
                                      ? Resources.SpectrumLibraryInfoDlg_SetLibraryLinks_Library_source
                                      : Resources.SpectrumLibraryInfoDlg_SetLibraryLinks_Library_sources;

                foreach(LibraryLink link in libraryDetails.LibLinks)
                {
                    labelStr += TextUtil.SEPARATOR_SPACE;
                    linkSpecLibLinks.Links.Add(labelStr.Length, link.Name.Length, link.Link);
                    labelStr += link.Name + "  "; // Not L10N
                }

                linkSpecLibLinks.Text = labelStr;
            }
        }