Esempio n. 1
0
 public Chromatogram(MzKey mzKey, double mz)
 {
     MzKey       = mzKey;
     Mz          = mz;
     Intensities = new List <float>();
     PeakMzs     = new List <float>();
 }
Esempio n. 2
0
        protected void ShowChromatograms()
        {
            if (MsGraphControl.GraphPane == null)
            {
                // TODO: How can this happen?
                return;
            }
            MsGraphControl.GraphPane.GraphObjList.Clear();
            MsGraphControl.GraphPane.CurveList.Clear();
            var selectedCharges  = gridIntensities.GetSelectedCharges();
            var selectedMasses   = gridIntensities.GetSelectedMasses();
            var chromatograms    = PeptideFileAnalysis.ChromatogramSet;
            var mzRanges         = PeptideFileAnalysis.TurnoverCalculator.GetMzs(0);
            var monoisotopicMass = Workspace.GetAminoAcidFormulas().GetMonoisotopicMass(PeptideAnalysis.Peptide.Sequence);

            for (int charge = PeptideAnalysis.MinCharge; charge <= PeptideAnalysis.MaxCharge; charge++)
            {
                if (selectedCharges.Count > 0 && !selectedCharges.Contains(charge))
                {
                    continue;
                }
                for (int iMass = 0; iMass < PeptideAnalysis.GetMassCount(); iMass++)
                {
                    var    mzKey          = new MzKey(charge, iMass);
                    double massDifference = mzRanges[iMass].Center - monoisotopicMass;

                    var label = massDifference.ToString("0.#");
                    if (label[0] != '-')
                    {
                        label = "+" + label;
                    }
                    label  = "M" + label;
                    label += new string('+', charge);

                    if (selectedMasses.Count > 0)
                    {
                        if (!selectedMasses.Contains(iMass))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (ExcludedMasses.IsExcluded(mzKey.MassIndex))
                        {
                            continue;
                        }
                    }
                    ChromatogramSetData.Chromatogram chromatogram;
                    if (!chromatograms.Chromatograms.TryGetValue(mzKey, out chromatogram))
                    {
                        continue;
                    }
                    var graphItem = new ChromatogramGraphItem
                    {
                        Title = label,
                    };
                    graphItem.Color = TracerChromatogramForm.GetColor(iMass, PeptideAnalysis.GetMassCount());
                    var mzRange      = PeptideFileAnalysis.TurnoverCalculator.GetMzs(mzKey.Charge)[mzKey.MassIndex];
                    var massAccuracy = PeptideAnalysis.GetMassAccuracy();
                    var intensities  = chromatogram.ChromatogramPoints.Select(point => point.GetIntensity(mzRange, massAccuracy)).ToArray();
                    if (Smooth)
                    {
                        intensities = TracerChromatograms.SavitzkyGolaySmooth(intensities);
                    }
                    PointPairList points = new PointPairList(chromatograms.Times, intensities);
                    graphItem.Points = points;
                    var lineItem = (LineItem)MsGraphControl.AddGraphItem(MsGraphControl.GraphPane, graphItem);
                    lineItem.Line.Style      = TracerChromatogramForm.GetDashStyle(charge - PeptideAnalysis.MinCharge);
                    lineItem.Line.Width      = Settings.Default.ChromatogramLineWidth;
                    lineItem.Label.IsVisible = false;
                }
            }
        }
Esempio n. 3
0
        protected void ShowChromatograms()
        {
            if (MsGraphControl.GraphPane == null)
            {
                // TODO: How can this happen?
                return;
            }
            MsGraphControl.GraphPane.GraphObjList.Clear();
            MsGraphControl.GraphPane.CurveList.Clear();
            var selectedCharges = gridIntensities.GetSelectedCharges();
            var selectedMasses = gridIntensities.GetSelectedMasses();
            var chromatograms = PeptideFileAnalysis.ChromatogramSet;
            var mzRanges = PeptideFileAnalysis.TurnoverCalculator.GetMzs(0);
            var monoisotopicMass = Workspace.GetAminoAcidFormulas().GetMonoisotopicMass(PeptideAnalysis.Peptide.Sequence);
            for (int charge = PeptideAnalysis.MinCharge; charge <= PeptideAnalysis.MaxCharge; charge++)
            {
                if (selectedCharges.Count > 0 && !selectedCharges.Contains(charge))
                {
                    continue;
                }
                for (int iMass = 0; iMass < PeptideAnalysis.GetMassCount(); iMass++)
                {
                    var mzKey = new MzKey(charge, iMass);
                    double massDifference = mzRanges[iMass].Center - monoisotopicMass;

                    var label = massDifference.ToString("0.#");
                    if (label[0] != '-')
                    {
                        label = "+" + label;
                    }
                    label = "M" + label;
                    label += new string('+', charge);

                    if (selectedMasses.Count > 0)
                    {
                        if (!selectedMasses.Contains(iMass))
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (ExcludedMasses.IsExcluded(mzKey.MassIndex))
                        {
                            continue;
                        }
                    }
                    ChromatogramSetData.Chromatogram chromatogram;
                    if (!chromatograms.Chromatograms.TryGetValue(mzKey, out chromatogram))
                    {
                        continue;
                    }
                    var graphItem = new ChromatogramGraphItem
                                        {
                                            Title = label,
                                        };
                    graphItem.Color = TracerChromatogramForm.GetColor(iMass, PeptideAnalysis.GetMassCount());
                    var mzRange = PeptideFileAnalysis.TurnoverCalculator.GetMzs(mzKey.Charge)[mzKey.MassIndex];
                    var massAccuracy = PeptideAnalysis.GetMassAccuracy();
                    var intensities = chromatogram.ChromatogramPoints.Select(point => point.GetIntensity(mzRange, massAccuracy)).ToArray();
                    if (Smooth)
                    {
                        intensities = TracerChromatograms.SavitzkyGolaySmooth(intensities);
                    }
                    PointPairList points = new PointPairList(chromatograms.Times, intensities);
                    graphItem.Points = points;
                    var lineItem = (LineItem)MsGraphControl.AddGraphItem(MsGraphControl.GraphPane, graphItem);
                    lineItem.Line.Style = TracerChromatogramForm.GetDashStyle(charge - PeptideAnalysis.MinCharge);
                    lineItem.Line.Width = Settings.Default.ChromatogramLineWidth;
                    lineItem.Label.IsVisible = false;
                }
            }
        }
 public Chromatogram(MzKey mzKey, MzRange mzRange)
 {
     MzKey = mzKey;
     MzRange = mzRange;
     Points = new List<ChromatogramPoint>();
 }
Esempio n. 5
0
 public Chromatogram(MzKey mzKey, MzRange mzRange)
 {
     MzKey   = mzKey;
     MzRange = mzRange;
     Points  = new List <ChromatogramPoint>();
 }
 public Chromatogram(MzKey mzKey, double mz)
 {
     MzKey = mzKey;
     Mz = mz;
     Intensities = new List<float>();
     PeakMzs = new List<float>();
 }