Example #1
0
 /// <summary>
 /// Update the  window
 /// </summary>
 /// <param name="result"></param>
 internal void UpdateWindow(QuantResult result)
 {
     _result = result;
     GetSpectra(_result);
     SetCitInfo();
     ValidationUIUtilities.ClearChart(chartMS1);
     ValidationUIUtilities.ClearChart(chartMS2);
     ValidationUIUtilities.CreateMS1Chart(chartMS1, citSpectrum);
     ValidationUIUtilities.CreateLoneCitMs2Chart(chartMS2, citSpectrum);
     ValidationUIUtilities.FillIonGridGeneral(metroGridCitIons, citSpectrum, HelperUtilities.CreateAAArray(_result.Sequence));
     if (Quantification.QuantificationResults.Contains(result))
     {
         metroButtonAddQuant.Enabled    = false;
         metroButtonRemoveQuant.Enabled = true;
     }
     else
     {
         metroButtonAddQuant.Enabled    = true;
         metroButtonRemoveQuant.Enabled = false;
     }
 }
Example #2
0
        /// <summary>
        /// Update the quantification window.
        /// </summary>
        /// <param name="result">The quantification result.</param>
        internal void UpdateWindow(QuantResult result)
        {
            // Set the result
            _result = result;
            // Get the spectra
            GetSpectra(_result);
            // Add the info
            SetCitInfo();
            SetArgInfo();
            // Clear the charts
            ValidationUIUtilities.ClearChart(chartArgMS1);
            ValidationUIUtilities.ClearChart(chartCitMS1);
            ValidationUIUtilities.ClearChart(chartMS2);
            // Create the charts
            ValidationUIUtilities.CreateMS1Chart(chartArgMS1, argSpectrum);
            ValidationUIUtilities.CreateMS1Chart(chartCitMS1, citSpectrum);
            ValidationUIUtilities.CreatePairedMs2Chart(chartMS2, citSpectrum, argSpectrum);
            // Create the ion grid
            ValidationUIUtilities.FillIonGridGeneral(metroGridArgIons, argSpectrum, HelperUtilities.CreateAAArray(_result.Sequence));
            ValidationUIUtilities.FillIonGridGeneral(metroGridCitIons, citSpectrum, HelperUtilities.CreateAAArray(_result.Sequence));
            // Set the title and spectrum ID
            labelTitel.Text = string.Format("Quantification - Paired (By {0})", _result.ValidationBy);
            metroLabelCitSpectrumID.Text = _result.CitSpectrumID.ToString();
            metroLabelArgSpectrumID.Text = _result.ArgSpectrumID.ToString();

            if (Quantification.QuantificationResults.Contains(result))
            {
                metroButtonAddQuant.Enabled    = false;
                metroButtonRemoveQuant.Enabled = true;
            }
            else
            {
                metroButtonAddQuant.Enabled    = true;
                metroButtonRemoveQuant.Enabled = false;
            }
        }
Example #3
0
        /// <summary>
        /// Create the image.
        /// </summary>
        /// <param name="directory">The directory the image should be saved to.</param>
        /// <param name="result">The result the image should be created from.</param>
        private void CreateImage(string directory, KeyValuePair <QuantResult, KeyValuePair <MsSpectrum, MsSpectrum> > result)
        {
            KeyValuePair <MsSpectrum, MsSpectrum> spectraData = result.Value;
            // Get the filename
            string baseFilename = string.Format("{0}_{1}_{2}", result.Key.Protein.Split('|')[0], result.Key.Sequence, result.Key.ValidationBy);
            string filename     = FileReader.GenerateFileName(directory, baseFilename, "tiff");

            // Append the file to the annotation writer
            if (_createAnnotationFile)
            {
                _annotationWriter.AppendLine($"** {filename.Split(new string[] { @"\" }, System.StringSplitOptions.None).Last() } **");
            }

            // From the validation type, create the graph
            if (result.Key.ValidationBy == "Lone")
            {
                ValidationUIUtilities.CreateLoneCitMs2Chart(chartMS2, spectraData.Key);
                ValidationUIUtilities.AnnotateSingleSpectra(chartMS2, spectraData.Key, HelperUtilities.CreateAAArray(result.Key.Sequence), true, _createAnnotationFile, _annotationWriter);
            }
            else
            {
                ValidationUIUtilities.CreatePairedMs2Chart(chartMS2, spectraData.Key, spectraData.Value);
                ValidationUIUtilities.AnnotatePairedSpectra(chartMS2, spectraData.Key, spectraData.Value, HelperUtilities.CreateAAArray(result.Key.Sequence), _createAnnotationFile, _annotationWriter);
            }

            // Clear the old titles
            chartMS2.Titles.Clear();
            // And add a new one
            chartMS2.Titles.Add(string.Format("{0}_{1}_{2}", result.Key.Protein.Split('|')[0], result.Key.Sequence, result.Key.ValidationBy));
            chartMS2.Titles[0].Font = new Font(chartMS2.Titles[0].Font.FontFamily, 13F);
            chartMS2.Titles[0].IsDockedInsideChartArea = false;
            chartMS2.Titles[0].Docking       = Docking.Top;
            chartMS2.Titles[0].DockingOffset = 10;

            chartMS2.SaveImage(filename, ChartImageFormat.Tiff);
            ValidationUIUtilities.ClearChart(chartMS2);
            chartMS2.Annotations.Clear();
        }