/// <summary> /// This function trigges when an interpretation is double clicked. /// It prepares the annotation and spectrum viewer panels. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void triggerSpectrumViewer(object sender, EventArgs e) { // Get the current row DataGridViewRow row = pepGridView.CurrentRow; tbPepNovoResult.Clear(); if (row != null) { string spectrumSrc = tbSpecFile.Text; //string sequence = row.Cells["Sequence"].Value.ToString(); string interpetation = row.Cells["Sequence"].Value.ToString(); string nativeID = row.Cells["NativeID"].Value.ToString(); if (!spectrumSrc.Equals(string.Empty) && currentPepGridSelection != row) { try { // Resolve the spectrum source //var source = Path.GetFileNameWithoutExtension(spectrumSrc); //var paths = Properties.Settings.Default.SourcePath.Split(";".ToCharArray()); //var matches = FindFileInSearchPath(source, new string[] { "mzXML", "mzML", "mgf", "RAW" }, paths.ToArray(), true); //if(matches.Length == 0) // MessageBox.Show("Can't find source. Set the source folder path."); //else //{ // var interpetation = sequence; //interpetation = interpetation.Replace('(', '['); //interpetation = interpetation.Replace(')', ']'); splitContainer4.Panel1.Hide(); splitContainer4.Panel2.Hide(); //splitContainer3.Panel2.Hide(); splitContainer5.Panel1.Hide(); //splitContainer5.Panel2.Hide(); Application.DoEvents(); //UniqueSpectrumID uniqueSpectrumID; // for alternative interpretations // Create a spectrum viewer and add its components if (nativeID != null && nativeID.Length > 0) { //currentSpectrumViewer = new SpectrumViewer(matches[0],nativeID,interpetation); currentSpectrumViewer = new SpectrumViewer(spectrumSrc, nativeID, interpetation); //uniqueSpectrumID = new UniqueSpectrumID(source, spectrum.nativeID, spectrum.id.charge); } //else //{ // //currentSpectrumViewer = new SpectrumViewer(matches[0], index, interpetation); // //uniqueSpectrumID = new UniqueSpectrumID(source, spectrum.id.index, spectrum.id.charge); //} splitContainer4.Panel1.Controls.Clear(); splitContainer4.Panel1.Controls.Add(currentSpectrumViewer.annotationPanel); splitContainer4.Panel2.Controls.Clear(); splitContainer4.Panel2.Controls.Add(currentSpectrumViewer.fragmentationPanel); //splitContainer3.Panel2.Controls.Clear(); //splitContainer3.Panel2.Controls.Add(currentSpectrumViewer.spectrumPanel); //splitContainer3.Panel2.AutoScroll = true; splitContainer5.Panel1.Controls.Clear(); splitContainer5.Panel1.Controls.Add(currentSpectrumViewer.spectrumPanel); splitContainer5.Panel1.AutoScroll = true; //splitContainer1.Panel2.Controls.Add(splitContainer5); splitContainer4.Panel1.Show(); splitContainer4.Panel2.Show(); //splitContainer3.Panel2.Show(); splitContainer5.Panel1.Show(); splitContainer5.Panel2.Show(); Application.DoEvents(); // If we have a seconday result associated with this spectrum, // set the mechanism in spectrum viewer to see it. //if(alternativeInterpretations != null) //{ // if (alternativeInterpretations.Contains(uniqueSpectrumID)) // { // VariantInfo alt = alternativeInterpretations[uniqueSpectrumID]; // interpetation = alt.ToSimpleString(); // interpetation = interpetation.Replace('(', '['); // interpetation = interpetation.Replace(')', ']'); // currentSpectrumViewer.setSecondarySequence(interpetation); // } //} currentPepGridSelection = row; //} } catch (Exception exp) { MessageBox.Show(exp.StackTrace); MessageBox.Show("Failed to show spectrum. Check raw data path."); } } } }
/// <summary> /// This function trigges when an interpretation is double clicked. /// It prepares the annotation and spectrum viewer panels. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void triggerSpectrumViewer(object sender, EventArgs e) { // Get the current row DataGridViewRow row = pepGridView.CurrentRow; tbPepNovoResult.Clear(); if(row != null) { string spectrumSrc = tbSpecFile.Text; //string sequence = row.Cells["Sequence"].Value.ToString(); string interpetation = row.Cells["Sequence"].Value.ToString(); string nativeID = row.Cells["NativeID"].Value.ToString(); if (!spectrumSrc.Equals(string.Empty) && currentPepGridSelection != row) { try { // Resolve the spectrum source //var source = Path.GetFileNameWithoutExtension(spectrumSrc); //var paths = Properties.Settings.Default.SourcePath.Split(";".ToCharArray()); //var matches = FindFileInSearchPath(source, new string[] { "mzXML", "mzML", "mgf", "RAW" }, paths.ToArray(), true); //if(matches.Length == 0) // MessageBox.Show("Can't find source. Set the source folder path."); //else //{ // var interpetation = sequence; //interpetation = interpetation.Replace('(', '['); //interpetation = interpetation.Replace(')', ']'); splitContainer4.Panel1.Hide(); splitContainer4.Panel2.Hide(); //splitContainer3.Panel2.Hide(); splitContainer5.Panel1.Hide(); //splitContainer5.Panel2.Hide(); Application.DoEvents(); //UniqueSpectrumID uniqueSpectrumID; // for alternative interpretations // Create a spectrum viewer and add its components if(nativeID!=null && nativeID.Length>0) { //currentSpectrumViewer = new SpectrumViewer(matches[0],nativeID,interpetation); currentSpectrumViewer = new SpectrumViewer(spectrumSrc, nativeID, interpetation); //uniqueSpectrumID = new UniqueSpectrumID(source, spectrum.nativeID, spectrum.id.charge); } //else //{ // //currentSpectrumViewer = new SpectrumViewer(matches[0], index, interpetation); // //uniqueSpectrumID = new UniqueSpectrumID(source, spectrum.id.index, spectrum.id.charge); //} splitContainer4.Panel1.Controls.Clear(); splitContainer4.Panel1.Controls.Add(currentSpectrumViewer.annotationPanel); splitContainer4.Panel2.Controls.Clear(); splitContainer4.Panel2.Controls.Add(currentSpectrumViewer.fragmentationPanel); //splitContainer3.Panel2.Controls.Clear(); //splitContainer3.Panel2.Controls.Add(currentSpectrumViewer.spectrumPanel); //splitContainer3.Panel2.AutoScroll = true; splitContainer5.Panel1.Controls.Clear(); splitContainer5.Panel1.Controls.Add(currentSpectrumViewer.spectrumPanel); splitContainer5.Panel1.AutoScroll = true; //splitContainer1.Panel2.Controls.Add(splitContainer5); splitContainer4.Panel1.Show(); splitContainer4.Panel2.Show(); //splitContainer3.Panel2.Show(); splitContainer5.Panel1.Show(); splitContainer5.Panel2.Show(); Application.DoEvents(); // If we have a seconday result associated with this spectrum, // set the mechanism in spectrum viewer to see it. //if(alternativeInterpretations != null) //{ // if (alternativeInterpretations.Contains(uniqueSpectrumID)) // { // VariantInfo alt = alternativeInterpretations[uniqueSpectrumID]; // interpetation = alt.ToSimpleString(); // interpetation = interpetation.Replace('(', '['); // interpetation = interpetation.Replace(')', ']'); // currentSpectrumViewer.setSecondarySequence(interpetation); // } //} currentPepGridSelection = row; //} } catch(Exception exp) { MessageBox.Show(exp.StackTrace); MessageBox.Show("Failed to show spectrum. Check raw data path."); } } } }