Exemplo n.º 1
0
        /// <summary>
        /// Update the spectrum validation.
        /// </summary>
        /// <param name="spectrumValID">The spectrum ID.</param>
        internal void UpdateValidationUI(int spectrumValID)
        {
            // Find the citrullinated spectrum
            FindCitrullineSpectraKeyValuePair(spectrumValID);
            // If the spectra is marked for quantification, get the index of the complementary spectra that has been marked
            int complIndex = 0;

            if (Validation.citChosenForQuantList.Contains(valKVP.Key.ID))
            {
                complIndex = Quantification.GetQuantifiedComplementaryArgSpectrumId(valKVP.Key, valKVP.Value);
            }

            // Update the spectrum id label
            ChangeSpectrumIDAndScoreLabel();
            // Update the MS2 chart
            ValidationUIUtilities.ClearChart(chartMS2);
            ValidationUIUtilities.CreatePairedMs2Chart(chartMS2, valKVP.Key, valKVP.Value[complIndex]);
            // Update the MS1 charts
            ValidationUIUtilities.ClearChart(chartCitMS1);
            ValidationUIUtilities.ClearChart(chartArgMS1);
            ValidationUIUtilities.CreateMS1Chart(chartCitMS1, valKVP.Key);
            ValidationUIUtilities.CreateMS1Chart(chartArgMS1, valKVP.Value[complIndex]);
            // Update the ion grid
            ValidationUIUtilities.FillCitIonGrid(metroGridCitIons, valKVP.Key);
            ValidationUIUtilities.FillCitIonGrid(metroGridArgIons, valKVP.Value[complIndex]);
            // Update the buttons
            CheckBeforeButtonDisabling();
            EnableQuantButtons(valKVP.Key);
            ReturnArgIndex(complIndex);
            // Update the information
            AddCitInfo();
            AddArgInfo(complIndex);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update the validation window with a new spectrum
        /// </summary>
        /// <param name="argSpectrumValID">The new spectrum ID.</param>
        internal void UpdateValidationArgUI(int argSpectrumValID)
        {
            // Get the spectrum
            FindArginineSpectraKeyValuePair(argSpectrumValID);
            // If the spectra is marked for quantification, get the index of the complementary spectra that has been marked
            int complIndex = 0;

            if (Validation.argChosenForQuantList.Contains(valKVP.Key.ID))
            {
                complIndex = Quantification.GetQuantifiedComplementaryCitSpectrumIndex(valKVP.Key, valKVP.Value);
            }
            // Update the spectrum ID label
            ChangeSpectrumIDAndScoreLabel();
            // Clear the chart
            ValidationUIUtilities.ClearChart(chartMS2);
            // Create the chart
            ValidationUIUtilities.CreatePairedMs2Chart(chartMS2, valKVP.Value[complIndex], valKVP.Key);
            ValidationUIUtilities.ClearChart(chartArgMS1);
            ValidationUIUtilities.ClearChart(chartPotCitMS1);
            // Update the MS1 charts
            ValidationUIUtilities.CreateMS1Chart(chartArgMS1, valKVP.Key);
            ValidationUIUtilities.CreateMS1Chart(chartPotCitMS1, valKVP.Value[complIndex]);
            // Fill the ion grid with data
            ValidationUIUtilities.FillCitIonGrid(metroGridArgIons, valKVP.Key);
            ValidationUIUtilities.FillArgIonGrid(metroGridPotCitIons, valKVP.Value[complIndex], valKVP.Key);
            // Check if buttons should be enabled or disabled

            CheckBeforeButtonDisabling();
            EnableQuantButtons(valKVP.Key);

            ReturnPotCitIndex(complIndex);
            // Add information about peptides
            AddArgInfo();
            AddPotCitInfo(complIndex);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Update the spectrum validation.
 /// </summary>
 /// <param name="spectrumValID">The spectrum ID.</param>
 internal void UpdateValidationUI(int spectrumValID)
 {
     // Find the spectrum
     FindSpec(spectrumValID);
     // Update the MS2 chart
     ValidationUIUtilities.ClearChart(chartMS2);
     ValidationUIUtilities.CreateLoneCitMs2Chart(chartMS2, valSpec);
     // Update the MS1 chart
     ValidationUIUtilities.ClearChart(chartMS1);
     ValidationUIUtilities.CreateMS1Chart(chartMS1, valSpec);
     // Fill the ion grid
     ValidationUIUtilities.FillCitIonGrid(metroGridCitIons, valSpec);
     // Update the quantification buttons.
     EnableQuantButtons(valSpec);
     // Add the citrullination information
     AddCitInfo();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Go to the previous arginine scan.
        /// </summary>
        private void MetroButtonPrevArgScan_Click(object sender, EventArgs e)
        {
            // Check if has reached the start
            int index = argIndex - 1;

            if (index == 0)
            {
                // If so disable the previous button
                metroButtonPrevArgScan.Enabled = false;
            }
            AddNextArgSeries(index);
            AddNextArgMS1Series(valKVP.Value[index]);
            ValidationUIUtilities.FillCitIonGrid(metroGridArgIons, valKVP.Value[index]);
            AddArgInfo(index);
            metroButtonNextArgScan.Enabled = true;
            ReturnArgIndex(index);
        }
Exemplo n.º 5
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;
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Go to the previous potential citrullination scan.
        /// </summary>
        private void MetroButtonPrevPotCitScan_Click(object sender, EventArgs e)
        {
            // Check if has reached the start
            int index = potCitIndex - 1;

            if (index == 0)
            {
                // If so, disable the previous button
                metroButtonPrevPotCitScan.Enabled = false;
            }
            // Get the next potential citrullination series
            AddNextPotCitSeries(index);
            // Get the next potential citrullination series to MS1 chart
            AddNextPotCitMS1Series(valKVP.Value[index]);
            // Fill the ion grid
            ValidationUIUtilities.FillArgIonGrid(metroGridPotCitIons, valKVP.Value[index], valKVP.Key);
            // Enable the next button
            metroButtonNextPotCitScan.Enabled = true;
            // Add potential citrullination info to the window
            AddPotCitInfo(index);
            ReturnPotCitIndex(index);
        }
Exemplo n.º 7
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();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Go to the next arginine scan.
        /// </summary>
        private void MetroButtonNextArgScan_Click(object sender, EventArgs e)
        {
            // Check if has reached the end
            int length = valKVP.Value.Count() - 1;
            int index  = argIndex + 1;

            if (index == length)
            {
                // If so, disable the next button
                metroButtonNextArgScan.Enabled = false;
            }
            // Get the next arginine series
            AddNextArgSeries(index);
            // Get the next arginine MS1 series
            AddNextArgMS1Series(valKVP.Value[index]);
            // Fill the ion grid
            ValidationUIUtilities.FillCitIonGrid(metroGridArgIons, valKVP.Value[index]);
            // Add arginine information
            AddArgInfo(index);
            // Disbale the previous button
            metroButtonPrevArgScan.Enabled = true;
            ReturnArgIndex(index);
        }
Exemplo n.º 9
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;
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Add the next potential citrullination series.
 /// </summary>
 /// <param name="index">The series index.</param>
 private void AddNextPotCitSeries(int index)
 {
     ValidationUIUtilities.ClearChart(chartMS2);
     ValidationUIUtilities.CreatePairedMs2Chart(chartMS2, valKVP.Value[index], valKVP.Key);
 }