当前位置: 首页>>代码示例>>C#>>正文


C# Peptide.monoisotopicMass方法代码示例

本文整理汇总了C#中Peptide.monoisotopicMass方法的典型用法代码示例。如果您正苦于以下问题:C# Peptide.monoisotopicMass方法的具体用法?C# Peptide.monoisotopicMass怎么用?C# Peptide.monoisotopicMass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Peptide的用法示例。


在下文中一共展示了Peptide.monoisotopicMass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update


//.........这里部分代码省略.........
                    bottomSeries = "y";
                    if (showLadders)
                        addIonSeries(list, points, peptide, fragmentation, topSeries, bottomSeries);
                    if (showFragmentationSummary)
                        addFragmentationSummary(list, points, peptide, fragmentation, topSeries, bottomSeries);
                }
                if (ionSeriesIsEnabled(IonSeries.z))
                {
                    bottomSeries = "z";
                    if (showLadders)
                        addIonSeries(list, points, peptide, fragmentation, topSeries, bottomSeries);
                    if (showFragmentationSummary)
                        addFragmentationSummary(list, points, peptide, fragmentation, topSeries, bottomSeries);
                }
                if (ionSeriesIsEnabled(IonSeries.zRadical))
                {
                    bottomSeries = "z*";
                    if (showLadders)
                        addIonSeries(list, points, peptide, fragmentation, topSeries, bottomSeries);
                    if (showFragmentationSummary)
                        addFragmentationSummary(list, points, peptide, fragmentation, topSeries, bottomSeries);
                }
            }

            annotationPanels.peptideInfoGridView.Rows.Clear();

            if( spectrum.precursors.Count > 0 &&
                spectrum.precursors[0].selectedIons.Count > 0 &&
                spectrum.precursors[0].selectedIons[0].hasCVParam( CVID.MS_selected_ion_m_z ) &&
                spectrum.precursors[0].selectedIons[0].hasCVParam( CVID.MS_charge_state ) )
            {
                double selectedMz = (double) spectrum.precursors[0].selectedIons[0].cvParam( CVID.MS_selected_ion_m_z ).value;
                int chargeState = (int) spectrum.precursors[0].selectedIons[0].cvParam( CVID.MS_charge_state ).value;
                double calculatedMass = ( precursorMassType == 0 ? peptide.monoisotopicMass( chargeState ) : peptide.molecularWeight( chargeState ) ) * chargeState;
                double observedMass = selectedMz * chargeState;
                annotationPanels.peptideInfoGridView.Rows.Add( "Calculated mass:", calculatedMass, "Mass error (daltons):", observedMass - calculatedMass );
                annotationPanels.peptideInfoGridView.Rows.Add( "Observed mass:", observedMass, "Mass error (ppm):", ( ( observedMass - calculatedMass ) / calculatedMass ) * 1e6 );
            } else
                annotationPanels.peptideInfoGridView.Rows.Add( "Calculated neutral mass:", precursorMassType == 0 ? peptide.monoisotopicMass() : peptide.molecularWeight() );

            annotationPanels.peptideInfoGridView.Columns[1].DefaultCellStyle.Format = "F4";
            foreach( DataGridViewRow row in annotationPanels.peptideInfoGridView.Rows )
                row.Height = row.InheritedStyle.Font.Height + 2;

            // TODO: fragmentInfoGridView is slow: make it faster, optional, or both!

            annotationPanels.fragmentInfoGridView.SuspendLayout();

            if( ionSeries > IonSeries.Auto )
            {
                if( annotationPanels.fragmentInfoGridView.Columns.Count == 0 )
                {
                    if (ionSeriesIsEnabled(IonSeries.a))
                        for (int charge = min; charge <= max; ++charge)
                            annotationPanels.fragmentInfoGridView.Columns.Add(
                                "a" + charge.ToString(),
                                "a" + (charge > 1 ? "(+" + charge.ToString() + ")" : ""));
                    if (ionSeriesIsEnabled(IonSeries.b))
                        for (int charge = min; charge <= max; ++charge)
                            annotationPanels.fragmentInfoGridView.Columns.Add(
                                "b" + charge.ToString(),
                                "b" + (charge > 1 ? "(+" + charge.ToString() + ")" : ""));
                    if (ionSeriesIsEnabled(IonSeries.c))
                        for (int charge = min; charge <= max; ++charge)
                            annotationPanels.fragmentInfoGridView.Columns.Add(
                                "c" + charge.ToString(),
开发者ID:hap-adong,项目名称:SeeMS,代码行数:67,代码来源:Annotation.cs

示例2: Update


//.........这里部分代码省略.........
                    if (ionSeriesIsEnabled(IonSeries.b)) addFragment(list, points, "b", i, charge, fragmentation.b(i, charge));
                    if (ionSeriesIsEnabled(IonSeries.y)) addFragment(list, points, "y", i, charge, fragmentation.y(i, charge));
                    if (ionSeriesIsEnabled(IonSeries.z)) addFragment(list, points, "z", i, charge, fragmentation.z(i, charge));
                    if (ionSeriesIsEnabled(IonSeries.zRadical)) addFragment(list, points, "z*", i, charge, fragmentation.zRadical(i, charge));

                    if (i < sequenceLength)
                    {
                        if (ionSeriesIsEnabled(IonSeries.c)) addFragment(list, points, "c", i, charge, fragmentation.c(i, charge));
                        if (ionSeriesIsEnabled(IonSeries.x)) addFragment(list, points, "x", i, charge, fragmentation.x(i, charge));
                    }
                }
            }

            if (showLadders || showFragmentationSummary)
            {
                string topSeries = ionSeriesIsEnabled(IonSeries.a) ? "a" : ionSeriesIsEnabled(IonSeries.b) ? "b" : ionSeriesIsEnabled(IonSeries.c) ? "c" : "";
                string bottomSeries = ionSeriesIsEnabled(IonSeries.x) ? "x" : ionSeriesIsEnabled(IonSeries.y) ? "y" : ionSeriesIsEnabled(IonSeries.z) ? "z" : ionSeriesIsEnabled(IonSeries.zRadical) ? "z*" : "";
                if (showLadders)
                    addIonSeries(list, points, peptide, fragmentation, topSeries, bottomSeries);
                if (showFragmentationSummary)
                    addFragmentationSummary(list, points, peptide, fragmentation, topSeries, bottomSeries);
            }

            // fill peptide info table
            annotationPanels.peptideInfoGridView.Rows.Clear();

            if (spectrum.precursors.Count > 0 &&
                spectrum.precursors[0].selectedIons.Count > 0 &&
                spectrum.precursors[0].selectedIons[0].hasCVParam(CVID.MS_selected_ion_m_z) &&
                spectrum.precursors[0].selectedIons[0].hasCVParam(CVID.MS_charge_state))
            {
                double selectedMz = (double) spectrum.precursors[0].selectedIons[0].cvParam(CVID.MS_selected_ion_m_z).value;
                int chargeState = (int) spectrum.precursors[0].selectedIons[0].cvParam(CVID.MS_charge_state).value;
                double calculatedMass = (precursorMassType == 0 ? peptide.monoisotopicMass(chargeState) : peptide.molecularWeight(chargeState)) * chargeState;
                double observedMass = selectedMz * chargeState;
                annotationPanels.peptideInfoGridView.Rows.Add("Calculated mass:", calculatedMass, "Mass error (daltons):", observedMass - calculatedMass);
                annotationPanels.peptideInfoGridView.Rows.Add("Observed mass:", observedMass, "Mass error (ppm):", ((observedMass - calculatedMass) / calculatedMass) * 1e6);
            }
            else
                annotationPanels.peptideInfoGridView.Rows.Add("Calculated neutral mass:", precursorMassType == 0 ? peptide.monoisotopicMass() : peptide.molecularWeight());

            annotationPanels.peptideInfoGridView.Columns[1].DefaultCellStyle.Format = "F4";
            foreach (DataGridViewRow row in annotationPanels.peptideInfoGridView.Rows)
                row.Height = row.InheritedStyle.Font.Height + 2;

            // show/hide/update fragment table
            if (!annotationPanels.showFragmentationTableCheckBox.Checked || ionSeries <= IonSeries.Auto)
            {
                annotationPanels.fragmentInfoGridView.Visible = false;
                annotationPanels.fragmentInfoGridView.Rows.Clear();
                return;
            }

            annotationPanels.fragmentInfoGridView.Visible = true;
            annotationPanels.fragmentInfoGridView.SuspendLayout();

            if (annotationPanels.fragmentInfoGridView.Columns.Count == 0)
            {
                #region Add columns for fragment types
                if (ionSeriesIsEnabled(IonSeries.a))
                    for (int charge = min; charge <= max; ++charge)
                        annotationPanels.fragmentInfoGridView.Columns.Add(
                            "a" + charge.ToString(),
                            "a" + (charge > 1 ? "(+" + charge.ToString() + ")" : ""));
                if (ionSeriesIsEnabled(IonSeries.b))
                    for (int charge = min; charge <= max; ++charge)
开发者ID:lgatto,项目名称:proteowizard,代码行数:67,代码来源:Annotation.cs

示例3: Update

        public override void Update( GraphItem item, pwiz.MSGraph.MSPointList points, GraphObjList annotations )
        {
            if( !Enabled )
                return;

            if( !( item is MassSpectrum ) )
                return; // throw exception?

            GraphObjList list = annotations;
            Peptide peptide;

            try
            {
                peptide = new Peptide( currentSequence,
                    pwiz.CLI.proteome.ModificationParsing.ModificationParsing_Auto,
                    pwiz.CLI.proteome.ModificationDelimiter.ModificationDelimiter_Brackets );
            } catch( Exception )
            {
                return;
            }

            string unmodifiedSequence = peptide.sequence;
            int sequenceLength = unmodifiedSequence.Length;
            Fragmentation fragmentation = peptide.fragmentation( fragmentMassType == 0 ? true : false, true );
            // Keeps track of number of fragments predicted and matched in each ion series
            numFragmentsMatched.Clear();
            numFragmentsPredicted.Clear();
            for( int charge = min; charge <= max; ++charge )
            {
                for( int i = 1; i <= sequenceLength; ++i )
                {
                    if( a ) addFragment( list, points, "a", i, charge, fragmentation.a( i, charge ) );
                    if( b ) addFragment( list, points, "b", i, charge, fragmentation.b( i, charge ) );
                    if( y ) addFragment( list, points, "y", i, charge, fragmentation.y( i, charge ) );
                    if( z ) addFragment( list, points, "z", i, charge, fragmentation.z( i, charge ) );
                    if( zRadical ) addFragment( list, points, "z*", i, charge, fragmentation.zRadical( i, charge ) );

                    if( i < sequenceLength )
                    {
                        if( c ) addFragment( list, points, "c", i, charge, fragmentation.c( i, charge ) );
                        if( x ) addFragment( list, points, "x", i, charge, fragmentation.x( i, charge ) );
                    }
                }
            }

            if( showLadders )
            {
                string topSeries = a ? "a" : b ? "b" : c ? "c" : "";
                string bottomSeries = x ? "x" : y ? "y" : z ? "z" : zRadical ? "z*" : "";
                addIonSeries( list, points, peptide, fragmentation, topSeries, bottomSeries );
            }

            // fill peptide info table
            annotationPanels.peptideInfoGridView.Rows.Clear();

            var spectrum = ( item as MassSpectrum ).Element;            
            //if( spectrum.precursors.Count > 0 &&
            //    spectrum.precursors[0].selectedIons.Count > 0 &&
            //    spectrum.precursors[0].selectedIons[0].hasCVParam( pwiz.CLI.cv.CVID.MS_selected_ion_m_z ) &&
            //    spectrum.precursors[0].selectedIons[0].hasCVParam( pwiz.CLI.cv.CVID.MS_charge_state ) )
            //{
            //    double selectedMz = (double) spectrum.precursors[0].selectedIons[0].cvParam( pwiz.CLI.cv.CVID.MS_selected_ion_m_z ).value;
            //    int chargeState = (int) spectrum.precursors[0].selectedIons[0].cvParam( pwiz.CLI.cv.CVID.MS_charge_state ).value;
            //    double calculatedMass = ( precursorMassType == 0 ? peptide.monoisotopicMass( chargeState ) : peptide.molecularWeight( chargeState ) ) * chargeState;
            //    double observedMass = selectedMz * chargeState;
            //    annotationPanels.peptideInfoGridView.Rows.Add( "Calculated mass:", calculatedMass, "Mass error (daltons):", observedMass - calculatedMass );
            //    annotationPanels.peptideInfoGridView.Rows.Add( "Observed mass:", observedMass, "Mass error (ppm):", ( ( observedMass - calculatedMass ) / calculatedMass ) * 1e6 );
            //} else
            //    annotationPanels.peptideInfoGridView.Rows.Add( "Calculated neutral mass:", precursorMassType == 0 ? peptide.monoisotopicMass() : peptide.molecularWeight() );

            if (spectrum.precursors.Count > 0 &&
                spectrum.precursors[0].selectedIons.Count > 0 &&
                spectrum.precursors[0].selectedIons[0].hasCVParam(pwiz.CLI.cv.CVID.MS_selected_ion_m_z))
            {
                double selectedMz = (double)spectrum.precursors[0].selectedIons[0].cvParam(pwiz.CLI.cv.CVID.MS_selected_ion_m_z).value;
                
                // Add xcorr score
                ZedGraph.IPointList peaks = (item as MassSpectrum).Points;
                List<ScoringUtils.Peak> rawPeaks = new List<ScoringUtils.Peak>();
                for (int i = 0; i < peaks.Count; ++i)
                    rawPeaks.Add(new ScoringUtils.Peak(peaks[i].X, peaks[i].Y));
                // Remove the precursor and associated neutral loss peaks
                ScoringUtils.erasePrecursorIons(selectedMz, ref rawPeaks); //selectedMz = precursorMz

                if (spectrum.precursors[0].selectedIons[0].hasCVParam(pwiz.CLI.cv.CVID.MS_charge_state)) // known precursor charge state
                {
                    int chargeState = (int)spectrum.precursors[0].selectedIons[0].cvParam(pwiz.CLI.cv.CVID.MS_charge_state).value;
                    double calculatedMass = (precursorMassType == 0 ? peptide.monoisotopicMass(chargeState) : peptide.molecularWeight(chargeState)) * chargeState;
                    double observedMass = selectedMz * chargeState;
                    // compute XCorr
                    double precursorMH = (selectedMz * chargeState) - ((chargeState - 1) * 1.007276);
                    double xcorr = ScoringUtils.computeXCorr(rawPeaks, peptide, precursorMH);
                    annotationPanels.peptideInfoGridView.Rows.Add("Observed precursor charge:", chargeState, "XCorr:", xcorr);
                    annotationPanels.peptideInfoGridView.Rows.Add("Calculated mass:", calculatedMass, "Mass error (daltons):", observedMass - calculatedMass);
                    annotationPanels.peptideInfoGridView.Rows.Add("Observed mass:", observedMass, "Mass error (ppm):", ((observedMass - calculatedMass) / calculatedMass) * 1e6);

                    
                }
                else  // unknown precursor charge state, assume +2 or +3
                {
//.........这里部分代码省略.........
开发者ID:lgatto,项目名称:proteowizard,代码行数:101,代码来源:Annotation.cs


注:本文中的Peptide.monoisotopicMass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。