本文整理汇总了C#中Peptide.modifications方法的典型用法代码示例。如果您正苦于以下问题:C# Peptide.modifications方法的具体用法?C# Peptide.modifications怎么用?C# Peptide.modifications使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Peptide
的用法示例。
在下文中一共展示了Peptide.modifications方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addIonSeries
///<summary>Adds user requested ion series on top of the chart.</summary>
private void addIonSeries (GraphObjList list, pwiz.MSGraph.MSPointList points, Peptide peptide, Fragmentation fragmentation, string topSeries, string bottomSeries)
{
int ionSeriesChargeState = min;
string sequence = peptide.sequence;
ModificationMap modifications = peptide.modifications();
// Select the color for the ion series.
Color topSeriesColor;
Color bottomSeriesColor;
switch (topSeries)
{
default: topSeriesColor = Color.Gray; break;
case "a": topSeriesColor = Color.YellowGreen; break;
case "b": topSeriesColor = Color.BlueViolet; break;
case "c": topSeriesColor = Color.Orange; break;
}
switch (bottomSeries)
{
default: bottomSeriesColor = Color.Gray; break;
case "x": bottomSeriesColor = Color.Green; break;
case "y": bottomSeriesColor = Color.Blue; break;
case "z": bottomSeriesColor = Color.OrangeRed; break;
case "z*": bottomSeriesColor = Color.Crimson; break;
}
// Ion series offsets. These offsets control where on the chart a particular ion series
// get displayed
double topSeriesOffset = 0.025;
double bottomSeriesOffset = 0.1;
if (topSeries.Length == 0)
bottomSeriesOffset = topSeriesOffset;
double topSeriesLeftPoint = 0.0;
double bottomSeriesLeftPoint = 0.0;
// Step through each fragmentation site
for (int i = 1; i <= sequence.Length; ++i)
{
// Paint the top series first
double rightPoint = 0.0;
// Figure out the right mz for this fragmentaion site
switch (topSeries)
{
case "a": rightPoint = fragmentation.a(i, ionSeriesChargeState); break;
case "b": rightPoint = fragmentation.b(i, ionSeriesChargeState); break;
case "c": if (i < sequence.Length) rightPoint = fragmentation.c(i, ionSeriesChargeState); break;
default: continue;
}
// If the left mz and right mz are different
if (rightPoint > 0 && topSeriesLeftPoint != rightPoint)
{
LineObj line;
// Use a dashed line format if there are fragment ions supporting this
// amino acid
if (!aminoAcidHasFragmentEvidence(points, topSeriesLeftPoint, rightPoint))
{
// Draw the line from previous mz to site to this mz in trasparent color.
line = new LineObj(Color.FromArgb(115, topSeriesColor), topSeriesLeftPoint, topSeriesOffset, rightPoint, topSeriesOffset);
line.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
}
else
{
// Draw the line from previous mz to site to this mz in solid color.
line = new LineObj(topSeriesColor, topSeriesLeftPoint, topSeriesOffset, rightPoint, topSeriesOffset);
}
line.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
line.Line.Width = 2;
line.ZOrder = ZOrder.F_BehindGrid;
line.IsClippedToChartRect = true;
list.Add(line);
// Add a tick demarking the fragmentation site.
LineObj tick = new LineObj(topSeriesColor, rightPoint, (topSeriesOffset - 0.015), rightPoint, (topSeriesOffset + 0.015));
tick.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
tick.Line.Width = 2;
tick.IsClippedToChartRect = true;
list.Add(tick);
// Add a text box in the middle of the left and right mz boundaries
StringBuilder label = new StringBuilder(sequence[i - 1].ToString());
// Figure out if any mods are there on this amino acid
double deltaMass = modifications[i - 1].monoisotopicDeltaMass();
// Round the mod mass and append it to the amino acid as a string
if (deltaMass > 0.0)
{
label.Append("+" + Math.Round(deltaMass));
}
else if (deltaMass < 0.0)
{
label.Append(Math.Round(deltaMass));
}
TextObj text = new TextObj(label.ToString(), (topSeriesLeftPoint + rightPoint) / 2.0,
topSeriesOffset, CoordType.XScaleYChartFraction, AlignH.Center, AlignV.Center);
text.ZOrder = ZOrder.A_InFront;
text.FontSpec = new FontSpec("Arial", 13, Color.Black, true, false, false);
text.FontSpec.Border.IsVisible = false;
text.FontSpec.Fill.Color = Color.White;
text.IsClippedToChartRect = true;
list.Add(text);
topSeriesLeftPoint = rightPoint;
//.........这里部分代码省略.........
示例2: Update
public override void Update( GraphItem item, pwiz.MSGraph.MSPointList points, GraphObjList annotations )
{
double basePeakIntensity = 0;
double cutoff = 0;
foreach (var pointlist in points)
{
if (basePeakIntensity < pointlist.Y)
basePeakIntensity = pointlist.Y;
}
cutoff = basePeakIntensity * basePeakPercentage * 0.01;
if( !Enabled )
return;
if( !( item is MassSpectrum ) )
return; // throw exception?
GraphObjList list = annotations;
Peptide peptide;
try
{
peptide = new Peptide( sequence,
pwiz.CLI.proteome.ModificationParsing.ModificationParsing_Auto,
pwiz.CLI.proteome.ModificationDelimiter.ModificationDelimiter_Brackets );
} catch( Exception )
{
return;
}
//if (annotationPanels.peptideInfoGridView.InvokeRequired)
//{
// annotationPanels.peptideInfoGridView.BeginInvoke(new MethodInvoker(() => Update(item, points, annotations)));
// //return;
//}
var spectrum = ( item as MassSpectrum ).Element;
if (spectrum.precursors.Count > 0 && ionSeriesIsEnabled(IonSeries.Auto))
{
bool cid = (item as MassSpectrum).Element.precursors[0].activation.hasCVParam(CVID.MS_CID);
bool etd = (item as MassSpectrum).Element.precursors[0].activation.hasCVParam(CVID.MS_ETD);
ionSeries |= cid ? IonSeries.b | IonSeries.y : IonSeries.Off;
ionSeries |= etd ? IonSeries.c | IonSeries.zRadical : IonSeries.Off;
}
string unmodifiedSequence = peptide.sequence;
int sequenceLength = unmodifiedSequence.Length;
Fragmentation fragmentation = peptide.fragmentation( fragmentMassType == 0 ? true : false, true );
//test neutral
ModificationMap modifications = peptide.modifications();
///
#region adding labels for series a/b/c/x/y/z:::::::::naive fragmentation modeling
if (!showBasophileModel)
{
for (int i = 1; i < sequenceLength; ++i)
{
//test neutral loss
//note here the Cseq is slightly different than those in addFragmentSummary
string Nseq = peptide.sequence.Substring(0, i);
string Cseq = peptide.sequence.Substring(sequenceLength - i, i);
string NTempSeq = peptide.sequence.Substring(0, sequenceLength - i);
char[] Nseqchars = Nseq.ToCharArray();
char[] NTempSeqchars = NTempSeq.ToCharArray();
char[] seqchars = peptide.sequence.ToCharArray();
int Nphosmodi = 0;
int NTempPhosmodi = 0;
int Cphosmodi = 0;
int phosmodi = 0;
for (int k = 0; k < i; k++)
{
if (Math.Round(modifications[k].monoisotopicDeltaMass()) == 80 && (seqchars[k] == 'S' || seqchars[k] == 'T' || seqchars[k] == 'Y'))
{
Nphosmodi++;
}
}
for (int k = 0; k < sequenceLength - i; k++)
{
if (Math.Round(modifications[k].monoisotopicDeltaMass()) == 80 && (seqchars[k] == 'S' || seqchars[k] == 'T' || seqchars[k] == 'Y'))
{
NTempPhosmodi++;
}
}
for (int k = 0; k < sequenceLength; k++)
{
if (Math.Round(modifications[k].monoisotopicDeltaMass()) == 80 && (seqchars[k] == 'S' || seqchars[k] == 'T' || seqchars[k] == 'Y'))
{
phosmodi++;
}
}
Cphosmodi = phosmodi - NTempPhosmodi;
for (int charge = min; charge <= max; ++charge)
{
if (ionSeriesIsEnabled(IonSeries.a)) addFragment(list, points, "a", i, charge, fragmentation.a(i, charge));
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));
//.........这里部分代码省略.........
示例3: addFragmentationSummary
///<summary>Adds user requested ion series to the fragmentation summary.</summary>
private void addFragmentationSummary (GraphObjList list, pwiz.MSGraph.MSPointList points, Peptide peptide, Fragmentation fragmentation, string topSeries, string bottomSeries)
{
int ionSeriesChargeState = min;
string sequence = peptide.sequence;
ModificationMap modifications = peptide.modifications();
// Select the color for the ion series.
Color topSeriesColor;
Color bottomSeriesColor;
switch (topSeries)
{
default: topSeriesColor = Color.Gray; break;
case "a": topSeriesColor = Color.YellowGreen; break;
case "b": topSeriesColor = Color.BlueViolet; break;
case "c": topSeriesColor = Color.Orange; break;
}
switch (bottomSeries)
{
default: bottomSeriesColor = Color.Gray; break;
case "x": bottomSeriesColor = Color.Green; break;
case "y": bottomSeriesColor = Color.Blue; break;
case "z": bottomSeriesColor = Color.OrangeRed; break;
case "z*": bottomSeriesColor = Color.Crimson; break;
}
// Ion series offsets. These offsets control where on the chart a particular ion series get displayed
double seriesTopLeftOffset = 0.2;
// Set the constants for starting the label paint
double topSeriesLeftPoint = 0.025;
double residueWidth = 0.5 / ((double) sequence.Length);
double topSeriesRightPoint = topSeriesLeftPoint + 0.5 - residueWidth;
double tickStart = residueWidth / 2.0;
// Process all the series except c and x
for (int i = 1; i <= sequence.Length; ++i)
{
double topSeriesFragmentMZ = 0.0;
double bottomSeriesFragmentMZ = 0.0;
switch (topSeries)
{
case "a": topSeriesFragmentMZ = fragmentation.a(i, ionSeriesChargeState); break;
case "b": topSeriesFragmentMZ = fragmentation.b(i, ionSeriesChargeState); break;
case "c": if (i < sequence.Length) topSeriesFragmentMZ = fragmentation.c(i, ionSeriesChargeState); break;
default: continue;
}
switch (bottomSeries)
{
case "x": if (i < sequence.Length) bottomSeriesFragmentMZ = fragmentation.x(i, ionSeriesChargeState); break;
case "y": bottomSeriesFragmentMZ = fragmentation.y(i, ionSeriesChargeState); break;
case "z": bottomSeriesFragmentMZ = fragmentation.z(i, ionSeriesChargeState); break;
case "z*": bottomSeriesFragmentMZ = fragmentation.zRadical(i, ionSeriesChargeState); break;
default: continue;
}
// Check if the top and bottom fragments have evidence
bool topSeriesHasMatch = false;
bool bottomSeriesHasMatch = false;
if (points != null)
{
topSeriesHasMatch = topSeriesFragmentMZ > 0 && findPointWithTolerance(points, topSeriesFragmentMZ, tolerance) > -1;
bottomSeriesHasMatch = bottomSeriesFragmentMZ > 0 && findPointWithTolerance(points, bottomSeriesFragmentMZ, tolerance) > -1;
}
// Build the label for the amino acid
// Add a text box in the middle of the left and right mz boundaries
StringBuilder label = new StringBuilder(sequence[i - 1].ToString());
// Figure out if any mods are there on this amino acid
double deltaMass = modifications[i - 1].monoisotopicDeltaMass();
// Round the mod mass and append it to the amino acid as a string
if (deltaMass > 0.0)
{
label.Append("+" + Math.Round(deltaMass));
}
else if (deltaMass < 0.0)
{
label.Append(Math.Round(deltaMass));
}
TextObj text = new TextObj(label.ToString(), topSeriesLeftPoint, seriesTopLeftOffset, CoordType.ChartFraction, AlignH.Center, AlignV.Center);
text.ZOrder = ZOrder.A_InFront;
text.FontSpec = new FontSpec("Arial", 13, Color.Black, true, false, false);
text.FontSpec.Border.IsVisible = false;
text.FontSpec.Fill.Color = Color.White;
text.IsClippedToChartRect = false;
list.Add(text);
if (topSeriesHasMatch)
{
// Paint the tick in the middle
LineObj tick = new LineObj(topSeriesColor, topSeriesLeftPoint + tickStart, (seriesTopLeftOffset - 0.05), topSeriesLeftPoint + tickStart, seriesTopLeftOffset);
tick.Location.CoordinateFrame = CoordType.ChartFraction;
tick.Line.Width = 2;
tick.IsClippedToChartRect = true;
list.Add(tick);
// Paint the hook
//.........这里部分代码省略.........
示例4: addFragmentationSummary
///<summary>Adds user requested ion series to the fragmentation summary.</summary>
private void addFragmentationSummary(GraphObjList list, pwiz.MSGraph.MSPointList points, Peptide peptide, Fragmentation fragmentation, string topSeries, string bottomSeries)
{
///cutoff definition for neutral loss
double basePeakIntensity = 0;
double cutoff = 0;
foreach (var pointlist in points)
{
if (basePeakIntensity < pointlist.Y)
basePeakIntensity = pointlist.Y;
}
cutoff = basePeakIntensity * basePeakPercentage * 0.01;
///
int ionSeriesChargeState = min;
string sequence = peptide.sequence;
int sequenceLength = peptide.sequence.Length;
ModificationMap modifications = peptide.modifications();
// Select the color for the ion series.
Color topSeriesColor;
Color bottomSeriesColor;
switch (topSeries)
{
default: topSeriesColor = Color.Gray; break;
case "a": topSeriesColor = Color.YellowGreen; break;
case "b": topSeriesColor = Color.Red; break;
case "c": topSeriesColor = Color.Orange; break;
}
switch (bottomSeries)
{
default: bottomSeriesColor = Color.Gray; break;
case "x": bottomSeriesColor = Color.Green; break;
case "y": bottomSeriesColor = Color.Blue; break;
case "z": bottomSeriesColor = Color.OrangeRed; break;
case "z*": bottomSeriesColor = Color.Crimson; break;
}
// Ion series offsets. These offsets control where on the chart a particular ion series
// get displayed
//change the seriesTopLeftOffset value to 0.1 to make the label higher in the image.
//original is 0.031
double seriesTopLeftOffset = 0.05;
// Set the constants for starting the label paint
double topSeriesLeftPoint = 0.025;
//test and looks reasonalbe
double residueWidth = 0.031;
//double residueWidth = 0.25 / ((double)sequence.Length);
// Process all the series except c and x
//small block modified
//here is a big bug: if go like orignal code, then the y ions is just the like the order of b ions, which are not right.
//My modification is to seperate a/b/c and x/y/z ions, and then it will solve this problem.
//it seems works well.
///
#region Process a/b ions
//first we are going to touch only a/b ions
///
for (int i = 1; i <= sequence.Length; ++i)
{
double tickStart = residueWidth * 4 / 5.0;
double topSeriesFragmentMZ = 0.0;
//test neutral loss
//this block is to give clear clue for phospate loss
//exact number of phosphated amino acids are counted.
string Nseq = peptide.sequence.Substring(0, i);
char[] Nseqchars = Nseq.ToCharArray();
int Nphosmodi = 0;
for (int k = 0; k < i; k++)
{
if (Math.Round(modifications[k].monoisotopicDeltaMass()) == 80 && (Nseqchars[k] == 'S' || Nseqchars[k] == 'T' || Nseqchars[k] == 'Y'))
{
Nphosmodi++;
}
}
//correct the bug:
//when multiple charges allowed for fragmentation, then there is no tick thing showing the existance of the fragment
//what I did is: make top/bottomSeriesHasMatch true if there is fragment of any charges matched.
//bug fixed
bool topSeriesHasMatch = false;
for (int z = min; z <= max; z++)
{
switch (topSeries)
{
case "a": topSeriesFragmentMZ = fragmentation.a(i, z); break;
case "b": topSeriesFragmentMZ = fragmentation.b(i, z); break;
default: topSeriesFragmentMZ = 0.0; break;
}
// Check if the top and bottom fragments have evidence
if (points != null)
{
// Search index
int index = -1;
// Find the left mz value using a mass tolerance of 0.5 da.
index = points.FullLowerBound(topSeriesFragmentMZ - 0.5);
//.........这里部分代码省略.........