private void buttonGo_Click(object sender, EventArgs e) { //Check if we have fileNames in the sparse matrix and index text box if (radioButtonFormatProtein.Checked && comboBoxProteinContent.SelectedIndex == -1) { MessageBox.Show("Please select a protein quantitation type"); return; } buttonGo.Text = "Processing!"; this.Update(); toolStripStatusLabel2.Text = "Working..."; this.Update(); DateTime beginTime = DateTime.Now; if (radioButtonSEPro.Checked) { if (radioButtonFormatPeptide.Checked || radioButtonFormatUniquePeptide.Checked) { PeptideParser pp = new PeptideParser(); pp.MyParameters = GetParametersFromGUI(); theParser = pp; } else { ProteinParser pp = new ProteinParser(); pp.UseNSAF = checkBoxNSAF.Checked; pp.UseMaxParsimony = checkBoxUseMaxParsimony.Checked; pp.MyParameters = GetParametersFromGUI(); theParser = pp; } } else if (radioButtonPepExplorer.Checked) { PepExplorerParser pp = new PepExplorerParser(); theParser = pp; } else { MessageBox.Show("Please select a software (SEPro / PepExplorer)"); return; } theParser.ParseDirs(multipleDirectorySelector1.MyDirectoryDescriptionDictionary); theParser.ProcessParsedData(); buttonGo.Text = "Go!"; if (radioButtonFormatProtein.Checked) { GenerateBirdsEyeView(); buttonSaveBirdsEyeView.Enabled = true; } buttonSavePatternLabProject.Enabled = true; toolStripStatusLabel2.Text = "Processing time: " + Math.Ceiling((DateTime.Now - beginTime).TotalMilliseconds).ToString() + " ms."; }
private void GenerateBirdsEyeView() { if (radioButtonPepExplorer.Checked) { buttonSaveBirdsEyeView.Enabled = false; return; } else { buttonSaveBirdsEyeView.Enabled = true; } ProteinParser pp = (ProteinParser)theParser; double[,] results = new double[pp.MyResultPackages.Count * 5, pp.TheIndex.Count]; for (int x1 = 0; x1 < pp.MyResultPackages.Count; x1++) { ResultEntry re = pp.MyResultPackages[x1]; //Calculate NSAF Factor double nsafDenominator = 0; for (int y = 0; y < pp.TheIndex.Count; y++) { ProteinIndexStruct i = pp.TheIndex[y]; int index = re.MyResultPackage.MyProteins.MyProteinList.FindIndex(a => a.Locus.Equals(i.Locus)); if (index > -1) { nsafDenominator += (double)re.MyResultPackage.MyProteins.MyProteinList[index].Scans.Count / (double)re.MyResultPackage.MyProteins.MyProteinList[index].Sequence.Length; } } for (int y = 0; y < pp.TheIndex.Count; y++) { ProteinIndexStruct i = pp.TheIndex[y]; int index = re.MyResultPackage.MyProteins.MyProteinList.FindIndex(a => a.Locus.Equals(i.Locus)); int xPos = x1 * 5; if (index > -1) { double nsaf = ((double)re.MyResultPackage.MyProteins.MyProteinList[index].Scans.Count / (double)re.MyResultPackage.MyProteins.MyProteinList[index].Length) / nsafDenominator; results[xPos, y] = re.MyResultPackage.MyProteins.MyProteinList[index].ContainsUniquePeptide; results[xPos + 1, y] = re.MyResultPackage.MyProteins.MyProteinList[index].PeptideResults.Count(); results[xPos + 2, y] = re.MyResultPackage.MyProteins.MyProteinList[index].Scans.Count; results[xPos + 3, y] = nsaf; results[xPos + 4, y] = re.MyResultPackage.MyProteins.MyProteinList[index].Coverage; } else { results[xPos, y] = -1.0; results[xPos + 1, y] = -1.0; results[xPos + 2, y] = -1.0; results[xPos + 3, y] = -1.0; results[xPos + 4, y] = -1.0; } } } dataGridViewBirdsEyeView.Columns.Clear(); dataGridViewBirdsEyeView.Rows.Clear(); foreach (ResultEntry re in pp.MyResultPackages) { var col = new DataGridViewTextBoxColumn(); col.HeaderText = re.ClassLabel + "::" + re.MyFileInfo.Name + "::" + "UniquePeptideCount"; col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; col.HeaderCell.Style.BackColor = PatternTools.pTools.color[re.ClassLabel + 1]; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewBirdsEyeView.Columns.Add(col); var col2 = new DataGridViewTextBoxColumn(); col2.HeaderText = re.ClassLabel + "::" + re.MyFileInfo.Name + "::" + "PeptideCount"; col2.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; col2.HeaderCell.Style.BackColor = PatternTools.pTools.color[re.ClassLabel + 1]; col2.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewBirdsEyeView.Columns.Add(col2); var col3 = new DataGridViewTextBoxColumn(); col3.HeaderText = re.ClassLabel + "::" + re.MyFileInfo.Name + "::" + "SpecCount"; col3.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; col3.HeaderCell.Style.BackColor = PatternTools.pTools.color[re.ClassLabel + 1]; col3.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewBirdsEyeView.Columns.Add(col3); var col4 = new DataGridViewTextBoxColumn(); col4.HeaderText = re.ClassLabel + "::" + re.MyFileInfo.Name + "::" + "NSAF"; col4.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; col4.HeaderCell.Style.BackColor = PatternTools.pTools.color[re.ClassLabel + 1]; col4.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewBirdsEyeView.Columns.Add(col4); var col5 = new DataGridViewTextBoxColumn(); col5.HeaderText = re.ClassLabel + "::" + re.MyFileInfo.Name + "::" + "Coverage"; col5.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; col5.HeaderCell.Style.BackColor = PatternTools.pTools.color[re.ClassLabel + 1]; col5.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewBirdsEyeView.Columns.Add(col5); } for (int y = 0; y < results.GetLength(1); y++) { int rowI = dataGridViewBirdsEyeView.Rows.Add(); dataGridViewBirdsEyeView.Rows[rowI].HeaderCell.Value = pp.TheIndex[y].Locus + "\t" + pp.TheIndex[y].Description; for (int x = 0; x < results.GetLength(0); x++) { dataGridViewBirdsEyeView.Rows[y].Cells[x].Value = results[x, y]; } } this.Update(); }